diff --git a/esphome/data/config/sthome-ut1.yaml b/esphome/data/config/sthome-ut1.yaml index d39bddf..032b91b 100644 --- a/esphome/data/config/sthome-ut1.yaml +++ b/esphome/data/config/sthome-ut1.yaml @@ -88,7 +88,7 @@ switch: icon: "mdi:light-flood-down" restore_mode: RESTORE_DEFAULT_OFF on_turn_on: - - delay: 300s + - delay: 600s - switch.turn_off: relay1 - platform: gpio @@ -134,7 +134,7 @@ switch: - binary_sensor.is_on: floodlight_test then: - switch.turn_on: relay1 - - delay: 10s + - delay: 30s - switch.turn_off: relay4 #define ANALOG_A1 33 @@ -148,7 +148,7 @@ sensor: pin: 35 name: "Alarm Signal" id: alarm_signal - update_interval: 1s + update_interval: 500ms attenuation: 12db sampling_mode: avg filters: diff --git a/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml b/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml index 2c3e43f..5f53d5a 100644 --- a/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml +++ b/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml @@ -32,6 +32,10 @@ conditions: condition: template value_template: "{{ [\"backyard_z1\"] | select(\"in\", after_zones) | list | length > 0 }}" enabled: true + - alias: Person detected + condition: template + value_template: "{{ label == 'person' }}" + enabled: true actions: - choose: - conditions: diff --git a/home-assistant/FRIGATE- Person Detect Logic - Driveway Camera.yml b/home-assistant/FRIGATE- Person Detect Logic - Driveway Camera.yml index ffdd88a..286ce36 100644 --- a/home-assistant/FRIGATE- Person Detect Logic - Driveway Camera.yml +++ b/home-assistant/FRIGATE- Person Detect Logic - Driveway Camera.yml @@ -34,6 +34,15 @@ conditions: {{ ["driveway_z1", "Driveway_Paving"] | select("in", after_zones) | list | length > 0 }} enabled: true + - condition: or + conditions: + - condition: template + value_template: "{{ label == 'person' }}" + alias: Person detected + - condition: template + value_template: "{{ label == 'license_plate' }}" + alias: License plate detected + enabled: true actions: - choose: - conditions: diff --git a/home-assistant/FRIGATE- Person Detect Logic - Eastwall Camera.yml b/home-assistant/FRIGATE- Person Detect Logic - Eastwall Camera.yml index d17f810..be7c298 100644 --- a/home-assistant/FRIGATE- Person Detect Logic - Eastwall Camera.yml +++ b/home-assistant/FRIGATE- Person Detect Logic - Eastwall Camera.yml @@ -32,6 +32,10 @@ conditions: condition: template value_template: "{{ [\"eastwall_z1\"] | select(\"in\", after_zones) | list | length > 0 }}" enabled: true + - alias: Person detected + condition: template + value_template: "{{ label == 'person' }}" + enabled: true actions: - choose: - conditions: diff --git a/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml b/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml index 096b0cb..f86c831 100644 --- a/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml +++ b/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml @@ -36,6 +36,10 @@ conditions: {{ ["patio_z1", "Patio_Gate"] | select("in", after_zones) | list | length > 0 }} enabled: true + - alias: Person detected + condition: template + value_template: "{{ label == 'person' }}" + enabled: true actions: - choose: - conditions: diff --git a/home-assistant/FRIGATE- Person Detect Logic - Westwall Camera.yml b/home-assistant/FRIGATE- Person Detect Logic - Westwall Camera.yml index 7288e2d..a4c2816 100644 --- a/home-assistant/FRIGATE- Person Detect Logic - Westwall Camera.yml +++ b/home-assistant/FRIGATE- Person Detect Logic - Westwall Camera.yml @@ -32,6 +32,10 @@ conditions: condition: template value_template: "{{ [\"westwall_z1\"] | select(\"in\", after_zones) | list | length > 0 }}" enabled: true + - alias: Person detected + condition: template + value_template: "{{ label == 'person' }}" + enabled: true actions: - choose: - conditions: diff --git a/home-assistant/Mushroom badge-chop cards.yml b/home-assistant/Mushroom badge-chop cards.yml new file mode 100644 index 0000000..99313f2 --- /dev/null +++ b/home-assistant/Mushroom badge-chop cards.yml @@ -0,0 +1,65 @@ +# Template badge (can't get animation to work) +# ============== +type: custom:mushroom-template-badge +entity: binary_sensor.motion_detected +content: > + {{ states['binary_sensor.motion_detected'].state | title }} · {{ + states['binary_sensor.motion_detected'].last_changed | relative_time }} +icon: "{{ state_attr(\"binary_sensor.motion_detected\", \"icon\") }}" +color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states[entity].last_changed))|int %} {{ "#ff0000" if lc < 10 }} + {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ "#d2042d" if lc >= 20 and lc < 45 + }} {{ "#fA8072" if lc >= 45 and lc < 90 }} {{ "#ff8c00" if lc >= 90 and lc < + 180 }} {{ "#ffa500" if lc >= 180 and lc < 400 }} {{ "#fff700" if lc >= 400 and + lc < 830 }} {{ "#ffff00" if lc >= 830 and lc < 1725 }} {{ "#008000" if lc >= + 1725 and lc < 3600 }} {{ "#4682B4" if lc >= 3600 and lc < 21600 }} +label: "{{ states[entity].name }}" + + +# Chip cards (can't add label) +# ========== +type: custom:mushroom-chips-card +alignment: justify +chips: + - type: template + entity: binary_sensor.alarm_triggered + icon: "{{ state_attr(\"binary_sensor.alarm_triggered\", \"icon\") }}" + icon_color: | + {% if is_state('binary_sensor.alarm_triggered', 'on') %} + red + {% else %} + #4682B4 + {% endif %} + content: Alarm + tap_action: + action: navigate + navigation_path: /dashboard-sthome/alarm + - type: template + entity: binary_sensor.motion_detected + icon: "{{ state_attr(\"binary_sensor.motion_detected\", \"icon\") }}" + icon_color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states.binary_sensor.motion_detected.last_changed))|int %} {{ + "#ff0000" if lc < 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ + "#d2042d" if lc >= 20 and lc < 45 }} {{ "#fA8072" if lc >= 45 and lc < 90 + }} {{ "#ff8c00" if lc >= 90 and lc < 180 }} {{ "#ffa500" if lc >= 180 and + lc < 400 }} {{ "#fff700" if lc >= 400 and lc < 830 }} {{ "#ffff00" if lc + >= 830 and lc < 1725 }} {{ "#008000" if lc >= 1725 and lc < 3600 }} {{ + "#4682B4" if lc >= 3600 and lc < 21600 }} + content: >- + {% set motion = is_state('binary_sensor.motion_detected', 'on') %} + {% set elapsed_time = states['binary_sensor.motion_detected'].last_changed | relative_time %} + {{ 'Started' if motion else 'Stopped' }} · {{ elapsed_time }} ago + tap_action: + action: navigate + navigation_path: /dashboard-sthome/alarm +card_mod: + style: + mushroom-template-chip:nth-child(2)$: | + ha-state-icon { + {{ 'animation: clip 2s linear infinite;' if is_state('binary_sensor.motion_detected', 'on') }} + } + @keyframes clip { + 50% { clip-path: polygon(0 0, 61% 0, 66% 100%, 0% 100%); } + } \ No newline at end of file diff --git a/home-assistant/Person detect Actions.yml b/home-assistant/Person detect Actions.yml index 6b293c0..44fffbd 100644 --- a/home-assistant/Person detect Actions.yml +++ b/home-assistant/Person detect Actions.yml @@ -8,8 +8,8 @@ variables: sequence: - if: - condition: template - value_template: "{{ states('input_boolean.enable_person_detect_alarm') == 'on' }}" - alias: Person detect alarm is enabled + value_template: "{{ states('input_boolean.motion_detect') == 'on' }}" + alias: Motion detect alarm is enabled then: - if: - condition: template @@ -66,9 +66,6 @@ sequence: data: {} - action: script.send_dynamic_notification_to_devices data: - send_to_sm_n986b: "{{ states('input_boolean.notify_sm_n986b') == 'on' }}" - send_to_nokia_c20: "{{ states('input_boolean.notify_nokia_c20') == 'on' }}" - send_to_sm_x115: "{{ states('input_boolean.notify_sm_x115') == 'on' }}" send_to_nova_4k: "{{ send_to_nova_4k }}" id: "{{ id }}" title: "{{ title }}" diff --git a/home-assistant/configuration.yml b/home-assistant/configuration.yml index c9bf69a..0456d9a 100644 --- a/home-assistant/configuration.yml +++ b/home-assistant/configuration.yml @@ -2,7 +2,7 @@ default_config: frontend: extra_module_url: - - /local/card-mod.js + - /local/community/lovelace-card-mod/card-mod.js # Text to speech tts: - platform: google_translate @@ -20,6 +20,10 @@ http: - 10.255.224.0/20 homeassistant: + elevation: 1339 + latitude: -25.712942 + longitude: 28.127656 + customize_domain: automation: @@ -67,11 +71,12 @@ template: {% 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: &icon_alarm_light > {%- if this.state == 'on' -%} mdi:alarm-light {%- elif this.state == 'off' -%} @@ -79,17 +84,12 @@ template: {%- 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: > - {%- if this.state == 'on' -%} - mdi:alarm-light - {%- elif this.state == 'off' -%} - mdi:alarm-light-off - {%- else -%} - mdi:alarm-light-off-outline - {%- endif -%} + icon: *icon_alarm_light + - unique_id: gate_lock_gui name: Gate Lock state: "{{ states('switch.sthome_ut4_relay_5') }}" @@ -101,11 +101,11 @@ template: {%- else -%} mdi:lock-off {%- endif -%} - - 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: > + + - 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'%} @@ -113,17 +113,37 @@ template: {% 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: > - {% if this.state == 'on' %} - mdi:motion-sensor - {% elif this.state == 'off' %} - mdi:motion-sensor-off - {% else %} - mdi:motion-sensor-off - {% endif %} + icon: *icon_motion_sensor #notify: # - platform: androidtv # name: Android TV diff --git a/home-assistant/counter.json b/home-assistant/counter.json new file mode 100644 index 0000000..048b023 --- /dev/null +++ b/home-assistant/counter.json @@ -0,0 +1,89 @@ +{ + "version": 1, + "minor_version": 1, + "key": "counter", + "data": { + "items": [ + { + "id": "driveway_person_alarm_counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + }, + { + "id": "east_wall_person_alarm_counter", + "name": "East wall Person Alarm Counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + }, + { + "id": "backyard_person_alarm_counter", + "name": "Backyard Person Alarm Counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + }, + { + "id": "west_wall_person_alarm_counter", + "name": "West wall Person Alarm Counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + }, + { + "id": "patio_person_alarm_counter", + "name": "Patio Person Alarm Counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + }, + { + "id": "car_counter", + "name": "Car Counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + }, + { + "id": "sm_n986b_notification_counter", + "name": "SM_N986B: Notification Counter", + "minimum": 0, + "restore": true, + "maximum": null, + "initial": 0, + "step": 1 + }, + { + "id": "sm_x115_notification_counter", + "name": "SM_X115 Notification Counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + }, + { + "id": "nokia_c20_notification_counter", + "name": "Nokia C20 Notification Counter", + "initial": 0, + "minimum": null, + "restore": true, + "maximum": null, + "step": 1 + } + ] + } + } \ No newline at end of file diff --git a/home-assistant/input_boolean.json b/home-assistant/input_boolean.json index cdbc8f2..e8de827 100644 --- a/home-assistant/input_boolean.json +++ b/home-assistant/input_boolean.json @@ -6,8 +6,8 @@ "items": [ { "id": "enable_person_detect_alarm", - "name": "Person Detect", - "icon": "mdi:run" + "name": "Motion Detect", + "icon": "mdi:motion-sensor" }, { "id": "notify_sm_n986b", @@ -48,6 +48,11 @@ "id": "patio_motion_detected", "name": "Patio Motion Detected", "icon": "mdi:motion-sensor" + }, + { + "id": "notify_sm_a032f", + "name": "Notify SM-A032F", + "icon": "mdi:cellphone-text" } ] } diff --git a/home-assistant/lovelace.dashboard_sthome.yml b/home-assistant/lovelace.dashboard_sthome.yml new file mode 100644 index 0000000..924ef9e --- /dev/null +++ b/home-assistant/lovelace.dashboard_sthome.yml @@ -0,0 +1,817 @@ +{ + "version": 1, + "minor_version": 1, + "key": "lovelace.dashboard_sthome", + "data": { + "config": { + "title": "Home", + "button_card_templates": { + "sensor": { + "aspect_ratio": "1.2/1", + "show_state": true, + "show_icon": true + }, + "sensor_battery": { + "template": "sensor", + "icon": "[[[\n if (entity.state < 5) return 'mdi:battery-alert-variant-outline';\n if (entity.state >= 5 && entity.state <15) return 'mdi:battery-10';\n if (entity.state >= 15 && entity.state < 25) return 'mdi:battery-20';\n if (entity.state >= 25 && entity.state < 35) return 'mdi:battery-30';\n if (entity.state >= 35 && entity.state < 45) return 'mdi:battery-40';\n if (entity.state >= 45 && entity.state < 55) return 'mdi:battery-50';\n if (entity.state >= 55 && entity.state < 65) return 'mdi:battery-60';\n if (entity.state >= 65 && entity.state < 75) return 'mdi:battery-70';\n if (entity.state >= 75 && entity.state < 85) return 'mdi:battery-80';\n if (entity.state >= 85 && entity.state < 95) return 'mdi:battery-90';\n if (entity.state >= 95) return 'mdi:battery';\n else return 'mdi:battery-alert-variant-outline';\n]]]\n", + "style": [ + { + "padding": "0px" + } + ], + "styles": { + "icon": [ + { + "color": "[[[\n if (entity.state < 15) return 'red';\n if (entity.state >= 15 && entity.state <25) return 'firebrick';\n if (entity.state >= 25 && entity.state < 55) return 'orange';\n if (entity.state >= 55) return 'green';\n else return 'red';\n]]]\n" + } + ] + } + } + }, + "views": [ + { + "title": "Home", + "cards": [], + "type": "sections", + "icon": "mdi:home", + "badges": [ + { + "type": "custom:mushroom-chips-card", + "alignment": "justify", + "chips": [ + { + "type": "template", + "entity": "binary_sensor.alarm_triggered", + "icon": "{{ state_attr(\"binary_sensor.alarm_triggered\", \"icon\") }}", + "icon_color": "{% if is_state('binary_sensor.alarm_triggered', 'on') %}\n red\n{% else %}\n #4682B4\n{% endif %}\n", + "content": "Alarm", + "tap_action": { + "action": "navigate", + "navigation_path": "/dashboard-sthome/alarm" + } + }, + { + "type": "template", + "entity": "binary_sensor.motion_detected", + "icon": "{{ state_attr(\"binary_sensor.motion_detected\", \"icon\") }}", + "icon_color": "{% set lc = (as_timestamp(now()) - as_timestamp(states.binary_sensor.motion_detected.last_changed))|int %} {{ \"#ff0000\" if lc < 10 }} {{ \"#4d061c\" if lc >= 10 and lc < 20 }} {{ \"#d2042d\" if lc >= 20 and lc < 45 }} {{ \"#fA8072\" if lc >= 45 and lc < 90 }} {{ \"#ff8c00\" if lc >= 90 and lc < 180 }} {{ \"#ffa500\" if lc >= 180 and lc < 400 }} {{ \"#fff700\" if lc >= 400 and lc < 830 }} {{ \"#ffff00\" if lc >= 830 and lc < 1725 }} {{ \"#008000\" if lc >= 1725 and lc < 3600 }} {{ \"#4682B4\" if lc >= 3600 and lc < 21600 }}", + "content": "{% set motion = is_state('binary_sensor.motion_detected', 'on') %} {% set elapsed_time = states['binary_sensor.motion_detected'].last_changed | relative_time %} {{ 'Started' if motion else 'Stopped' }} · {{ elapsed_time }} ago", + "tap_action": { + "action": "navigate", + "navigation_path": "/dashboard-sthome/alarm" + } + } + ], + "card_mod": { + "style": { + "mushroom-template-chip:nth-child(2)$": "ha-state-icon {\n {{ 'animation: clip 2s linear infinite;' if is_state('binary_sensor.motion_detected', 'on') }}\n}\n@keyframes clip {\n 50% { clip-path: polygon(0 0, 61% 0, 66% 100%, 0% 100%); }\n}\n" + } + } + } + ], + "sections": [ + { + "type": "grid", + "cards": [ + { + "type": "custom:mushroom-chips-card", + "chips": [ + { + "type": "entity", + "entity": "sun.sun" + }, + { + "type": "template", + "content": "Sunrise {% if states.sun.sun %} {{ (as_timestamp(states.sun.sun.attributes.next_rising)) | timestamp_custom(('%H:%M') )}} {% endif %}", + "icon": "mdi:weather-sunset-up" + }, + { + "type": "template", + "content": "Sunset {% if states.sun.sun %} {{ (as_timestamp(states.sun.sun.attributes.next_setting)) | timestamp_custom(('%H:%M') )}} {% endif %}", + "icon": "mdi:weather-sunset-down" + }, + { + "type": "entity", + "entity": "sensor.moon_phase" + } + ] + }, + { + "show_current": true, + "show_forecast": true, + "type": "weather-forecast", + "entity": "weather.forecast_home", + "secondary_info_attribute": "humidity", + "forecast_type": "daily" + }, + { + "type": "custom:mushroom-person-card", + "entity": "person.chris", + "name": "Chris" + }, + { + "type": "custom:mushroom-person-card", + "entity": "device_tracker.nokia_c20" + } + ] + }, + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Media players", + "heading_style": "title", + "icon": "mdi:television" + }, + { + "type": "custom:mushroom-media-player-card", + "entity": "media_player.smart_tv", + "name": "Hisense", + "icon": "mdi:television", + "collapsible_controls": true, + "use_media_info": true, + "volume_controls": [ + "volume_mute", + "volume_set", + "volume_buttons" + ], + "media_controls": [ + "on_off", + "shuffle", + "previous", + "play_pause_stop", + "next", + "repeat" + ], + "show_volume_level": true + }, + { + "type": "custom:mushroom-media-player-card", + "entity": "media_player.xiaomi_tv_box_2", + "name": "Xiaomi", + "icon": "mdi:television-box", + "collapsible_controls": true, + "use_media_info": true, + "volume_controls": [ + "volume_mute", + "volume_set", + "volume_buttons" + ], + "media_controls": [ + "on_off", + "shuffle", + "previous", + "play_pause_stop", + "next", + "repeat" + ], + "show_volume_level": true + }, + { + "type": "custom:mushroom-media-player-card", + "entity": "media_player.nova4k", + "name": "Nova4k", + "icon": "mdi:television-box", + "collapsible_controls": true, + "use_media_info": true, + "volume_controls": [ + "volume_mute", + "volume_set", + "volume_buttons" + ], + "media_controls": [ + "on_off", + "shuffle", + "previous", + "play_pause_stop", + "next", + "repeat" + ], + "show_volume_level": true + } + ] + }, + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Phones", + "heading_style": "title" + }, + { + "type": "custom:mushroom-template-card", + "primary": "S20 ultra", + "secondary": "{{ states['sensor.sm_n986b_battery_level'].state }}%", + "entity": "sensor.sm_n986b_battery_level", + "icon_color": "{% set state=states['sensor.sm_n986b_battery_level'].state %}\n{% if state|int < 15 %}\n red\n{% elif (state|int > 15 and state|int < 25) %}\n #b22222\n{% elif (state|int > 25 and state|int < 55) %}\n orange\n{% else %}\n green\n{% endif %}", + "icon": "{{ state_attr(\"sensor.sm_n986b_battery_level\", \"icon\") }}" + }, + { + "type": "custom:mushroom-template-card", + "primary": "Nokia C20", + "secondary": "{{ states['sensor.nokia_c20_battery_level'].state }}%", + "entity": "sensor.nokia_c20_battery_level", + "icon_color": "{% set state=states['sensor.nokia_c20_battery_level'].state %}\n{% if state|int < 15 %}\n red\n{% elif (state|int > 15 and state|int < 25) %}\n #b22222\n{% elif (state|int > 25 and state|int < 55) %}\n orange\n{% else %}\n green\n{% endif %}", + "icon": "{{ state_attr(\"sensor.nokia_c20_battery_level\", \"icon\") }}" + }, + { + "type": "custom:mushroom-template-card", + "primary": "A9 tablet", + "secondary": "{{ states['sensor.sm_x115_battery_level'].state }}%", + "entity": "sensor.sm_x115_battery_level", + "icon_color": "{% set state=states['sensor.sm_x115_battery_level'].state %}\n{% if state|int < 15 %}\n red\n{% elif (state|int > 15 and state|int < 25) %}\n #b22222\n{% elif (state|int > 25 and state|int < 55) %}\n orange\n{% else %}\n green\n{% endif %}", + "icon": "{{ state_attr(\"sensor.sm_x115_battery_level\", \"icon\") }}" + } + ] + }, + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Counters" + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.sm_n986b_notification_counter", + "name": "S20", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.nokia_c20_notification_counter", + "name": "Nokia C20", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.sm_a032f_notification_counter", + "name": "A03 Core", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.sm_x115_notification_counter", + "name": "A9 tablet", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.driveway_person_alarm_counter", + "name": "Driveway", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.east_wall_person_alarm_counter", + "name": "Eastwall", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.backyard_person_alarm_counter", + "name": "Backyard", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.patio_person_alarm_counter", + "name": "Patio", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "counter.west_wall_person_alarm_counter", + "name": "Westwall", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + } + ] + }, + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Work in progress", + "heading_style": "title", + "icon": "mdi:spade" + }, + { + "type": "custom:mushroom-entity-card", + "entity": "switch.sthome_ut1_relay_2", + "name": "Relay 2", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "switch.sthome_ut1_relay_3", + "name": "Relay 3", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "binary_sensor.gate_lock", + "name": "Gate lock", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + }, + { + "type": "custom:mushroom-entity-card", + "entity": "switch.sthome_ut4_relay_6", + "name": "Open/Close gate", + "secondary_info": "state", + "grid_options": { + "columns": 4, + "rows": 1 + } + } + ] + } + ], + "header": { + "card": { + "type": "markdown", + "text_only": true, + "content": "# Hello {{ user }}\nsthome dashboard ✨" + } + }, + "max_columns": 2, + "dense_section_placement": true + }, + { + "title": "Security Cameras", + "cards": [], + "icon": "mdi:cctv", + "type": "sections", + "sections": [ + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Cameras", + "heading_style": "title", + "icon": "mdi:cctv" + }, + { + "show_state": true, + "show_name": false, + "camera_view": "auto", + "type": "picture-entity", + "entity": "camera.driveway", + "grid_options": { + "columns": 12, + "rows": "auto" + } + }, + { + "show_state": true, + "show_name": false, + "camera_view": "auto", + "type": "picture-entity", + "entity": "camera.patio", + "grid_options": { + "columns": 6, + "rows": "auto" + } + }, + { + "show_state": true, + "show_name": false, + "camera_view": "auto", + "type": "picture-entity", + "entity": "camera.eastwall", + "grid_options": { + "columns": 6, + "rows": "auto" + }, + "aspect_ratio": "1/1" + }, + { + "show_state": true, + "show_name": false, + "camera_view": "auto", + "type": "picture-entity", + "entity": "camera.westwall", + "grid_options": { + "columns": 6, + "rows": "auto" + } + }, + { + "show_state": true, + "show_name": false, + "camera_view": "auto", + "type": "picture-entity", + "entity": "camera.backyard", + "grid_options": { + "columns": 6, + "rows": "auto" + } + } + ], + "column_span": 1 + }, + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Detections", + "heading_style": "title" + }, + { + "type": "picture", + "image_entity": "image.driveway_person", + "grid_options": { + "columns": 6, + "rows": "auto" + } + }, + { + "type": "picture", + "image_entity": "image.driveway_car", + "grid_options": { + "columns": 6, + "rows": "auto" + } + }, + { + "type": "picture", + "image_entity": "image.eastwall_person", + "grid_options": { + "columns": 6, + "rows": "auto" + } + }, + { + "type": "picture", + "image_entity": "image.patio_person", + "grid_options": { + "columns": 6, + "rows": "auto" + } + }, + { + "type": "picture", + "image_entity": "image.westwall_person", + "grid_options": { + "columns": 6, + "rows": "auto" + } + }, + { + "type": "picture", + "image_entity": "image.backyard_person", + "grid_options": { + "columns": 6, + "rows": "auto" + } + } + ] + } + ], + "header": { + "card": { + "type": "markdown", + "text_only": true, + "content": "Security Cameras" + } + }, + "max_columns": 4, + "dense_section_placement": true, + "badges": [ + { + "type": "entity", + "entity": "counter.driveway_person_alarm_counter" + }, + { + "type": "entity", + "entity": "counter.east_wall_person_alarm_counter" + }, + { + "type": "entity", + "entity": "counter.patio_person_alarm_counter" + }, + { + "type": "entity", + "entity": "counter.west_wall_person_alarm_counter" + }, + { + "type": "entity", + "entity": "counter.backyard_person_alarm_counter" + } + ] + }, + { + "type": "sections", + "max_columns": 10, + "subview": false, + "path": "alarm", + "title": "Alarm", + "icon": "mdi:alarm-light", + "sections": [ + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Settings", + "heading_style": "title" + }, + { + "type": "custom:mushroom-template-card", + "icon": "{% set state = states[\"input_boolean.motion_detect\"].state %}\n{% if state == 'on' %}\n mdi:motion-sensor\n{% elif state == 'off'%}\n mdi:motion-sensor-off\n{% else %}\n mdi:motion-sensor-off\n{% endif %}", + "primary": "{{ states[\"input_boolean.motion_detect\"].name }}", + "secondary": "{{ states[\"input_boolean.motion_detect\"].state }}", + "icon_color": "{% if is_state('input_boolean.motion_detect', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}", + "badge_icon": "", + "badge_color": "", + "entity": "input_boolean.motion_detect", + "tap_action": { + "action": "toggle" + } + }, + { + "type": "custom:mushroom-template-card", + "entity": "input_boolean.notify_sm_n986b", + "secondary": "{{ states[\"input_boolean.notify_sm_n986b\"].state }}", + "icon": "{% if is_state('input_boolean.notify_sm_n986b', 'on') %}\n {{ state_attr(\"input_boolean.notify_sm_n986b\", \"icon\") }}\n{% else %}\n mdi:cellphone-off\n{% endif %}", + "primary": "{{ states['input_boolean.notify_sm_n986b'].name }}", + "icon_color": "{% if is_state('input_boolean.notify_sm_n986b', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}" + }, + { + "type": "custom:mushroom-template-card", + "entity": "input_boolean.notify_nokia_c20", + "secondary": "{{ states['input_boolean.notify_nokia_c20'].state }}", + "icon": "{% if is_state('input_boolean.notify_nokia_c20', 'on') %}\n {{ state_attr(\"input_boolean.notify_nokia_c20\", \"icon\") }}\n{% else %}\n mdi:cellphone-off\n{% endif %}", + "primary": "{{ states['input_boolean.notify_nokia_c20'].name }}", + "icon_color": "{% if is_state('input_boolean.notify_nokia_c20', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}" + }, + { + "type": "custom:mushroom-template-card", + "entity": "input_boolean.notify_sm_x115", + "secondary": "{{ states['input_boolean.notify_sm_x115'].state }}", + "icon": "{% if is_state('input_boolean.notify_sm_x115', 'on') %}\n {{ state_attr(\"input_boolean.notify_sm_x115\", \"icon\") }}\n{% else %}\n mdi:cellphone-off\n{% endif %}", + "primary": "{{ states['input_boolean.notify_sm_x115'].name }}", + "icon_color": "{% if is_state('input_boolean.notify_sm_x115', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}" + }, + { + "type": "custom:mushroom-template-card", + "secondary": "{{ states['input_boolean.notify_sm_a032f'].state }}", + "icon": "{% if is_state('input_boolean.notify_sm_a032f', 'on') %}\n {{ state_attr(\"input_boolean.notify_sm_a032f\", \"icon\") }}\n{% else %}\n mdi:cellphone-off\n{% endif %}", + "primary": "{{ states['input_boolean.notify_sm_a032f'].name }}", + "icon_color": "{% if is_state('input_boolean.notify_sm_a032f', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}", + "tap_action": { + "action": "toggle" + }, + "entity": "input_boolean.notify_sm_a032f" + } + ], + "column_span": 1 + } + ], + "cards": [], + "badges": [ + { + "type": "entity", + "show_name": true, + "show_state": true, + "show_icon": true, + "entity": "binary_sensor.alarm_triggered", + "show_entity_picture": false, + "color": "red", + "name": "Siren", + "state_content": [ + "state", + "last_changed" + ], + "tap_action": { + "action": "more-info" + } + }, + { + "type": "entity", + "show_name": true, + "show_state": true, + "show_icon": true, + "entity": "binary_sensor.zone_4_triggered", + "color": "red", + "name": "Zone 4", + "state_content": [ + "state", + "last_changed" + ], + "tap_action": { + "action": "more-info" + } + }, + { + "type": "entity", + "show_name": true, + "show_state": true, + "show_icon": true, + "entity": "switch.sthome_ut1_floodlights_backyard", + "state_content": [ + "state", + "last_changed" + ], + "show_entity_picture": true, + "icon": "mdi:light-flood-down", + "name": "Backyard", + "double_tap_action": { + "action": "toggle" + }, + "tap_action": { + "action": "more-info" + } + }, + { + "type": "entity", + "show_name": true, + "show_state": true, + "show_icon": true, + "entity": "binary_sensor.sthome_ut1_floodlights_test_mode", + "icon": "mdi:light-flood-down", + "show_entity_picture": true, + "color": "orange", + "name": "Test mode" + }, + { + "type": "custom:mushroom-template-badge", + "entity": "binary_sensor.patio_motion_detect", + "content": "{{ states[entity].state | title }} · {{ states[entity].last_changed | relative_time }}", + "icon": "{% set state = states(entity) %}\n{% if state == 'on' %}\n mdi:motion-sensor\n{% elif state == 'off' %}\n mdi:motion-sensor-off\n{% else %}\n mdi:motion-sensor-off\n{% endif %}", + "color": "{% set lc = (as_timestamp(now()) - as_timestamp(states[entity].last_changed))|int %} {{ \"#ff0000\" if lc < 10 }} {{ \"#4d061c\" if lc >= 10 and lc < 20 }} {{ \"#d2042d\" if lc >= 20 and lc < 45 }} {{ \"#fA8072\" if lc >= 45 and lc < 90 }} {{ \"#ff8c00\" if lc >= 90 and lc < 180 }} {{ \"#ffa500\" if lc >= 180 and lc < 400 }} {{ \"#fff700\" if lc >= 400 and lc < 830 }} {{ \"#ffff00\" if lc >= 830 and lc < 1725 }} {{ \"#008000\" if lc >= 1725 and lc < 3600 }} {{ \"#4682B4\" if lc >= 3600 and lc < 21600 }}", + "label": "{{ states[entity].name }}", + "tap_action": { + "action": "more-info" + } + }, + { + "type": "custom:mushroom-template-badge", + "content": "{{ states[entity].state | title }} · {{ states[entity].last_changed | relative_time }}", + "color": "{% set lc = (as_timestamp(now()) - as_timestamp(states[entity].last_changed))|int %} {{ \"#ff0000\" if lc < 10 }} {{ \"#4d061c\" if lc >= 10 and lc < 20 }} {{ \"#d2042d\" if lc >= 20 and lc < 45 }} {{ \"#fA8072\" if lc >= 45 and lc < 90 }} {{ \"#ff8c00\" if lc >= 90 and lc < 180 }} {{ \"#ffa500\" if lc >= 180 and lc < 400 }} {{ \"#fff700\" if lc >= 400 and lc < 830 }} {{ \"#ffff00\" if lc >= 830 and lc < 1725 }} {{ \"#008000\" if lc >= 1725 and lc < 3600 }} {{ \"#4682B4\" if lc >= 3600 and lc < 21600 }}", + "label": "{{ states[entity].name }}", + "tap_action": { + "action": "more-info" + }, + "entity": "binary_sensor.driveway_motion_detect", + "icon": "{% set state = states(entity) %}\n{% if state == 'on' %}\n mdi:motion-sensor\n{% elif state == 'off' %}\n mdi:motion-sensor-off\n{% else %}\n mdi:motion-sensor-off\n{% endif %}" + }, + { + "type": "custom:mushroom-template-badge", + "content": "{{ states[entity].state | title }} · {{ states[entity].last_changed | relative_time }}", + "icon": "{% set state = states(entity) %}\n{% if state == 'on' %}\n mdi:motion-sensor\n{% elif state == 'off' %}\n mdi:motion-sensor-off\n{% else %}\n mdi:motion-sensor-off\n{% endif %}", + "color": "{% set lc = (as_timestamp(now()) - as_timestamp(states[entity].last_changed))|int %} {{ \"#ff0000\" if lc < 10 }} {{ \"#4d061c\" if lc >= 10 and lc < 20 }} {{ \"#d2042d\" if lc >= 20 and lc < 45 }} {{ \"#fA8072\" if lc >= 45 and lc < 90 }} {{ \"#ff8c00\" if lc >= 90 and lc < 180 }} {{ \"#ffa500\" if lc >= 180 and lc < 400 }} {{ \"#fff700\" if lc >= 400 and lc < 830 }} {{ \"#ffff00\" if lc >= 830 and lc < 1725 }} {{ \"#008000\" if lc >= 1725 and lc < 3600 }} {{ \"#4682B4\" if lc >= 3600 and lc < 21600 }}", + "label": "{{ states[entity].name }}", + "tap_action": { + "action": "more-info" + }, + "entity": "binary_sensor.eastwall_motion_detect" + }, + { + "type": "custom:mushroom-template-badge", + "content": "{{ states[entity].state | title }} · {{ states[entity].last_changed | relative_time }}", + "icon": "{% set state = states(entity) %}\n{% if state == 'on' %}\n mdi:motion-sensor\n{% elif state == 'off' %}\n mdi:motion-sensor-off\n{% else %}\n mdi:motion-sensor-off\n{% endif %}", + "color": "{% set lc = (as_timestamp(now()) - as_timestamp(states[entity].last_changed))|int %} {{ \"#ff0000\" if lc < 10 }} {{ \"#4d061c\" if lc >= 10 and lc < 20 }} {{ \"#d2042d\" if lc >= 20 and lc < 45 }} {{ \"#fA8072\" if lc >= 45 and lc < 90 }} {{ \"#ff8c00\" if lc >= 90 and lc < 180 }} {{ \"#ffa500\" if lc >= 180 and lc < 400 }} {{ \"#fff700\" if lc >= 400 and lc < 830 }} {{ \"#ffff00\" if lc >= 830 and lc < 1725 }} {{ \"#008000\" if lc >= 1725 and lc < 3600 }} {{ \"#4682B4\" if lc >= 3600 and lc < 21600 }}", + "label": "{{ states[entity].name }}", + "tap_action": { + "action": "more-info" + }, + "entity": "binary_sensor.westwall_motion_detect" + }, + { + "type": "custom:mushroom-template-badge", + "content": "{{ states[entity].state | title }} · {{ states[entity].last_changed | relative_time }}", + "icon": "{% set state = states(entity) %}\n{% if state == 'on' %}\n mdi:motion-sensor\n{% elif state == 'off' %}\n mdi:motion-sensor-off\n{% else %}\n mdi:motion-sensor-off\n{% endif %}", + "color": "{% set lc = (as_timestamp(now()) - as_timestamp(states[entity].last_changed))|int %} {{ \"#ff0000\" if lc < 10 }} {{ \"#4d061c\" if lc >= 10 and lc < 20 }} {{ \"#d2042d\" if lc >= 20 and lc < 45 }} {{ \"#fA8072\" if lc >= 45 and lc < 90 }} {{ \"#ff8c00\" if lc >= 90 and lc < 180 }} {{ \"#ffa500\" if lc >= 180 and lc < 400 }} {{ \"#fff700\" if lc >= 400 and lc < 830 }} {{ \"#ffff00\" if lc >= 830 and lc < 1725 }} {{ \"#008000\" if lc >= 1725 and lc < 3600 }} {{ \"#4682B4\" if lc >= 3600 and lc < 21600 }}", + "label": "{{ states[entity].name }}", + "tap_action": { + "action": "more-info" + }, + "entity": "binary_sensor.backyard_motion_detect" + } + ], + "header": { + "card": { + "type": "markdown", + "text_only": true, + "content": "# House Alarm\n" + } + } + }, + { + "type": "sections", + "max_columns": 4, + "title": "Gate", + "path": "gate", + "icon": "mdi:gate", + "sections": [ + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Driveway", + "heading_style": "title" + }, + { + "show_state": false, + "show_name": false, + "camera_view": "live", + "type": "picture-entity", + "entity": "camera.driveway", + "grid_options": { + "columns": 12, + "rows": "auto" + }, + "tap_action": { + "action": "more-info" + } + }, + { + "type": "custom:mushroom-lock-card", + "name": "Open/Close gate", + "entity": "switch.sthome_ut4_relay_6", + "tap_action": { + "action": "toggle" + } + } + ] + } + ], + "header": { + "card": { + "type": "markdown", + "text_only": true, + "content": "# Gate\nOpen/close driveway gate\n✨ WORK IN PROGRESS ✨\n⚠️WARNING: Make double sure that there are no obstructions before opening or closing the gate!⚠️ If the clock has stopped, it means that the screen is not updating. ⚠️ Refresh your browser and ensure you are getting a live stream before opening/closing gate!⚠️" + } + }, + "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", + "tap_action": { + "action": "more-info" + }, + "entity": "binary_sensor.gate_lock" + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/home-assistant/send_dynamic_notification_to_all_devices (no comments).yml b/home-assistant/send_dynamic_notification_to_all_devices (no comments).yml index 4fe854d..7c594cc 100644 --- a/home-assistant/send_dynamic_notification_to_all_devices (no comments).yml +++ b/home-assistant/send_dynamic_notification_to_all_devices (no comments).yml @@ -1,60 +1,185 @@ -alias: Send Dynamic Notification To Devices +alias: Send Dynamic Notification To All Devices sequence: - variables: - image_url: "{{ image }}" - video_url: "{{ video }}" + image_url: "{{ base_url~image }}" + video_url: "{{ base_url~video }}" + send_to_sm_n986b: "{{ states('input_boolean.notify_sm_n986b') == 'on' }}" + send_to_nokia_c20: "{{ states('input_boolean.notify_nokia_c20') == 'on' }}" + send_to_sm_x115: "{{ states('input_boolean.notify_sm_x115') == 'on' }}" + send_to_sm_a032f: "{{ states('input_boolean.notify_sm_a032f') == 'on' }}" - parallel: - if: - condition: template value_template: "{{ send_to_sm_n986b | default(True) }}" alias: Send to SM_N986B? then: - - data: - message: "{{ message }}" - title: "{{ title }}" - data: - sticky: "true" - color: "#2DF56D" - channel: "{{ channel }}" - vibrationPattern: 100, 1000, 100, 1000, 100 - priority: "{{ priority }}" - ledColor: red - importance: "{{ importance }}" - clickAction: "{{ image_url }}" - tag: "{{ notifTag }}" - group: "{{ group }}" - image: >- - {% if (importance == "default" and video != null) -%} {{ null - }} {%- else -%} {{ image_url }} {%- endif %} - video: >- - {% if (importance == "default" and video != null) -%} {{ - video_url }} {%- else -%} {{ null }} {%- endif %} - notification_icon: "{{ notifIcon }}" - when: "{{ when }}" - actions: - - action: URI - title: Open Image - uri: "{{ image_url }}" - - action: URI - title: Open Clip - uri: "{{ video_url }}" - action: notify.mobile_app_sm_n986b - alias: "Notify: Send message to SM_N986B" - - action: counter.increment - target: - entity_id: counter.sm_n986b_notification_counter - data: {} - alias: Increment SM_N986B notification counter - enabled: true + - parallel: + - data: + message: "{{ message }}" + title: "{{ title }}" + data: + sticky: "true" + color: "#2DF56D" + channel: "{{ channel }}" + vibrationPattern: 100, 1000, 100, 1000, 100 + priority: "{{ priority }}" + ledColor: red + importance: "{{ importance }}" + clickAction: "{{ image_url }}" + tag: "{{ notifTag }}" + group: "{{ group }}" + image: >- + {% if (importance == "default" and video != null) -%} {{ + null }} {%- else -%} {{ image_url }} {%- endif %} + video: >- + {% if (importance == "default" and video != null) -%} {{ + video_url }} {%- else -%} {{ null }} {%- endif %} + notification_icon: "{{ notifIcon }}" + when: "{{ when }}" + actions: + - action: URI + title: Open Image + uri: "{{ image_url }}" + - action: URI + title: Open Clip + uri: "{{ video_url }}" + action: notify.mobile_app_sm_n986b + alias: "Notify: Send message to SM_N986B" + - action: counter.increment + target: + entity_id: counter.sm_n986b_notification_counter + data: {} + alias: Increment SM_N986B notification counter + - if: + - condition: template + value_template: "{{ send_to_nokia_c20 | default(True) }}" + alias: Send to Nokia_C20? + then: + - parallel: + - data: + message: "{{ message }}" + title: "{{ title }}" + data: + sticky: "true" + color: "#2DF56D" + channel: "{{ channel }}" + vibrationPattern: 100, 1000, 100, 1000, 100 + priority: "{{ priority }}" + ledColor: red + importance: "{{ importance }}" + clickAction: "{{ image_url }}" + tag: "{{ notifTag }}" + group: "{{ group }}" + image: >- + {% if (importance == "default" and video != null) -%} {{ + null }} {%- else -%} {{ image_url }} {%- endif %} + video: >- + {% if (importance == "default" and video != null) -%} {{ + video_url }} {%- else -%} {{ null }} {%- endif %} + notification_icon: "{{ notifIcon }}" + when: "{{ when }}" + actions: + - action: URI + title: Open Image + uri: "{{ image_url }}" + - action: URI + title: Open Clip + uri: "{{ video_url }}" + action: notify.mobile_app_nokia_c20 + alias: "Notify: Send message to Nokia_C20" + - action: counter.increment + target: + entity_id: counter.nokia_c20_notification_counter + data: {} + alias: Increment NOKIA_C20 notification counter + - if: + - condition: template + value_template: "{{ send_to_sm_x115 | default(True) }}" + alias: Send to SM_X115? + then: + - parallel: + - data: + message: "{{ message }}" + title: "{{ title }}" + data: + sticky: "true" + color: "#2DF56D" + channel: "{{ channel }}" + vibrationPattern: 100, 1000, 100, 1000, 100 + priority: "{{ priority }}" + ledColor: red + importance: "{{ importance }}" + clickAction: "{{ image_url }}" + tag: "{{ notifTag }}" + group: "{{ group }}" + image: >- + {% if (importance == "default" and video != null) -%} {{ + null }} {%- else -%} {{ image_url }} {%- endif %} + video: >- + {% if (importance == "default" and video != null) -%} {{ + video_url }} {%- else -%} {{ null }} {%- endif %} + notification_icon: "{{ notifIcon }}" + when: "{{ when }}" + actions: + - action: URI + title: Open Image + uri: "{{ image_url }}" + - action: URI + title: Open Clip + uri: "{{ video_url }}" + action: notify.mobile_app_sm_x115 + alias: "Notify: Send message to SM_X115" + - action: counter.increment + target: + entity_id: counter.sm_x115_notification_counter + data: {} + alias: Increment SM_X115 notification counter + - if: + - condition: template + value_template: "{{ send_to_sm_a032f | default(True) }}" + alias: Send to SM_A032F? + then: + - parallel: + - data: + message: "{{ message }}" + title: "{{ title }}" + data: + sticky: "true" + color: "#2DF56D" + channel: "{{ channel }}" + vibrationPattern: 100, 1000, 100, 1000, 100 + priority: "{{ priority }}" + ledColor: red + importance: "{{ importance }}" + clickAction: "{{ image_url }}" + tag: "{{ notifTag }}" + group: "{{ group }}" + image: >- + {% if (importance == "default" and video != null) -%} {{ + null }} {%- else -%} {{ image_url }} {%- endif %} + video: >- + {% if (importance == "default" and video != null) -%} {{ + video_url }} {%- else -%} {{ null }} {%- endif %} + notification_icon: "{{ notifIcon }}" + when: "{{ when }}" + actions: + - action: URI + title: Open Image + uri: "{{ image_url }}" + - action: URI + title: Open Clip + uri: "{{ video_url }}" + action: notify.mobile_app_sm_a032f + alias: "Notify: Send message to SM_A032F" + - action: counter.increment + target: + entity_id: counter.sm_a032f_notification_counter + data: {} + alias: Increment SM_A032F notification counter mode: parallel icon: mdi:bell-ring-outline max: 10 fields: - send_to_sm_n986b: - selector: - boolean: null - name: send_to_sm_n986b - required: false send_to_nova_4k: selector: boolean: null @@ -90,21 +215,11 @@ fields: text: null name: group required: true - channel: - selector: - text: null - name: channel - required: true importance: selector: text: null name: importance required: true - priority: - selector: - text: null - name: priority - required: true base_url: selector: text: null @@ -125,4 +240,3 @@ fields: text: null name: when required: true -description: "" diff --git a/home-assistant/sthome_view.yml b/home-assistant/sthome_view.yml new file mode 100644 index 0000000..04b51ce --- /dev/null +++ b/home-assistant/sthome_view.yml @@ -0,0 +1,702 @@ +title: Home +button_card_templates: + sensor: + aspect_ratio: 1.2/1 + show_state: true + show_icon: true + sensor_battery: + template: sensor + icon: | + [[[ + if (entity.state < 5) return 'mdi:battery-alert-variant-outline'; + if (entity.state >= 5 && entity.state <15) return 'mdi:battery-10'; + if (entity.state >= 15 && entity.state < 25) return 'mdi:battery-20'; + if (entity.state >= 25 && entity.state < 35) return 'mdi:battery-30'; + if (entity.state >= 35 && entity.state < 45) return 'mdi:battery-40'; + if (entity.state >= 45 && entity.state < 55) return 'mdi:battery-50'; + if (entity.state >= 55 && entity.state < 65) return 'mdi:battery-60'; + if (entity.state >= 65 && entity.state < 75) return 'mdi:battery-70'; + if (entity.state >= 75 && entity.state < 85) return 'mdi:battery-80'; + if (entity.state >= 85 && entity.state < 95) return 'mdi:battery-90'; + if (entity.state >= 95) return 'mdi:battery'; + else return 'mdi:battery-alert-variant-outline'; + ]]] + style: + - padding: 0px + styles: + icon: + - color: | + [[[ + if (entity.state < 15) return 'red'; + if (entity.state >= 15 && entity.state <25) return 'firebrick'; + if (entity.state >= 25 && entity.state < 55) return 'orange'; + if (entity.state >= 55) return 'green'; + else return 'red'; + ]]] +views: + - title: Home + cards: [] + type: sections + icon: mdi:home + badges: + - type: custom:mushroom-chips-card + alignment: justify + chips: + - type: template + entity: binary_sensor.alarm_triggered + icon: '{{ state_attr("binary_sensor.alarm_triggered", "icon") }}' + icon_color: | + {% if is_state('binary_sensor.alarm_triggered', 'on') %} + red + {% else %} + #4682B4 + {% endif %} + content: Alarm + tap_action: + action: navigate + navigation_path: /dashboard-sthome/alarm + - type: template + entity: binary_sensor.motion_detected + icon: '{{ state_attr("binary_sensor.motion_detected", "icon") }}' + icon_color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states.binary_sensor.motion_detected.last_changed))|int + %} {{ "#ff0000" if lc < 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 + }} {{ "#d2042d" if lc >= 20 and lc < 45 }} {{ "#fA8072" if lc >= + 45 and lc < 90 }} {{ "#ff8c00" if lc >= 90 and lc < 180 }} {{ + "#ffa500" if lc >= 180 and lc < 400 }} {{ "#fff700" if lc >= 400 + and lc < 830 }} {{ "#ffff00" if lc >= 830 and lc < 1725 }} {{ + "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" if lc >= + 3600 and lc < 21600 }} + content: >- + {{ states['binary_sensor.motion_detected'].state | title }} · {{ + states['binary_sensor.motion_detected'].last_changed | + relative_time }} + tap_action: + action: navigate + navigation_path: /dashboard-sthome/alarm + card_mod: + style: + mushroom-template-chip:nth-child(2)$: | + ha-state-icon { + {{ 'animation: clip 2s linear infinite;' if is_state('binary_sensor.motion_detected', 'on') }} + } + @keyframes clip { + 50% { clip-path: polygon(0 0, 61% 0, 66% 100%, 0% 100%); } + } + sections: + - type: grid + cards: + - type: custom:mushroom-chips-card + chips: + - type: entity + entity: sun.sun + - type: template + content: >- + Sunrise {% if states.sun.sun %} {{ + (as_timestamp(states.sun.sun.attributes.next_rising)) | + timestamp_custom(('%H:%M') )}} {% endif %} + icon: mdi:weather-sunset-up + - type: template + content: >- + Sunset {% if states.sun.sun %} {{ + (as_timestamp(states.sun.sun.attributes.next_setting)) | + timestamp_custom(('%H:%M') )}} {% endif %} + icon: mdi:weather-sunset-down + - type: entity + entity: sensor.moon_phase + - show_current: true + show_forecast: true + type: weather-forecast + entity: weather.forecast_home + secondary_info_attribute: humidity + forecast_type: daily + - type: custom:mushroom-person-card + entity: person.chris + name: Chris + - type: custom:mushroom-person-card + entity: device_tracker.nokia_c20 + - type: grid + cards: + - type: heading + heading: Media players + heading_style: title + icon: mdi:television + - type: custom:mushroom-media-player-card + entity: media_player.smart_tv + name: Hisense + icon: mdi:television + collapsible_controls: true + use_media_info: true + volume_controls: + - volume_mute + - volume_set + - volume_buttons + media_controls: + - on_off + - shuffle + - previous + - play_pause_stop + - next + - repeat + show_volume_level: true + - type: custom:mushroom-media-player-card + entity: media_player.xiaomi_tv_box_2 + name: Xiaomi + icon: mdi:television-box + collapsible_controls: true + use_media_info: true + volume_controls: + - volume_mute + - volume_set + - volume_buttons + media_controls: + - on_off + - shuffle + - previous + - play_pause_stop + - next + - repeat + show_volume_level: true + - type: custom:mushroom-media-player-card + entity: media_player.nova4k + name: Nova4k + icon: mdi:television-box + collapsible_controls: true + use_media_info: true + volume_controls: + - volume_mute + - volume_set + - volume_buttons + media_controls: + - on_off + - shuffle + - previous + - play_pause_stop + - next + - repeat + show_volume_level: true + - type: grid + cards: + - type: heading + heading: Phones + heading_style: title + - type: custom:mushroom-template-card + primary: S20 ultra + secondary: '{{ states[''sensor.sm_n986b_battery_level''].state }}%' + entity: sensor.sm_n986b_battery_level + icon_color: |- + {% set state=states['sensor.sm_n986b_battery_level'].state %} + {% if state|int < 15 %} + red + {% elif (state|int > 15 and state|int < 25) %} + #b22222 + {% elif (state|int > 25 and state|int < 55) %} + orange + {% else %} + green + {% endif %} + icon: '{{ state_attr("sensor.sm_n986b_battery_level", "icon") }}' + - type: custom:mushroom-template-card + primary: Nokia C20 + secondary: '{{ states[''sensor.nokia_c20_battery_level''].state }}%' + entity: sensor.nokia_c20_battery_level + icon_color: |- + {% set state=states['sensor.nokia_c20_battery_level'].state %} + {% if state|int < 15 %} + red + {% elif (state|int > 15 and state|int < 25) %} + #b22222 + {% elif (state|int > 25 and state|int < 55) %} + orange + {% else %} + green + {% endif %} + icon: '{{ state_attr("sensor.nokia_c20_battery_level", "icon") }}' + - type: custom:mushroom-template-card + primary: A9 tablet + secondary: '{{ states[''sensor.sm_x115_battery_level''].state }}%' + entity: sensor.sm_x115_battery_level + icon_color: |- + {% set state=states['sensor.sm_x115_battery_level'].state %} + {% if state|int < 15 %} + red + {% elif (state|int > 15 and state|int < 25) %} + #b22222 + {% elif (state|int > 25 and state|int < 55) %} + orange + {% else %} + green + {% endif %} + icon: '{{ state_attr("sensor.sm_x115_battery_level", "icon") }}' + - type: grid + cards: + - type: heading + heading: Counters + - type: custom:mushroom-entity-card + entity: counter.sm_n986b_notification_counter + name: S20 + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: counter.nokia_c20_notification_counter + name: Nokia C20 + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: counter.sm_x115_notification_counter + name: A9 tablet + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: counter.driveway_person_alarm_counter + name: Driveway + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: counter.east_wall_person_alarm_counter + name: Eastwall + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: counter.backyard_person_alarm_counter + name: Backyard + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: counter.patio_person_alarm_counter + name: Patio + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: counter.west_wall_person_alarm_counter + name: Westwall + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: grid + cards: + - type: heading + heading: Work in progress + heading_style: title + icon: mdi:spade + - type: custom:mushroom-entity-card + entity: switch.sthome_ut1_relay_2 + name: Relay 2 + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: switch.sthome_ut1_relay_3 + name: Relay 3 + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: binary_sensor.gate_lock + name: Gate lock + secondary_info: state + grid_options: + columns: 4 + rows: 1 + - type: custom:mushroom-entity-card + entity: switch.sthome_ut4_relay_6 + name: Open/Close gate + secondary_info: state + grid_options: + columns: 4 + rows: 1 + header: + card: + type: markdown + text_only: true + content: |- + # Hello {{ user }} + sthome dashboard ✨ + max_columns: 2 + dense_section_placement: true + - title: Security Cameras + cards: [] + icon: mdi:cctv + type: sections + sections: + - type: grid + cards: + - type: heading + heading: Cameras + heading_style: title + icon: mdi:cctv + - show_state: true + show_name: true + camera_view: auto + type: picture-entity + entity: camera.driveway + grid_options: + columns: 12 + rows: auto + - show_state: true + show_name: true + camera_view: auto + type: picture-entity + entity: camera.patio + grid_options: + columns: 6 + rows: auto + - show_state: true + show_name: true + camera_view: auto + type: picture-entity + entity: camera.eastwall + grid_options: + columns: 6 + rows: auto + - show_state: true + show_name: true + camera_view: auto + type: picture-entity + entity: camera.westwall + grid_options: + columns: 6 + rows: auto + - show_state: true + show_name: true + camera_view: auto + type: picture-entity + entity: camera.backyard + grid_options: + columns: 6 + rows: auto + column_span: 1 + - type: grid + cards: + - type: heading + heading: Detections + heading_style: title + - type: picture + image_entity: image.driveway_person + grid_options: + columns: 6 + rows: auto + - type: picture + image_entity: image.driveway_car + grid_options: + columns: 6 + rows: auto + - type: picture + image_entity: image.eastwall_person + grid_options: + columns: 6 + rows: auto + - type: picture + image_entity: image.patio_person + grid_options: + columns: 6 + rows: auto + - type: picture + image_entity: image.westwall_person + grid_options: + columns: 6 + rows: auto + - type: picture + image_entity: image.backyard_person + grid_options: + columns: 6 + rows: auto + header: + card: + type: markdown + text_only: true + content: Security Cameras + max_columns: 4 + dense_section_placement: true + badges: + - type: entity + entity: counter.driveway_person_alarm_counter + - type: entity + entity: counter.east_wall_person_alarm_counter + - type: entity + entity: counter.patio_person_alarm_counter + - type: entity + entity: counter.west_wall_person_alarm_counter + - type: entity + entity: counter.backyard_person_alarm_counter + - type: sections + max_columns: 10 + subview: true + path: alarm + title: Alarm + icon: mdi:alarm-light + sections: + - type: grid + cards: + - type: heading + heading: Settings + heading_style: title + - type: custom:mushroom-template-card + icon: '{{ state_attr("binary_sensor.motion_detect_enabled", "icon") }}' + primary: '{{ states["input_boolean.motion_detect"].name }}' + secondary: '{{ states["input_boolean.motion_detect"].state }}' + icon_color: |- + {% if is_state('input_boolean.motion_detect', 'on') %} + green + {% else %} + #4682B4 + {% endif %} + badge_icon: '' + badge_color: '' + entity: input_boolean.motion_detect + - type: custom:mushroom-template-card + entity: input_boolean.notify_sm_n986b + secondary: '{{ states["input_boolean.notify_sm_n986b"].state }}' + icon: '{{ state_attr("input_boolean.notify_sm_n986b", "icon") }}' + primary: '{{ states[''input_boolean.notify_sm_n986b''].name }}' + icon_color: |- + {% if is_state('input_boolean.notify_sm_n986b', 'on') %} + green + {% else %} + #4682B4 + {% endif %} + - type: custom:mushroom-template-card + entity: input_boolean.notify_nokia_c20 + secondary: '{{ states[''input_boolean.notify_nokia_c20''].state }}' + icon: '{{ state_attr("input_boolean.notify_nokia_c20", "icon") }}' + primary: '{{ states[''input_boolean.notify_nokia_c20''].name }}' + icon_color: |- + {% if is_state('input_boolean.notify_nokia_c20', 'on') %} + green + {% else %} + #4682B4 + {% endif %} + - type: custom:mushroom-template-card + entity: input_boolean.notify_sm_x115 + secondary: '{{ states[''input_boolean.notify_sm_x115''].state }}' + icon: '{{ state_attr("input_boolean.notify_sm_x115", "icon") }}' + primary: '{{ states[''input_boolean.notify_sm_x115''].name }}' + icon_color: |- + {% if is_state('input_boolean.notify_sm_x115', 'on') %} + green + {% else %} + #4682B4 + {% endif %} + column_span: 1 + cards: [] + badges: + - type: entity + show_name: true + show_state: true + show_icon: true + entity: binary_sensor.alarm_triggered + show_entity_picture: false + color: red + name: Siren + state_content: + - state + - last_changed + tap_action: + action: more-info + - type: entity + show_name: true + show_state: true + show_icon: true + entity: binary_sensor.zone_4_triggered + color: red + name: Zone 4 + state_content: + - state + - last_changed + tap_action: + action: more-info + - type: entity + show_name: true + show_state: true + show_icon: true + entity: switch.sthome_ut1_floodlights_backyard + state_content: + - state + - last_changed + show_entity_picture: true + icon: mdi:light-flood-down + name: Backyard + double_tap_action: + action: toggle + tap_action: + action: more-info + - type: entity + show_name: true + show_state: true + show_icon: true + entity: binary_sensor.sthome_ut1_floodlights_test_mode + icon: mdi:light-flood-down + show_entity_picture: true + color: orange + name: Test mode + - type: custom:mushroom-template-badge + entity: binary_sensor.motion_detected + content: > + {{ states['binary_sensor.motion_detected'].state | title }} · {{ + states['binary_sensor.motion_detected'].last_changed | relative_time + }} + icon: '{{ state_attr("binary_sensor.motion_detected", "icon") }}' + color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states[entity].last_changed))|int %} {{ "#ff0000" if lc < + 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ "#d2042d" if lc >= 20 + and lc < 45 }} {{ "#fA8072" if lc >= 45 and lc < 90 }} {{ "#ff8c00" if + lc >= 90 and lc < 180 }} {{ "#ffa500" if lc >= 180 and lc < 400 }} {{ + "#fff700" if lc >= 400 and lc < 830 }} {{ "#ffff00" if lc >= 830 and + lc < 1725 }} {{ "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" + if lc >= 3600 and lc < 21600 }} + label: '{{ states[entity].name }}' + - type: custom:mushroom-template-badge + entity: binary_sensor.patio_motion_detect + content: >- + {{ states[entity].state | title }} · {{ states[entity].last_changed | + relative_time }} + icon: |- + {% set state = states(entity) %} + {% if state == 'on' %} + mdi:motion-sensor + {% elif state == 'off' %} + mdi:motion-sensor-off + {% else %} + mdi:motion-sensor-off + {% endif %} + color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states[entity].last_changed))|int %} {{ "#ff0000" if lc < + 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ "#d2042d" if lc >= 20 + and lc < 45 }} {{ "#fA8072" if lc >= 45 and lc < 90 }} {{ "#ff8c00" if + lc >= 90 and lc < 180 }} {{ "#ffa500" if lc >= 180 and lc < 400 }} {{ + "#fff700" if lc >= 400 and lc < 830 }} {{ "#ffff00" if lc >= 830 and + lc < 1725 }} {{ "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" + if lc >= 3600 and lc < 21600 }} + label: '{{ states[entity].name }}' + tap_action: + action: more-info + - type: custom:mushroom-template-badge + content: >- + {{ states[entity].state | title }} · {{ states[entity].last_changed | + relative_time }} + color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states[entity].last_changed))|int %} {{ "#ff0000" if lc < + 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ "#d2042d" if lc >= 20 + and lc < 45 }} {{ "#fA8072" if lc >= 45 and lc < 90 }} {{ "#ff8c00" if + lc >= 90 and lc < 180 }} {{ "#ffa500" if lc >= 180 and lc < 400 }} {{ + "#fff700" if lc >= 400 and lc < 830 }} {{ "#ffff00" if lc >= 830 and + lc < 1725 }} {{ "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" + if lc >= 3600 and lc < 21600 }} + label: '{{ states[entity].name }}' + tap_action: + action: more-info + entity: binary_sensor.driveway_motion_detect + icon: |- + {% set state = states(entity) %} + {% if state == 'on' %} + mdi:motion-sensor + {% elif state == 'off' %} + mdi:motion-sensor-off + {% else %} + mdi:motion-sensor-off + {% endif %} + - type: custom:mushroom-template-badge + content: >- + {{ states[entity].state | title }} · {{ states[entity].last_changed | + relative_time }} + icon: |- + {% set state = states(entity) %} + {% if state == 'on' %} + mdi:motion-sensor + {% elif state == 'off' %} + mdi:motion-sensor-off + {% else %} + mdi:motion-sensor-off + {% endif %} + color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states[entity].last_changed))|int %} {{ "#ff0000" if lc < + 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ "#d2042d" if lc >= 20 + and lc < 45 }} {{ "#fA8072" if lc >= 45 and lc < 90 }} {{ "#ff8c00" if + lc >= 90 and lc < 180 }} {{ "#ffa500" if lc >= 180 and lc < 400 }} {{ + "#fff700" if lc >= 400 and lc < 830 }} {{ "#ffff00" if lc >= 830 and + lc < 1725 }} {{ "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" + if lc >= 3600 and lc < 21600 }} + label: '{{ states[entity].name }}' + tap_action: + action: more-info + entity: binary_sensor.eastwall_motion_detect + - type: custom:mushroom-template-badge + entity: input_boolean.westwall_motion_detected + content: >- + {{ states[entity].state | title }} · {{ states[entity].last_changed | + relative_time }} + icon: |- + {% set state = states(entity) %} + {% if state == 'on' %} + mdi:motion-sensor + {% elif state == 'off' %} + mdi:motion-sensor-off + {% else %} + mdi:motion-sensor-off + {% endif %} + color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states[entity].last_changed))|int %} {{ "#ff0000" if lc < + 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ "#d2042d" if lc >= 20 + and lc < 45 }} {{ "#fA8072" if lc >= 45 and lc < 90 }} {{ "#ff8c00" if + lc >= 90 and lc < 180 }} {{ "#ffa500" if lc >= 180 and lc < 400 }} {{ + "#fff700" if lc >= 400 and lc < 830 }} {{ "#ffff00" if lc >= 830 and + lc < 1725 }} {{ "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" + if lc >= 3600 and lc < 21600 }} + label: '{{ states[entity].name }}' + tap_action: + action: more-info + - type: custom:mushroom-template-badge + entity: input_boolean.backyard_motion_detected + content: >- + {{ states[entity].state | title }} · {{ states[entity].last_changed | + relative_time }} + icon: |- + {% set state = states(entity) %} + {% if state == 'on' %} + mdi:motion-sensor + {% elif state == 'off' %} + mdi:motion-sensor-off + {% else %} + mdi:motion-sensor-off + {% endif %} + color: >- + {% set lc = (as_timestamp(now()) - + as_timestamp(states[entity].last_changed))|int %} {{ "#ff0000" if lc < + 10 }} {{ "#4d061c" if lc >= 10 and lc < 20 }} {{ "#d2042d" if lc >= 20 + and lc < 45 }} {{ "#fA8072" if lc >= 45 and lc < 90 }} {{ "#ff8c00" if + lc >= 90 and lc < 180 }} {{ "#ffa500" if lc >= 180 and lc < 400 }} {{ + "#fff700" if lc >= 400 and lc < 830 }} {{ "#ffff00" if lc >= 830 and + lc < 1725 }} {{ "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" + if lc >= 3600 and lc < 21600 }} + label: '{{ states[entity].name }}' + tap_action: + action: more-info + header: + card: + type: markdown + text_only: true + content: | + # House Alarm