docker-apps/home-assistant/configuration.yml

161 lines
5.3 KiB
YAML

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
frontend:
extra_module_url:
- /local/community/lovelace-card-mod/card-mod.js
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
recorder:
purge_keep_days: 30
commit_interval: 3
db_url: "postgresql://home-assistant:M1ykv2TSzPD4c7lq4ixyBIl/q9kf4NyVIziQ3Yzansst4kZx@home-assistant_postgresql:5432/home-assistant?client_encoding=utf8"
http:
use_x_forwarded_for: true
trusted_proxies:
- 10.255.224.0/20
homeassistant:
elevation: 1339
latitude: -25.712942
longitude: 28.127656
customize_domain:
automation:
templates: &state_color # <-- define a yaml anchor here
icon_color: >
if (state === 'on') return 'green';
return 'steelblue';
# or use a theme variable:
# templates: &state_color
# icon_color: >
# if (state === 'on') return 'var(--primary-color)';
# return 'green'; #'steelblue';
sensor:
templates:
<<: *state_color # <-- and use it on any other entity in this file
binary_sensor:
templates:
icon_color: >
if (state === 'on') return 'firebrick';
return 'steelblue';
# <<: *state_color # <-- and use it on any other entity in this file
input_boolean:
templates: *state_color # <-- or even shorter like this
switch:
templates:
icon: >
if (state === 'on') return 'mdi:toggle-switch';
return 'mdi:toggle-switch-off';
<<: *state_color
template:
- binary_sensor:
- name: Sun
state: >
{{ is_state("sun.sun", "above_horizon") }}
icon: >
{% if is_state("binary_sensor.sun_up", "on") %}
mdi:weather-sunset-up
{% else %}
mdi:weather-sunset-down
{% endif %}
- unique_id: alarm_triggered_gui
name: Alarm triggered
state: >
{{ 'on' if states('sensor.sthome_ut1_alarm_signal')|float > 1.5 else 'off' }}
icon: &icon_alarm_light >
{%- if this.state == 'on' -%}
mdi:alarm-light
{%- elif this.state == 'off' -%}
mdi:alarm-light-outline
{%- else -%}
mdi:alarm-light-off-outline
{%- endif -%}
- unique_id: zone_4_triggered_gui
name: Zone 4 triggered
state: "{{ states('switch.sthome_ut1_alarm_zone_4') }}"
icon: *icon_alarm_light
# physical lock sensor
# detects if toggle switch on gate-intecom is on or off
- unique_id: gate_lock_gui
name: Gate Lock
state: "{{ states('switch.sthome_ut4_relay_5') }}" # this must be changed to a sensor within ESPHome for sthome_ut4 in the future
icon: &icon_lock >
{% if this.state == 'on' %}
mdi:lock
{% elif this.state == 'off' %}
mdi:lock-open
{% else %}
mdi:lock-off
{% endif %}
# remote gate lock
# this will remote lock/unlock the gate
# the unlock will only be effective if the toggle switch has enabled it (gate is physically unlocked), i.e the relay's normally closed contacts are wired in series with the toggle switch
- unique_id: gate_remote_lock_gui
name: Gate Remote Lock
state: "{{ states('switch.sthome_ut4_relay_5') }}"
icon: *icon_lock
- unique_id: backyard_motion_gui
name: Backyard Motion Detect
state: "{{ states('input_boolean.backyard_motion_detected') }}"
icon: &icon_motion_sensor >
{% if this.state == 'on' %}
mdi:motion-sensor
{% elif this.state == 'off'%}
mdi:motion-sensor-off
{% else %}
mdi:motion-sensor-off
{% endif %}
- unique_id: westwall_motion_gui
name: Westwall Motion Detect
state: "{{ states('input_boolean.westwall_motion_detected') }}"
icon: *icon_motion_sensor
- unique_id: eastwall_motion_gui
name: Eastwall Motion Detect
state: "{{ 'on' if is_state('input_boolean.eastwall_motion_detected', 'on') else 'off' }}"
icon: *icon_motion_sensor
- unique_id: patio_motion_gui
name: Patio Motion Detect
state: "{{ 'on' if is_state('input_boolean.patio_motion_detected', 'on') else 'off' }}"
icon: *icon_motion_sensor
- unique_id: driveway_motion_gui
name: Driveway Motion Detect
state: "{{ 'on' if is_state('input_boolean.driveway_motion_detected', 'on') else 'off' }}"
icon: *icon_motion_sensor
- unique_id: motion_detected_gui
name: Motion Detected
state: >
{{ 'on' if is_state('input_boolean.backyard_motion_detected', 'on') or is_state('input_boolean.westwall_motion_detected', 'on') or is_state('input_boolean.eastwall_motion_detected', 'on') or is_state('input_boolean.patio_motion_detected', 'on') or is_state('input_boolean.driveway_motion_detected', 'on') else 'off' }}
icon: *icon_motion_sensor
- unique_id: motion_detect_enabled
name: Motion Detect Enabled
state: "{{ states('input_boolean.person_detect') }}"
icon: *icon_motion_sensor
#notify:
# - platform: androidtv
# name: Android TV
# host: 10.0.0.71
# - sensor: