diff --git a/home-assistant/Action specified device for specified user.yml b/home-assistant/Action specified device for specified user.yml new file mode 100644 index 0000000..1202f9c --- /dev/null +++ b/home-assistant/Action specified device for specified user.yml @@ -0,0 +1,95 @@ +alias: Action specified device for specified user +description: "" +sequence: + - variables: + context_user: >- + {% set user_id = context.user_id %} {{ states.person | + selectattr('attributes.user_id', '==', user_id) | + map(attribute='attributes.friendly_name') | first }} + - condition: template + value_template: "{{ context_user == authorised_user }}" + alias: is user excuting script the authorised_user? + - choose: + - conditions: + - condition: template + value_template: "{{ action_to_perform == 'toggle' }}" + alias: is toggle requested? + sequence: + - choose: + - conditions: + - condition: template + value_template: "{{ device == 'sm_n986b' }}" + alias: is device sm_n986b? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_n986b + - conditions: + - condition: template + value_template: "{{ device == 'nokia_c20' }}" + alias: is device nokia_c20? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_nokia_c20 + - conditions: + - condition: template + value_template: "{{ device == 'sm_x115' }}" + alias: is device sm_x115? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_x115 + - conditions: + - condition: template + value_template: "{{ device == 'sm_a032f' }}" + alias: is device sm_a032f? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_a032f + - conditions: + - condition: template + value_template: "{{ device == 'sm_a245f' }}" + alias: is device sm_a245f? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_a245f + - conditions: + - alias: is device sm_a042f? + condition: template + value_template: "{{ device == 'sm_a042f' }}" + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_a042f +fields: + authorised_user: + selector: + text: null + name: Authorised User + description: User who is allowed to execute script + required: true + action_to_perform: + selector: + text: null + name: Action to Perform + required: true + device: + selector: + text: null + name: Device + required: true diff --git a/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml b/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml index a661b03..4ad1649 100644 --- a/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml +++ b/home-assistant/FRIGATE- Person Detect Logic - Backyard Camera.yml @@ -1,124 +1,100 @@ -alias: "FRIGATE: Person Detect Logic - Backyard Camera" -description: >- - This automation is used to send a notification when a person is detected by - Frigate. It uses the frigate MQTT event stream to trigger the notification and - includes a snapshot of the detected object. The notification will be sent to - all devices with the specified group and will include a video clip of the - detection if available. -triggers: - - topic: homeassistant/events - id: frigate-event - value_template: "{{ value_json[\"after\"][\"camera\"] }}" - variables: - after_zones: "{{ trigger.payload_json[\"after\"][\"entered_zones\"] }}" - before_zones: "{{ trigger.payload_json[\"before\"][\"entered_zones\"] }}" - camera: "{{ trigger.payload_json[\"after\"][\"camera\"] }}" - id: "{{ trigger.payload_json[\"after\"][\"id\"] }}" - label: "{{ trigger.payload_json[\"after\"][\"label\"] }}" - score: "{{ trigger.payload_json[\"after\"][\"score\"] }}" - time_clip_start: "{{ trigger.payload_json[\"after\"][\"start_time\"] - 10.0 }}" - detect_time: "{{trigger.payload_json[\"after\"][\"start_time\"]|int}}" - trigger: mqtt - payload: Backyard -conditions: +alias: Action specified device for specified user +description: "" +sequence: + - variables: + context_user: >- + {% set user_id = context.user_id %} {{ states.person | + selectattr('attributes.user_id', '==', user_id) | + map(attribute='attributes.friendly_name') | first }} - condition: or conditions: - condition: template - value_template: "{{ trigger.payload_json['type'] == 'new' }}" + value_template: "{{ context_user == authorised_user }}" + alias: is user excuting script the authorised_user? - condition: template - value_template: "{{ before_zones | length == 0 }}" - enabled: true - - alias: Object is in Back Yard - 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: + value_template: "{{ context_user == 'Chris' }}" + alias: is user excuting script the admin user? - choose: - conditions: - - condition: trigger - id: frigate-event + - condition: template + value_template: "{{ action_to_perform == 'toggle' }}" + alias: is toggle requested? sequence: - - action: input_boolean.turn_on - metadata: {} - data: {} - target: - entity_id: input_boolean.backyard_motion_detected - alias: Set Backyard motion detected - - action: script.person_detect_actions - alias: Trigger alarm and send critical priority event to devices - data: - id: "{{ id }}" - title: >- - {{ label }} was detected on {{ camera | replace("_", " ") | - title }} camera - message: >- - "{{ label }} detected in the {{ after_zones[0] | replace("_", " - ") | title }} zone" - notifTag: "{{ id }}" - notifIcon: mdi:alarm-light - group: frigate-notification-{{ camera }} - channel: alarm - importance: max - priority: critical - image: /api/frigate/notifications/{{ id }}/snapshot.jpg - video: null - base_url: https://home-assistant.sthome.org - when: "{{ detect_time }}" - camera: "{{ camera }}" - - repeat: - sequence: - - wait_for_trigger: - - topic: homeassistant/events - payload: "{{ trigger.payload_json[\"after\"][\"id\"] }}" - value_template: "{{ value_json[\"after\"][\"id\"] }}" - trigger: mqtt - continue_on_timeout: false - timeout: "00:02:00" - alias: 2 min timeout - - condition: template - value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}" - alias: Wait for end event - - action: script.person_detect_actions - alias: Send high priority notification to devices - data: - id: "{{ id }}" - title: > - {% if (wait.trigger.payload_json["after"]["sub_label"] != - None) -%} {{ - (wait.trigger.payload_json["after"]["sub_label"]) | title - }} {%- else -%} {{ label | replace("_", " ") | title }} - {%- endif %} was detected in the {{ after_zones[0] | - replace("_", " ") | title }} zone - message: >- - Detected with {{ int(score | round(2) * 100) }}% - confidence - notifTag: "{{ id }}" - notifIcon: mdi:cctv - group: > - frigate-notification-{{ - trigger.payload_json["after"]["camera"] }} - channel: alarm - priority: high - importance: default - image: /api/frigate/notifications/{{ id }}/snapshot.jpg - video: /api/frigate/notifications/{{ id }}/{{ camera }}/clip.mp4 - base_url: https://home-assistant.sthome.org - when: "{{ detect_time }}" - camera: "{{ camera }}" - until: - - condition: template - value_template: "{{ wait.trigger.payload_json[\"type\"] == \"end\" }}" - alias: End event is detected - - action: input_boolean.turn_off - metadata: {} - data: {} - target: - entity_id: input_boolean.backyard_motion_detected - alias: Reset Backyard motion detected - default: [] -mode: parallel -max: 10 + - choose: + - conditions: + - condition: template + value_template: "{{ device == 'sm_n986b' }}" + alias: is device sm_n986b? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_n986b + - conditions: + - condition: template + value_template: "{{ device == 'nokia_c20' }}" + alias: is device nokia_c20? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_nokia_c20 + - conditions: + - condition: template + value_template: "{{ device == 'sm_x115' }}" + alias: is device sm_x115? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_x115 + - conditions: + - condition: template + value_template: "{{ device == 'sm_a032f' }}" + alias: is device sm_a032f? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_a032f + - conditions: + - condition: template + value_template: "{{ device == 'sm_a245f' }}" + alias: is device sm_a245f? + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_a245f + - conditions: + - alias: is device sm_a042f? + condition: template + value_template: "{{ device == 'sm_a042f' }}" + sequence: + - action: input_boolean.toggle + metadata: {} + data: {} + target: + entity_id: input_boolean.notify_sm_a042f +fields: + authorised_user: + selector: + text: null + name: Authorised User + description: User who is allowed to execute script + required: true + action_to_perform: + selector: + text: null + name: Action to Perform + required: true + device: + selector: + text: null + name: Device + required: true diff --git a/home-assistant/Send Dynamic Notification To All Devices.yml b/home-assistant/Send Dynamic Notification To All Devices.yml index 36e5466..163eb62 100644 --- a/home-assistant/Send Dynamic Notification To All Devices.yml +++ b/home-assistant/Send Dynamic Notification To All Devices.yml @@ -8,6 +8,7 @@ sequence: send_to_sm_x115: "{{ states('input_boolean.notify_sm_x115') == 'on' }}" send_to_sm_a032f: "{{ states('input_boolean.notify_sm_a032f') == 'on' }}" send_to_sm_a245f: "{{ states('input_boolean.notify_sm_a245f') == 'on' }}" + send_to_sm_a042f: "{{ states('input_boolean.notify_sm_a042f') == 'on' }}" send_to_nova_4k: false - parallel: - if: @@ -220,6 +221,48 @@ sequence: entity_id: counter.sm_a245f_notification_counter data: {} alias: Increment SM_A245F notification counter + - if: + - condition: template + value_template: "{{ send_to_sm_a042f | default(True) }}" + alias: Send to SM_A245F? + 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_a042f + alias: "Notify: Send message to SM_A042F" + - action: counter.increment + target: + entity_id: counter.sm_a042f_notification_counter + data: {} + alias: Increment SM_A042F notification counter mode: parallel icon: mdi:bell-ring-outline max: 10 diff --git a/home-assistant/counter.json b/home-assistant/counter.json index 2ac2e61..8a479d5 100644 --- a/home-assistant/counter.json +++ b/home-assistant/counter.json @@ -102,6 +102,15 @@ "restore": true, "minimum": null, "initial": 0 + }, + { + "id": "sm_a042f_notification_counter", + "name": "SM-A042F Notification Counter", + "step": 1, + "maximum": null, + "restore": true, + "minimum": null, + "initial": 0 } ] } diff --git a/home-assistant/input_boolean.json b/home-assistant/input_boolean.json index 3c5e7bd..435e9b2 100644 --- a/home-assistant/input_boolean.json +++ b/home-assistant/input_boolean.json @@ -58,7 +58,12 @@ "id": "notify_sm_a245f", "name": "Notify SM-A245F", "icon": "mdi:cellphone-text" + }, + { + "id": "notify_sm_a042f", + "name": "Notify SM-A042F", + "icon": "mdi:cellphone-text" } - ] + ] } } \ No newline at end of file diff --git a/home-assistant/lovelace.dashboard_sthome.yml b/home-assistant/lovelace.dashboard_sthome.yml index 990389d..7add872 100644 --- a/home-assistant/lovelace.dashboard_sthome.yml +++ b/home-assistant/lovelace.dashboard_sthome.yml @@ -268,6 +268,17 @@ }, "entity": "sensor.sm_a245f_battery_level", "primary": "Carlton (A24)" + }, + { + "type": "custom:mushroom-template-card", + "secondary": "{{ states['sensor.sm_a042f_battery_level'].state }}%", + "icon_color": "{% set state=states['sensor.sm_a042f_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_a042f_battery_level', 'icon') }}", + "tap_action": { + "action": "more-info" + }, + "entity": "sensor.sm_a042f_battery_level", + "primary": "Zelmique (A04)" } ] }, @@ -631,16 +642,36 @@ "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 %}", + "icon_color": "{% if is_state('input_boolean.notify_sm_n986b', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}", "primary": "Notify Chris (S20)", - "icon_color": "{% if is_state('input_boolean.notify_sm_n986b', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}" + "tap_action": { + "action": "perform-action", + "perform_action": "script.specified_user_action", + "target": {}, + "data": { + "authorised_user": "Chris", + "action_to_perform": "toggle", + "device": "sm_n986b" + } + } }, { "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 %}", + "icon_color": "{% if is_state('input_boolean.notify_nokia_c20', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}", "primary": "Notify Zelna (C20)", - "icon_color": "{% if is_state('input_boolean.notify_nokia_c20', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}" + "tap_action": { + "action": "perform-action", + "perform_action": "script.specified_user_action", + "target": {}, + "data": { + "authorised_user": "Zelna", + "action_to_perform": "toggle", + "device": "nokia_c20" + } + } }, { "type": "custom:mushroom-template-card", @@ -648,7 +679,17 @@ "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": "Notify Zelna (A9)", - "icon_color": "{% if is_state('input_boolean.notify_sm_x115', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}" + "icon_color": "{% if is_state('input_boolean.notify_sm_x115', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}", + "tap_action": { + "action": "perform-action", + "perform_action": "script.specified_user_action", + "target": {}, + "data": { + "authorised_user": "Zelna", + "action_to_perform": "toggle", + "device": "sm_x115" + } + } }, { "type": "custom:mushroom-template-card", @@ -657,20 +698,50 @@ "primary": "Notify Roderique (A03C)", "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" + "action": "perform-action", + "perform_action": "script.specified_user_action", + "target": {}, + "data": { + "authorised_user": "Roderique", + "action_to_perform": "toggle", + "device": "sm_a032f" + } + } }, { "type": "custom:mushroom-template-card", "secondary": "{{ states['input_boolean.notify_sm_a245f'].state }}", "icon": "{% if is_state('input_boolean.notify_sm_a245f', 'on') %}\n {{ state_attr(\"input_boolean.notify_sm_a245f\", \"icon\") }}\n{% else %}\n mdi:cellphone-off\n{% endif %}", "icon_color": "{% if is_state('input_boolean.notify_sm_a245f', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}", + "primary": "Notify Carlton (A24)", "tap_action": { - "action": "toggle" - }, - "entity": "input_boolean.notify_sm_a245f", - "primary": "Notify Carlton (A24)" + "action": "perform-action", + "perform_action": "script.specified_user_action", + "target": {}, + "data": { + "authorised_user": "Carlton", + "action_to_perform": "toggle", + "device": "sm_a245f" + } + } + }, + { + "type": "custom:mushroom-template-card", + "secondary": "{{ states['input_boolean.notify_sm_a042f'].state }}", + "icon": "{% if is_state('input_boolean.notify_sm_a042f', 'on') %}\n {{ state_attr(\"input_boolean.notify_sm_a042f\", \"icon\") }}\n{% else %}\n mdi:cellphone-off\n{% endif %}", + "icon_color": "{% if is_state('input_boolean.notify_sm_a042f', 'on') %}\n green\n{% else %}\n #4682B4\n{% endif %}", + "primary": "Notify Zelmique (A04)", + "entity": "input_boolean.notify_sm_a042f", + "tap_action": { + "action": "perform-action", + "perform_action": "script.specified_user_action", + "target": {}, + "data": { + "authorised_user": "Zelmique", + "action_to_perform": "toggle", + "device": "sm_a042f" + } + } } ], "column_span": 1 diff --git a/home-assistant/sthome_view.yml b/home-assistant/sthome_view.yml index 04b51ce..a0ab871 100644 --- a/home-assistant/sthome_view.yml +++ b/home-assistant/sthome_view.yml @@ -69,9 +69,11 @@ views: "#008000" if lc >= 1725 and lc < 3600 }} {{ "#4682B4" if lc >= 3600 and lc < 21600 }} content: >- - {{ states['binary_sensor.motion_detected'].state | title }} · {{ + {% set motion = is_state('binary_sensor.motion_detected', 'on') %} + {% set elapsed_time = states['binary_sensor.motion_detected'].last_changed | - relative_time }} + relative_time %} {{ 'Started' if motion else 'Stopped' }} · {{ + elapsed_time }} ago tap_action: action: navigate navigation_path: /dashboard-sthome/alarm @@ -91,6 +93,8 @@ views: chips: - type: entity entity: sun.sun + tap_action: + action: more-info - type: template content: >- Sunrise {% if states.sun.sun %} {{ @@ -105,6 +109,8 @@ views: icon: mdi:weather-sunset-down - type: entity entity: sensor.moon_phase + tap_action: + action: more-info - show_current: true show_forecast: true type: weather-forecast @@ -114,8 +120,13 @@ views: - type: custom:mushroom-person-card entity: person.chris name: Chris + tap_action: + action: more-info - type: custom:mushroom-person-card - entity: device_tracker.nokia_c20 + entity: person.zelna + name: Zelna + tap_action: + action: more-info - type: grid cards: - type: heading @@ -182,9 +193,7 @@ views: 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 %} @@ -197,8 +206,13 @@ views: green {% endif %} icon: '{{ state_attr("sensor.sm_n986b_battery_level", "icon") }}' + tap_action: + action: more-info + entity: sensor.sm_n986b_battery_level + primary: Chris (S20) + badge_icon: '' - type: custom:mushroom-template-card - primary: Nokia C20 + primary: Zelna (C20) secondary: '{{ states[''sensor.nokia_c20_battery_level''].state }}%' entity: sensor.nokia_c20_battery_level icon_color: |- @@ -213,8 +227,10 @@ views: green {% endif %} icon: '{{ state_attr("sensor.nokia_c20_battery_level", "icon") }}' + tap_action: + action: more-info - type: custom:mushroom-template-card - primary: A9 tablet + primary: Zelna (A9) secondary: '{{ states[''sensor.sm_x115_battery_level''].state }}%' entity: sensor.sm_x115_battery_level icon_color: |- @@ -229,6 +245,62 @@ views: green {% endif %} icon: '{{ state_attr("sensor.sm_x115_battery_level", "icon") }}' + tap_action: + action: more-info + - type: custom:mushroom-template-card + primary: Roderique (A03 Core) + secondary: '{{ states[''sensor.sm_a032f_battery_level''].state }}%' + icon_color: |- + {% set state=states['sensor.sm_a032f_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_a032f_battery_level'', ''icon'') }}' + tap_action: + action: more-info + entity: sensor.sm_a032f_battery_level + - type: custom:mushroom-template-card + secondary: '{{ states[''sensor.sm_a245f_battery_level''].state }}%' + icon_color: |- + {% set state=states['sensor.sm_a245f_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_a245f_battery_level'', ''icon'') }}' + tap_action: + action: more-info + entity: sensor.sm_a245f_battery_level + primary: Carlton (A24) + - type: custom:mushroom-template-card + secondary: '{{ states[''sensor.sm_a042f_battery_level''].state }}%' + icon_color: |- + {% set state=states['sensor.sm_a042f_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_a042f_battery_level'', ''icon'') }}' + tap_action: + action: more-info + entity: sensor.sm_a042f_battery_level + primary: Zelmique (A04) - type: grid cards: - type: heading @@ -247,6 +319,13 @@ views: 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 @@ -344,7 +423,7 @@ views: heading_style: title icon: mdi:cctv - show_state: true - show_name: true + show_name: false camera_view: auto type: picture-entity entity: camera.driveway @@ -352,7 +431,7 @@ views: columns: 12 rows: auto - show_state: true - show_name: true + show_name: false camera_view: auto type: picture-entity entity: camera.patio @@ -360,15 +439,16 @@ views: columns: 6 rows: auto - show_state: true - show_name: 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: true + show_name: false camera_view: auto type: picture-entity entity: camera.westwall @@ -376,7 +456,7 @@ views: columns: 6 rows: auto - show_state: true - show_name: true + show_name: false camera_view: auto type: picture-entity entity: camera.backyard @@ -439,7 +519,7 @@ views: entity: counter.backyard_person_alarm_counter - type: sections max_columns: 10 - subview: true + subview: false path: alarm title: Alarm icon: mdi:alarm-light @@ -450,7 +530,15 @@ views: heading: Settings heading_style: title - type: custom:mushroom-template-card - icon: '{{ state_attr("binary_sensor.motion_detect_enabled", "icon") }}' + icon: |- + {% set state = states["input_boolean.motion_detect"].state %} + {% if state == 'on' %} + mdi:motion-sensor + {% elif state == 'off'%} + mdi:motion-sensor-off + {% else %} + mdi:motion-sensor-off + {% endif %} primary: '{{ states["input_boolean.motion_detect"].name }}' secondary: '{{ states["input_boolean.motion_detect"].state }}' icon_color: |- @@ -462,11 +550,18 @@ views: 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: '{{ state_attr("input_boolean.notify_sm_n986b", "icon") }}' - primary: '{{ states[''input_boolean.notify_sm_n986b''].name }}' + icon: |- + {% if is_state('input_boolean.notify_sm_n986b', 'on') %} + {{ state_attr("input_boolean.notify_sm_n986b", "icon") }} + {% else %} + mdi:cellphone-off + {% endif %} + primary: Notify Chris (S20) icon_color: |- {% if is_state('input_boolean.notify_sm_n986b', 'on') %} green @@ -476,8 +571,13 @@ views: - 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: |- + {% if is_state('input_boolean.notify_nokia_c20', 'on') %} + {{ state_attr("input_boolean.notify_nokia_c20", "icon") }} + {% else %} + mdi:cellphone-off + {% endif %} + primary: Notify Zelna (C20) icon_color: |- {% if is_state('input_boolean.notify_nokia_c20', 'on') %} green @@ -487,14 +587,73 @@ views: - 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: |- + {% if is_state('input_boolean.notify_sm_x115', 'on') %} + {{ state_attr("input_boolean.notify_sm_x115", "icon") }} + {% else %} + mdi:cellphone-off + {% endif %} + primary: Notify Zelna (A9) icon_color: |- {% if is_state('input_boolean.notify_sm_x115', 'on') %} green {% else %} #4682B4 {% endif %} + - type: custom:mushroom-template-card + secondary: '{{ states[''input_boolean.notify_sm_a032f''].state }}' + icon: |- + {% if is_state('input_boolean.notify_sm_a032f', 'on') %} + {{ state_attr("input_boolean.notify_sm_a032f", "icon") }} + {% else %} + mdi:cellphone-off + {% endif %} + primary: Notify Roderique (A03C) + icon_color: |- + {% if is_state('input_boolean.notify_sm_a032f', 'on') %} + green + {% else %} + #4682B4 + {% endif %} + tap_action: + action: toggle + entity: input_boolean.notify_sm_a032f + - type: custom:mushroom-template-card + secondary: '{{ states[''input_boolean.notify_sm_a245f''].state }}' + icon: |- + {% if is_state('input_boolean.notify_sm_a245f', 'on') %} + {{ state_attr("input_boolean.notify_sm_a245f", "icon") }} + {% else %} + mdi:cellphone-off + {% endif %} + icon_color: |- + {% if is_state('input_boolean.notify_sm_a245f', 'on') %} + green + {% else %} + #4682B4 + {% endif %} + tap_action: + action: toggle + entity: input_boolean.notify_sm_a245f + primary: Notify Carlton (A24) + - type: custom:mushroom-template-card + secondary: '{{ states[''input_boolean.notify_sm_a042f''].state }}' + icon: |- + {% if is_state('input_boolean.notify_sm_a042f', 'on') %} + {{ state_attr("input_boolean.notify_sm_a042f", "icon") }} + {% else %} + mdi:cellphone-off + {% endif %} + icon_color: |- + {% if is_state('input_boolean.notify_sm_a042f', 'on') %} + green + {% else %} + #4682B4 + {% endif %} + tap_action: + action: toggle + primary: Notify Zelmique (A04) + entity: input_boolean.notify_sm_a042f column_span: 1 cards: [] badges: @@ -547,23 +706,6 @@ views: 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: >- @@ -643,7 +785,6 @@ views: 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 }} @@ -668,8 +809,8 @@ views: label: '{{ states[entity].name }}' tap_action: action: more-info + entity: binary_sensor.westwall_motion_detect - type: custom:mushroom-template-badge - entity: input_boolean.backyard_motion_detected content: >- {{ states[entity].state | title }} · {{ states[entity].last_changed | relative_time }} @@ -694,9 +835,77 @@ views: 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 + - 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: full + 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 + + Open/close driveway gate + + ✨ WORK IN PROGRESS ✨ + + ⚠️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) %} + {% if state == 'on' %} + mdi:gate + {% elif state == 'off' %} + mdi:gate-alert + {% else %} + mdi:gate-alert + {% endif %} + color: |- + {% set state = states(entity) %} + {% if state == 'on' %} + red + {% elif state == 'off' %} + green + {% else %} + orange + {% endif %} + label: Gate + tap_action: + action: more-info + entity: binary_sensor.gate_lock