diff --git a/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml b/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml index 5b889bc..70a770d 100644 --- a/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml +++ b/home-assistant/FRIGATE- Person Detect Logic - Patio Camera.yml @@ -25,25 +25,32 @@ conditions: conditions: - condition: template value_template: "{{ trigger.payload_json['type'] == 'new' }}" + alias: New message - condition: template value_template: "{{ before_zones | length == 0 }}" + alias: No zones in before segment enabled: true -# - condition: template -# value_template: "{{ trigger.payload_json[\"after\"][\"entered_zones\"]|length > 0 }}" -# enabled: true - alias: Object is on Patio condition: template - value_template: "{{ [\"patio_z1\", \"Patio_Gate\"] | select(\"in\", after_zones) | list | length > 0 }}" + value_template: >- + {{ ["patio_z1", "Patio_Gate"] | select("in", after_zones) | list | length + > 0 }} enabled: true actions: - choose: - conditions: - condition: trigger id: frigate-event + - condition: or + conditions: + - condition: template + value_template: "{{ trigger.payload_json[\"before\"][\"stationary\"] != 'true' }}" + - condition: template + value_template: "{{ trigger.payload_json[\"after\"][\"stationary\"] != 'true' }}" + alias: Object is moving sequence: - action: script.person_detect_actions data: - send_to_sm_n986b: "true" send_to_nova_4k: "false" id: "{{ id }}" title: >- @@ -59,7 +66,7 @@ actions: importance: max priority: critical image: /api/frigate/notifications/{{ id }}/snapshot.jpg - video: "" + video: null base_url: https://home-assistant.sthome.org when: "{{ detect_time }}" camera: "{{ camera }}" @@ -72,11 +79,12 @@ actions: 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 data: - send_to_sm_n986b: "true" send_to_nova_4k: "false" id: "{{ id }}" title: > diff --git a/home-assistant/Improving person detect automation.yml b/home-assistant/Improving person detect automation.yml new file mode 100644 index 0000000..869dcbf --- /dev/null +++ b/home-assistant/Improving person detect automation.yml @@ -0,0 +1,135 @@ +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: + - condition: or + conditions: + - condition: template + value_template: "{{ trigger.payload_json['type'] == 'new' }}" + - 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 +actions: + - choose: + - conditions: + - condition: trigger + id: frigate-event + - condition: or + conditions: + - condition: template + value_template: "{{ trigger.payload_json[\"before\"][\"stationary\"] != 'true' }}" + - condition: template + value_template: "{{ trigger.payload_json[\"after\"][\"stationary\"] != 'true' }}" + alias: Object is moving + sequence: + - action: script.person_detect_actions + alias: Trigger alarm and send critical priority event to devices + data: + send_to_sm_n986b: "true" + send_to_sm_x115: "true" + send_to_nokia_c20: "true" + send_to_nova_4k: "false" + 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 +# - condition: or +# conditions: +# - condition: template +# value_template: >- +# {{ trigger.payload_json["before"]["stationary"] != +# 'true' }} +# - condition: template +# value_template: >- +# {{ trigger.payload_json["after"]["stationary"] != 'true' +# }} + - action: script.person_detect_actions + alias: Send high priority notification to devices + data: + send_to_sm_n986b: "true" + send_to_sm_x115: "true" + send_to_nokia_c20: "true" + send_to_nova_4k: "false" + 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 + default: [] +mode: parallel +max: 10 diff --git a/home-assistant/Person detect Actions.yml b/home-assistant/Person detect Actions.yml index 1264ac4..6b293c0 100644 --- a/home-assistant/Person detect Actions.yml +++ b/home-assistant/Person detect Actions.yml @@ -8,89 +8,82 @@ variables: sequence: - if: - condition: template - value_template: "{{ camera == 'Driveway' }}" + value_template: "{{ states('input_boolean.enable_person_detect_alarm') == 'on' }}" + alias: Person detect alarm is enabled then: - - variables: - relay_floodlight: switch.sthome_ut1_floodlights_backyard - counter: counter.driveway_person_alarm_counter - else: - if: - condition: template - value_template: "{{ camera == 'Patio' }}" + value_template: "{{ camera == 'Driveway' }}" then: - variables: - relay_floodlight: switch.sthome_ut1_floodlights_backyard - counter: counter.patio_person_alarm_counter + counter: counter.driveway_person_alarm_counter else: - if: - condition: template - value_template: "{{ camera == 'Westwall' }}" + value_template: "{{ camera == 'Patio' }}" then: - variables: - relay_floodlight: switch.sthome_ut1_floodlights_backyard - counter: counter.west_wall_person_alarm_counter + counter: counter.patio_person_alarm_counter else: - if: - condition: template - value_template: "{{ camera == 'Eastwall' }}" + value_template: "{{ camera == 'Westwall' }}" then: - variables: - relay_floodlight: switch.sthome_ut1_floodlights_backyard - counter: counter.east_wall_person_alarm_counter + counter: counter.west_wall_person_alarm_counter else: - if: - condition: template - value_template: "{{ camera == 'Backyard' }}" + value_template: "{{ camera == 'Eastwall' }}" then: - variables: - relay_floodlight: switch.sthome_ut1_floodlights_backyard - counter: counter.backyard_person_alarm_counter + counter: counter.east_wall_person_alarm_counter else: - - stop: Unknown camera - - if: - - condition: template - value_template: "{{ importance == \"max\" }}" - then: - action: counter.increment - target: - entity_id: "{{ counter }}" - data: {} - - if: - - condition: template - value_template: "{{ importance == \"max\" }}" - then: - sequence: - - action: switch.turn_on + - if: + - condition: template + value_template: "{{ camera == 'Backyard' }}" + then: + - variables: + counter: counter.backyard_person_alarm_counter + else: + - stop: Unknown camera + - if: + - condition: template + value_template: "{{ importance == \"max\" }}" + then: + action: counter.increment target: - entity_id: "{{ relay_floodlight }}" + entity_id: "{{ counter }}" data: {} - - action: switch.turn_on - target: - entity_id: "{{ relay_alarm }}" - data: {} - - action: script.send_dynamic_notification_to_devices - data: - send_to_sm_n986b: "{{ send_to_sm_n986b }}" - send_to_nova_4k: "{{ send_to_nova_4k }}" - id: "{{ id }}" - title: "{{ title }}" - message: "{{ message }}" - notifTag: "{{ notifTag }}" - notifIcon: "{{ notifIcon }}" - group: "{{ group }}" - channel: "{{ channel }}" - importance: "{{ importance }}" - base_url: "{{ base_url }}" - image: "{{ image }}" - video: "{{ video }}" - when: "{{ when }}" - enabled: true + - if: + - condition: template + value_template: "{{ importance == \"max\" }}" + then: + sequence: + - action: switch.turn_on + target: + entity_id: "{{ relay_alarm }}" + 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 }}" + message: "{{ message }}" + notifTag: "{{ notifTag }}" + notifIcon: "{{ notifIcon }}" + group: "{{ group }}" + channel: "{{ channel }}" + importance: "{{ importance }}" + base_url: "{{ base_url }}" + image: "{{ image }}" + video: "{{ video }}" + when: "{{ when }}" + enabled: true fields: - send_to_sm_n986b: - selector: - boolean: null - name: send_to_sm_n986b - required: false send_to_nova_4k: selector: boolean: null diff --git a/home-assistant/Send Dynamic Notification To All Devices.yml b/home-assistant/Send Dynamic Notification To All Devices.yml index 485fa66..381cae3 100644 --- a/home-assistant/Send Dynamic Notification To All Devices.yml +++ b/home-assistant/Send Dynamic Notification To All Devices.yml @@ -4,12 +4,12 @@ sequence: image_url: "{{ base_url~image }}" video_url: "{{ base_url~video }}" - parallel: - - sequence: - - if: - - condition: template - value_template: "{{ send_to_sm_n986b | default(True) }}" - alias: Send to SM_N986B? - then: + - if: + - condition: template + value_template: "{{ send_to_sm_n986b | default(True) }}" + alias: Send to SM_N986B? + then: + - parallel: - data: message: "{{ message }}" title: "{{ title }}" @@ -41,118 +41,95 @@ sequence: uri: "{{ video_url }}" action: notify.mobile_app_sm_n986b alias: "Notify: Send message to SM_N986B" - - if: - - condition: template - value_template: '{{ send_to_nokia_c20 | default(True) }}' - then: - - sequence: - - 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 - - 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) }}' - then: - - sequence: - - 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 - - action: counter.increment - target: - entity_id: counter.sm_x115_notification_counter - data: {} - alias: Increment SM_X115 notification counter - - # - data: - # message: '{{ message }}' - # title: '{{ title }}' - # data: - # url: '{{ video_url }}' - # tag: '{{ notifTag }}' - # group: '{{ group }}' - # attachment: - # url: '{% if (importance == "default" and video != null) -%} {{ video }} {%- else -%} {{ image_url }} {%- endif %}' - # push: - # interruption-level: '{% if importance == "max" -%} time-sensitive {%- else -%} passive {%- endif %}' - # must test above data sent to notify.mobile_app_sm_n986b and check whether the following data is needed - # actions: - # - action: URI - # title: Open Image - # uri: https://home-assistant.sthome.org/api/frigate/notifications/{{ id }}/thumbnail.jpg?format=android - # action: notify.mobile_app_sm_n986b - # - if: - # - condition: template - # value_template: '{{ states("media_player.nova4k") != "off" }}' - # - condition: template - # value_template: '{{ importance == "max" }}' - # then: - # - data: - # message: '{{ message }}' - # title: '{{ title }}' - # data: - # fontsize: medium - # image: - # url: https://frigate.sthome.org/api/events/{{id}}/snapshot.jpg - # action: notify.nova_4k + - 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 mode: parallel icon: mdi:bell-ring-outline max: 10 diff --git a/home-assistant/configuration.yml b/home-assistant/configuration.yml new file mode 100644 index 0000000..ed969c7 --- /dev/null +++ b/home-assistant/configuration.yml @@ -0,0 +1,106 @@ +# Configure a default setup of Home Assistant (frontend, api, etc) +default_config: +# Text to speech +tts: + - platform: google_translate +group: !include groups.yaml +automation: !include automations.yaml +script: !include scripts.yaml +scene: !include scenes.yaml +recorder: + purge_keep_days: 30 + commit_interval: 3 + db_url: "postgresql://home-assistant:M1ykv2TSzPD4c7lq4ixyBIl/q9kf4NyVIziQ3Yzansst4kZx@home-assistant_postgresql:5432/home-assistant?client_encoding=utf8" +http: + use_x_forwarded_for: true + trusted_proxies: + - 10.255.224.0/20 + +homeassistant: + customize_domain: + + automation: + templates: &state_color # <-- define a yaml anchor here + icon_color: > + if (state === 'on') return 'green'; + return 'steelblue'; + +# or use a theme variable: + +# templates: &state_color +# icon_color: > +# if (state === 'on') return 'var(--primary-color)'; +# return 'green'; #'steelblue'; + + sensor: + templates: + <<: *state_color # <-- and use it on any other entity in this file + + binary_sensor: + templates: + icon_color: > + if (state === 'on') return 'firebrick'; + return 'steelblue'; +# <<: *state_color # <-- and use it on any other entity in this file + + input_boolean: + templates: *state_color # <-- or even shorter like this + + switch: + templates: + icon: > + if (state === 'on') return 'mdi:toggle-switch'; + return 'mdi:toggle-switch-off'; + <<: *state_color + +template: + - binary_sensor: + - name: Sun + state: > + {{ is_state("sun.sun", "above_horizon") }} + icon: > + {% if is_state("binary_sensor.sun_up", "on") %} + mdi:weather-sunset-up + {% else %} + mdi:weather-sunset-down + {% endif %} + - unique_id: alarm_triggered_gui + name: Alarm triggered + state: > + {{ 'on' if states('sensor.sthome_ut1_alarm_signal')|float > 1.5 else 'off' }} + icon: > + {%- if this.state == 'on' -%} + mdi:alarm-light + {%- elif this.state == 'off' -%} + mdi:alarm-light-outline + {%- else -%} + mdi:alarm-light-off-outline + {%- endif -%} + - unique_id: zone_4_triggered_gui + name: Zone 4 triggered + state: "{{ states('switch.sthome_ut1_alarm_zone_4') }}" + icon: > + {%- if this.state == 'on' -%} + mdi:alarm-light + {%- elif this.state == 'off' -%} + mdi:alarm-light-off + {%- else -%} + mdi:alarm-light-off-outline + {%- endif -%} + - unique_id: gate_lock_gui + name: Gate Lock + state: "{{ states('switch.sthome_ut4_relay_5') }}" + icon: > + {%- if this.state == 'on' -%} + mdi:lock-open + {%- elif this.state == 'off' -%} + mdi:lock + {%- else -%} + mdi:lock-off + {%- endif -%} + +#notify: +# - platform: androidtv +# name: Android TV +# host: 10.0.0.71 +# - sensor: \ No newline at end of file diff --git a/home-assistant/dashboard.yml b/home-assistant/dashboard.yml new file mode 100644 index 0000000..852d338 --- /dev/null +++ b/home-assistant/dashboard.yml @@ -0,0 +1,415 @@ +{ + "version": 1, + "minor_version": 1, + "key": "lovelace.dashboard_sthome", + "data": { + "config": { + "title": "Home", + "resources": [ + { + "url": "/local/button-card.js", + "type": "module" + } + ], + "views": [ + { + "path": "default_view", + "title": "Home", + "cards": [ + { + "type": "weather-forecast", + "entity": "weather.forecast_home", + "show_forecast": true + }, + { + "type": "entity-filter", + "entities": [ + "device_tracker.sm_n986b", + "device_tracker.nokia_c20", + "device_tracker.sm_x115" + ], + "state_filter": [ + "home" + ], + "card": { + "type": "glance", + "title": "People that are home" + } + }, + { + "type": "media-control", + "entity": "media_player.smart_tv" + }, + { + "type": "entities", + "entities": [ + { + "entity": "switch.sthome_ut1_relay_2", + "name": "Relay 2" + }, + { + "entity": "switch.sthome_ut1_relay_3", + "name": "Relay 3" + }, + { + "entity": "binary_sensor.gate_lock", + "name": "Gate lock" + }, + { + "entity": "switch.sthome_ut4_relay_6", + "name": "Open/Close gate" + } + ], + "title": "House" + }, + { + "type": "entities", + "entities": [ + { + "entity": "counter.backyard_person_alarm_counter" + }, + { + "entity": "counter.driveway_person_alarm_counter" + }, + { + "entity": "counter.east_wall_person_alarm_counter" + }, + { + "entity": "counter.patio_person_alarm_counter" + }, + { + "entity": "counter.west_wall_person_alarm_counter" + }, + { + "entity": "counter.sm_n986b_notification_counter" + }, + { + "entity": "counter.sm_x115_notification_counter" + }, + { + "entity": "counter.nokia_c20_notification_counter" + } + ], + "title": "Counters" + }, + { + "type": "grid", + "square": false, + "columns": 1, + "cards": [ + { + "type": "entities", + "entities": [ + "remote.xiaomi_tv_box" + ], + "title": "Xiaomi TV Box" + }, + { + "type": "media-control", + "entity": "media_player.xiaomi_tv_box_2" + } + ] + }, + { + "type": "grid", + "square": false, + "columns": 1, + "cards": [ + { + "type": "entities", + "entities": [ + "remote.nova" + ], + "title": "NOVA" + }, + { + "type": "media-control", + "entity": "media_player.nova" + } + ] + } + ], + "type": "masonry", + "icon": "mdi:home", + "badges": [ + { + "type": "entity", + "show_name": true, + "show_state": false, + "show_icon": true, + "entity": "binary_sensor.alarm_triggered", + "color": "red", + "name": "Alarm", + "show_entity_picture": false, + "tap_action": { + "action": "navigate", + "navigation_path": "/dashboard-sthome/alarm" + } + } + ] + }, + { + "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": 4, + "subview": true, + "path": "alarm", + "title": "Alarm", + "icon": "mdi:alarm-light", + "sections": [ + { + "type": "grid", + "cards": [ + { + "type": "heading", + "heading": "Settings", + "heading_style": "title" + }, + { + "show_name": true, + "show_icon": true, + "type": "button", + "entity": "input_boolean.enable_person_detect_alarm", + "name": "Enable Camera Alarm" + }, + { + "show_name": true, + "show_icon": true, + "type": "button", + "entity": "input_boolean.notify_nokia_c20", + "show_state": false + }, + { + "show_name": true, + "show_icon": true, + "type": "button", + "entity": "input_boolean.notify_sm_n986b" + }, + { + "show_name": true, + "show_icon": true, + "type": "button", + "entity": "input_boolean.notify_sm_x115" + } + ] + } + ], + "cards": [], + "badges": [ + { + "type": "entity", + "show_name": true, + "show_state": true, + "show_icon": true, + "entity": "binary_sensor.alarm_triggered", + "show_entity_picture": true, + "color": "red", + "name": "Siren" + }, + { + "type": "entity", + "show_name": true, + "show_state": true, + "show_icon": true, + "entity": "binary_sensor.zone_4_triggered", + "color": "red", + "name": "Zone 4" + }, + { + "type": "entity", + "show_name": true, + "show_state": true, + "show_icon": true, + "entity": "switch.sthome_ut1_floodlights_backyard", + "state_content": "state", + "show_entity_picture": true, + "icon": "mdi:light-flood-down", + "name": "Backyard" + }, + { + "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" + } + ], + "header": { + "card": { + "type": "markdown", + "text_only": true, + "content": "# House Alarm\n" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/home-assistant/frigate events.xlsx b/home-assistant/frigate events.xlsx new file mode 100644 index 0000000..e7dece2 Binary files /dev/null and b/home-assistant/frigate events.xlsx differ diff --git a/home-assistant/input_boolean.json b/home-assistant/input_boolean.json new file mode 100644 index 0000000..84810c8 --- /dev/null +++ b/home-assistant/input_boolean.json @@ -0,0 +1,29 @@ +{ + "version": 1, + "minor_version": 1, + "key": "input_boolean", + "data": { + "items": [ + { + "id": "enable_person_detect_alarm", + "name": "Enable Person Detect Alarm", + "icon": "mdi:run" + }, + { + "id": "notify_sm_n986b", + "name": "Notify SM_N986B", + "icon": "mdi:cellphone-text" + }, + { + "id": "notify_sm_x115", + "name": "Notify SM_X115", + "icon": "mdi:tablet" + }, + { + "id": "notify_nokia_c20", + "name": "Notify Nokia C20", + "icon": "mdi:cellphone-text" + } + ] + } +} \ No newline at end of file diff --git a/home-assistant/templates.yml b/home-assistant/templates.yml deleted file mode 100644 index 119cc25..0000000 --- a/home-assistant/templates.yml +++ /dev/null @@ -1,36 +0,0 @@ -template: - - binary_sensor: - - name: Sun Up - state: > - {{ is_state("sun.sun", "above_horizon") }} - icon: > - {% if is_state("binary_sensor.sun_up", "on") %} - mdi:weather-sunset-up - {% else %} - mdi:weather-sunset-down - {% endif %} -#notify: -# - platform: androidtv -# name: Android TV -# host: 10.0.0.71 - - sensor: - - name: alarm_triggered_gui - state: "{{ states('switch.sthome_ut1_alarm_zone_4') }}" - icon: > - {%- set state = states('switch.sthome_ut1_alarm_zone_4') -%} - {%- if state == 'on' -%} - mdi:alarm-light - {%- elif state == 'off' -%} - mdi:alarm-light-off - {%- endif -%} - - name: gate_lock_gui - state: "{{ states('switch.sthome_ut4_relay_5') }}" # should change to binary sensor - icon: > - {%- set state = states('switch.sthome_ut4_relay_5') -%} - {%- if state == 'on' -%} - mdi:lock-open - {%- elif state == 'off' -%} - mdi:lock - {%- else -%} - mdi:lock-off - {%- endif -%}