From 09d254e6752f68a672e07f3c7c8c5ac1499640b3 Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Sat, 30 Jan 2021 20:05:57 +0200 Subject: [PATCH] Initial Mercury Setup --- .../hallway_dashboard/at_home_dashboard.yaml | 15 +--- .../coming_home_dashboard.yaml | 8 +- .../home_dashboard/living_room_dashboard.yaml | 15 +--- .../home_dashboard/main_dashboard.yaml | 13 ++-- config/lovelace/popup_cards.yaml | 11 +-- .../packages/devices/living_room/camera.yaml | 75 ++++--------------- config/packages/routines/coming_home.yaml | 3 +- config/packages/routines/leaving_home.yaml | 3 +- 8 files changed, 34 insertions(+), 109 deletions(-) diff --git a/config/lovelace/hallway_dashboard/at_home_dashboard.yaml b/config/lovelace/hallway_dashboard/at_home_dashboard.yaml index ad8ced9..8f6f964 100644 --- a/config/lovelace/hallway_dashboard/at_home_dashboard.yaml +++ b/config/lovelace/hallway_dashboard/at_home_dashboard.yaml @@ -101,6 +101,10 @@ cards: entity: input_boolean.guest_mode tap_action: action: toggle + - type: custom:button-card + template: [small, with_state_background] + entity: switch.mercury_home_mode + name: Mercury Home - type: horizontal-stack cards: @@ -134,13 +138,6 @@ cards: variables: state_indicator_id: automation.titanium_turn_off_when_idle - - type: custom:button-card - template: [small, with_state_background] - entity: sensor.synology_type_volume_1 - name: Platinum - icon: mdi:nas - tap_action: - action: more-info - type: custom:button-card template: [small, with_state_background] entity: binary_sensor.pi_hole_enabled @@ -165,10 +162,6 @@ cards: name: "Kitchen" - type: horizontal-stack cards: - - type: custom:button-card - template: [small, with_state_background] - entity: switch.camera - name: Camera - type: custom:button-card template: [small, with_state_background, with_state_indicator] entity: fan.philips_airpurifier diff --git a/config/lovelace/hallway_dashboard/coming_home_dashboard.yaml b/config/lovelace/hallway_dashboard/coming_home_dashboard.yaml index 3794bd6..064632d 100644 --- a/config/lovelace/hallway_dashboard/coming_home_dashboard.yaml +++ b/config/lovelace/hallway_dashboard/coming_home_dashboard.yaml @@ -104,6 +104,10 @@ cards: entity: input_boolean.guest_mode tap_action: action: toggle + - type: custom:button-card + template: [small, with_state_background] + entity: switch.mercury_home_mode + name: Mercury Home - type: custom:button-card template: small entity: media_player.living_room_tv @@ -146,10 +150,6 @@ cards: template: [radiator_button, small] entity: climate.kitchen_radiator_mode name: "Kitchen" - - type: custom:button-card - template: [small, with_state_background] - entity: switch.camera - name: Camera - type: custom:button-card template: [small, with_state_indicator] entity: fan.philips_airpurifier diff --git a/config/lovelace/home_dashboard/living_room_dashboard.yaml b/config/lovelace/home_dashboard/living_room_dashboard.yaml index f1ecca1..3403719 100644 --- a/config/lovelace/home_dashboard/living_room_dashboard.yaml +++ b/config/lovelace/home_dashboard/living_room_dashboard.yaml @@ -94,13 +94,6 @@ entity: switch.titanium variables: state_indicator_id: automation.titanium_turn_off_when_idle - - type: custom:button-card - template: default - entity: sensor.synology_type_volume_1 - name: Platinum - icon: mdi:nas - tap_action: - action: more-info - type: custom:button-card template: default entity: binary_sensor.pi_hole_enabled @@ -134,13 +127,9 @@ title: Camera cards: - type: picture-glance - camera_image: camera.amcrest_camera + camera_image: camera.mercury_amcrest_1 entities: - - entity: camera.amcrest_camera - - entity: switch.camera - show_state: false - - entity: binary_sensor.amcrest_camera_online - show_state: false + - entity: camera.mercury_amcrest_1 - type: vertical-stack diff --git a/config/lovelace/home_dashboard/main_dashboard.yaml b/config/lovelace/home_dashboard/main_dashboard.yaml index 82ba3da..91350cd 100644 --- a/config/lovelace/home_dashboard/main_dashboard.yaml +++ b/config/lovelace/home_dashboard/main_dashboard.yaml @@ -120,13 +120,6 @@ variables: state_indicator_id: automation.titanium_turn_off_when_idle - - type: custom:button-card - template: default - entity: sensor.synology_type_volume_1 - name: Platinum - icon: mdi:nas - tap_action: - action: more-info - type: custom:button-card template: default entity: binary_sensor.pi_hole_enabled @@ -153,7 +146,7 @@ cards: - type: custom:button-card template: default - entity: switch.camera + entity: binary_sensor.camera_state name: Camera - type: custom:button-card template: [default, with_state_indicator] @@ -211,6 +204,10 @@ entity: input_boolean.guest_mode tap_action: action: toggle + - type: custom:button-card + template: default + entity: switch.mercury_home_mode + name: Mercury - type: vertical-stack cards: diff --git a/config/lovelace/popup_cards.yaml b/config/lovelace/popup_cards.yaml index 6aff7a4..ce368fb 100644 --- a/config/lovelace/popup_cards.yaml +++ b/config/lovelace/popup_cards.yaml @@ -71,7 +71,7 @@ sensor.synology_type_volume_1: type: custom:decluttering-card template: platinum_card -switch.camera: +binary_sensor.camera_state: title: Security camera style: *popup_style auto_close: true @@ -80,17 +80,10 @@ switch.camera: cards: - type: picture-entity aspect_ratio: 50% - entity: camera.amcrest_camera + entity: camera.mercury_amcrest_1 show_name: true show_state: true - - type: entities - title: Camera Controls - show_header_toggle: false - entities: - - switch.camera - - binary_sensor.amcrest_camera_online - media_player.kitchen: title: Kitchen Sonos style: *popup_style diff --git a/config/packages/devices/living_room/camera.yaml b/config/packages/devices/living_room/camera.yaml index e4da138..c93f18e 100644 --- a/config/packages/devices/living_room/camera.yaml +++ b/config/packages/devices/living_room/camera.yaml @@ -1,11 +1,11 @@ # https://www.home-assistant.io/integrations/amcrest -amcrest: - - host: !secret amcrest_ip - username: !secret amcrest_username - password: !secret amcrest_password - resolution: low - binary_sensors: - - online +# amcrest: +# - host: !secret amcrest_ip +# username: !secret amcrest_username +# password: !secret amcrest_password +# resolution: low +# binary_sensors: +# - online binary_sensor: - platform: template @@ -14,59 +14,10 @@ binary_sensor: friendly_name: Security camera device_class: safety value_template: >- - {{ is_state('camera.amcrest_camera', 'streaming') or is_state('camera.amcrest_camera', 'recording') }} - -switch: - - platform: template - switches: - camera: - friendly_name: Security camera - value_template: "{{ is_state('binary_sensor.camera_state', 'on') }}" - icon_template: > - {% if is_state('binary_sensor.camera_state', 'on') %} mdi:shield-home - {% else %} mdi:shield-off + {{ is_state('camera.mercury_amcrest_1', 'streaming') or is_state('camera.mercury_amcrest_1', 'recording') }} + icon_template: >- + {% if is_state('camera.mercury_amcrest_1', 'streaming') or is_state('camera.mercury_amcrest_1', 'recording') %} + mdi:video + {% else %} + mdi:video-off {% endif %} - turn_on: - service: script.security_camera_on - turn_off: - service: script.security_camera_off - -script: - security_camera_on: - alias: Security camera · Turn on - sequence: - - service: camera.turn_on - entity_id: camera.amcrest_camera - - service: amcrest.goto_preset - entity_id: camera.amcrest_camera - data: - preset: 1 - - service: amcrest.enable_recording - entity_id: camera.amcrest_camera - - service: amcrest.enable_audio - entity_id: camera.amcrest_camera - - security_camera_off: - alias: Security camera · Turn off - sequence: - - service: amcrest.goto_preset - entity_id: camera.amcrest_camera - data: - preset: 2 - - service: amcrest.disable_recording - entity_id: camera.amcrest_camera - - service: amcrest.disable_audio - entity_id: camera.amcrest_camera - - service: camera.turn_off - entity_id: camera.amcrest_camera - -automation: - # Hack - the switch.camera initial state is wrong (ON) when the server starts. - - alias: Camera · Startup - trigger: - - platform: homeassistant - event: start - action: - - delay: 00:00:10 - - service: switch.turn_off - entity_id: switch.camera diff --git a/config/packages/routines/coming_home.yaml b/config/packages/routines/coming_home.yaml index 61ecffa..6f6997c 100644 --- a/config/packages/routines/coming_home.yaml +++ b/config/packages/routines/coming_home.yaml @@ -16,7 +16,8 @@ script: data: brightness_pct: 100 - service: script.bed_led_on - - service: script.security_camera_off + - service: switch.turn_on + entity_id: switch.mercury_home_mode - service: script.routine_coming_home_after_sunset - service: input_select.select_option entity_id: input_select.hallway_dashboard_mode diff --git a/config/packages/routines/leaving_home.yaml b/config/packages/routines/leaving_home.yaml index 9d28cc8..4cc01f9 100644 --- a/config/packages/routines/leaving_home.yaml +++ b/config/packages/routines/leaving_home.yaml @@ -2,7 +2,8 @@ script: routine_leaving_home: alias: Routine · Leaving home sequence: - - service: script.security_camera_on + - service: switch.turn_off + entity_id: switch.mercury_home_mode - service: homeassistant.turn_off entity_id: