diff --git a/home-assistant/configuration.yml b/home-assistant/configuration.yml index 0456d9a..eb0a3ca 100644 --- a/home-assistant/configuration.yml +++ b/home-assistant/configuration.yml @@ -90,17 +90,27 @@ template: 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') }}" - icon: > - {%- if this.state == 'on' -%} - mdi:lock-open - {%- elif this.state == 'off' -%} + 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 - {%- else -%} + {% elif this.state == 'off' %} + mdi:lock-open + {% else %} mdi:lock-off - {%- endif -%} + {% 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 diff --git a/home-assistant/lovelace.dashboard_sthome.yml b/home-assistant/lovelace.dashboard_sthome.yml index 7add872..8c390f2 100644 --- a/home-assistant/lovelace.dashboard_sthome.yml +++ b/home-assistant/lovelace.dashboard_sthome.yml @@ -302,7 +302,7 @@ { "type": "custom:mushroom-entity-card", "entity": "counter.nokia_c20_notification_counter", - "name": "Nokia C20", + "name": "C20", "secondary_info": "state", "grid_options": { "columns": 4, @@ -319,6 +319,16 @@ "rows": 1 } }, + { + "type": "custom:mushroom-entity-card", + "name": "A04", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + }, + "entity": "counter.sm_a042f_notification_counter" + }, { "type": "custom:mushroom-entity-card", "entity": "counter.sm_x115_notification_counter", @@ -329,6 +339,16 @@ "rows": 1 } }, + { + "type": "custom:mushroom-entity-card", + "name": "A24", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + }, + "entity": "counter.sm_a245f_notification_counter" + }, { "type": "custom:mushroom-entity-card", "entity": "counter.driveway_person_alarm_counter", @@ -907,12 +927,27 @@ } }, { - "type": "custom:mushroom-lock-card", - "name": "Open/Close gate", - "entity": "switch.sthome_ut4_relay_6", + "type": "custom:mushroom-template-card", + "icon": "{{ state_attr(entity, 'icon') }}\n", + "icon_color": "{% if is_state(entity, 'on') %}\n green\n{% elif is_state(entity, 'off') %}\n orange\n{% else %}\n #4682B4\n{% endif %}", + "primary": "Remote Lock", "tap_action": { "action": "toggle" - } + }, + "entity": "switch.sthome_ut4_relay_5", + "secondary": "{{ states[entity].state }}", + "badge_icon": "" + }, + { + "type": "custom:mushroom-template-card", + "icon": "{{ state_attr(entity, 'icon') }}\n", + "icon_color": "{% if is_state(entity, 'on') %}\n red\n{% elif is_state(entity, 'off') %}\n green\n{% else %}\n #4682B4\n{% endif %}", + "primary": "Open/Close", + "tap_action": { + "action": "toggle" + }, + "entity": "switch.sthome_ut4_relay_6", + "secondary": "{{ states[entity].state }}" } ] } @@ -927,16 +962,28 @@ "badges": [ { "type": "custom:mushroom-template-badge", - "content": "{{ 'Locked' if states(entity) == 'on' else 'Unlocked' }}", - "icon": "{% set state = states(entity) %}\n{% if state == 'on' %}\n mdi:gate\n{% elif state == 'off' %}\n mdi:gate-alert\n{% else %}\n mdi:gate-alert\n{% endif %}", - "color": "{% set state = states(entity) %}\n{% if state == 'on' %}\n red\n{% elif state == 'off' %}\n green\n{% else %}\n orange\n{% endif %}", - "label": "Gate", + "content": "{{ states(entity) }}", + "icon": "{{ state_attr(entity, 'icon') }}", + "color": "{% set state = states(entity) %}\n{% if state == 'on' %}\n green\n{% elif state == 'off' %}\n orange\n{% else %}\n red\n{% endif %}", + "label": "Gate lock", "tap_action": { "action": "more-info" }, "entity": "binary_sensor.gate_lock" + }, + { + "type": "custom:mushroom-template-badge", + "content": "{{ states(entity) }}", + "color": "{% set state = states(entity) %}\n{% if state == 'on' %}\n green\n{% elif state == 'off' %}\n orange\n{% else %}\n red\n{% endif %}", + "label": "{{ states[entity].name }}", + "tap_action": { + "action": "more-info" + }, + "entity": "binary_sensor.gate_remote_lock", + "icon": "{{ state_attr(entity, 'icon') }}" } - ] + ], + "cards": [] } ] }