Browse Source

Add some motion detected lights and lovelace cast automations.

Joachim M. Giæver 1 year ago
parent
commit
8693609267

+ 15 - 0
Guest room/guestroom_dashboard.yaml

@@ -0,0 +1,15 @@
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/cast_lovelace_on_motion.yaml
+automation:
+  - id: 'guest_room_dashboard'
+    alias: "Guest room: Cast lovelace on motion detection"
+    description: ''
+    use_blueprint:
+      path: cast_lovelace_on_motion.yaml
+      input:
+        trigger_sensors:
+        - binary_sensor.guest_room_motion_sensor_home_security_motion_detection
+        - binary_sensor.guest_bathroom_motion_sensor_home_security_motion_detection
+        media_devices:
+        - media_player.guest_room_display
+        dashboard_path: lovelace
+        dashboard_view: guest-bedroom

+ 20 - 0
Hallway/hallway_lights.yaml

@@ -0,0 +1,20 @@
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/motion_detected_lights.yaml
+automation:
+  - id: 'hallway_motion_active_lights'
+    alias: "Hallway: Motion active lights"
+    description: ''
+    use_blueprint:
+      path: motion_detected_lights.yaml
+      input:
+        trigger_sensors:
+          - binary_sensor.hallway_motion_sensor_home_security_motion_detection
+          - binary_sensor.hallway_stairway_motion_sensor_home_security_motion_detection
+        synced_lights:
+          - light.hallway_ceiling_lights
+        illuminance_sensors:
+          - sensor.hallway_motion_sensor_illuminance
+          - sensor.hallway_stairway_motion_sensor_illuminance
+        illuminance_threshold: 9
+        after_wait_actions:
+          wait_template: "{{ is_state('input_boolean.housekeeping_mode', 'off') }}"
+        delay: 3

+ 20 - 0
Inner living room/inner_living_room_lights.yaml

@@ -0,0 +1,20 @@
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/motion_detected_lights.yaml
+automation:
+  - id: 'inner_living_room_motion_active_lights'
+    alias: 'Inner living room: Motion active lights'
+    use_blueprint:
+      path: motion_detected_lights.yaml
+      input:
+        trigger_sensors:
+          - binary_sensor.inner_living_room_motion_sensor_home_security_motion_detection
+        synced_lights:
+          - light.inner_living_room_chandelier_light
+        illuminance_sensors:
+          - sensor.inner_living_room_motion_sensor_illuminance
+        illuminance_threshold: 10
+        after_wait_actions:
+          - wait_template: "{{ is_state('input_boolean.housekeeping_mode', 'off') }}"
+          # Our living rooms are «open» between. Wait until motion in both are off to turn off the lights
+          - wait_template: "{{ is_state('binary_sensor.living_room_motion_sensor_home_security_motion_detection', 'off') }}"
+        wait_actions_before_dim: false
+        delay: 15

+ 50 - 0
Kitchen/kitchen_dashboard.yaml

@@ -0,0 +1,50 @@
+input_boolean:
+  kitchen_dashboard:
+    name: "Kitchen: Dashboard"
+  kitchen_trigger_dashboard:
+    name: "Kitchen: Trigger dashboard"
+
+template:
+  - trigger:
+      platform: state
+      entity_id: input_boolean.kitchen_trigger_dashboard
+      to:
+        - "on"
+        - "off"
+    binary_sensor:
+      - name: "Kitchen: Trigger dashboard"
+        state: "{{ true }}"
+        auto_off: 5
+
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/cast_lovelace_on_motion.yaml
+automation:
+  - id: 'kitchen_dashboard'
+    alias: "Kitchen: Cast lovelace on motion detection"
+    description: ''
+    use_blueprint:
+      path: cast_lovelace_on_motion.yaml
+      input:
+        trigger_sensors:
+        - binary_sensor.kitchen_trigger_dashboard
+        - binary_sensor.kitchen_motion_sensor_home_security_motion_detection
+        media_devices:
+        - media_player.kitchen_display
+        dashboard_path: lovelace
+        dashboard_view: "{{ 'kitchen' if is_state('input_boolean.kitchen_dashboard', 'on') else 'home' }}"
+
+  - id: "kitchen_dashboards_toggle"
+    alias: "Kitchen: Toggle dashboard"
+    trigger:
+      platform: state
+      entity_id: input_boolean.kitchen_dashboard
+      to:
+        - "on"
+        - "off"
+    action:
+      - service: media_player.turn_off
+        target:
+          entity_id: media_player.kitchen_display
+      - wait_template: "{{ is_state('media_player.kitchen_display', 'off') }}"
+      - service: input_boolean.toggle
+        target:
+          entity_id: input_boolean.kitchen_trigger_dashboard

+ 20 - 0
Kitchen/kitchen_lights.yaml

@@ -0,0 +1,20 @@
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/motion_detected_lights.yaml
+automation:
+  - id: 'kitchen_motion_active_lights'
+    alias: 'Kitchen: Motion active lights'
+    use_blueprint:
+      path: motion_detected_lights.yaml
+      input:
+        trigger_sensors:
+          - binary_sensor.kitchen_motion_sensor_home_security_motion_detection
+        synced_lights:
+          - light.kitchen_counter_lights
+          - light.kitchen_dining_table_light
+          - light.kitchen_stairway_lights
+        illuminance_sensors:
+          - sensor.kitchen_motion_sensor_illuminance
+        illuminance_threshold: 10
+        after_wait_actions:
+          - wait_template: "{{ is_state('input_boolean.housekeeping_mode', 'off') }}"
+        wait_actions_before_dim: false
+        delay: 15

+ 14 - 0
Laundry room/laundry_room_lights.yaml

@@ -0,0 +1,14 @@
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/motion_detected_lights.yaml
+automation:
+  - id: 'laundry_room_motion_active_lights'
+    alias: 'Laundry room: Motion active lights'
+    use_blueprint:
+      path: motion_detected_lights.yaml
+      input:
+        trigger_sensors:
+          - binary_sensor.laundry_room_motion_sensor_home_security_motion_detection
+        synced_lights:
+          - light.laundry_room_ceiling_light
+        after_wait_actions:
+          wait_template: "{{ is_state('input_boolean.housekeeping_mode', 'off') }}"
+        delay: 3

+ 21 - 0
Living room/living_room_lights.yaml

@@ -0,0 +1,21 @@
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/motion_detected_lights.yaml
+automation:
+  - id: 'living_room_motion_active_lights'
+    alias: 'Living room: Motion active lights'
+    use_blueprint:
+      path: motion_detected_lights.yaml
+      input:
+        trigger_sensors:
+          - binary_sensor.living_room_motion_sensor_home_security_motion_detection
+        synced_lights:
+          - light.living_room_chandelier_light
+          - light.living_room_piano_light
+        illuminance_sensors:
+          - sensor.living_room_motion_sensor_illuminance
+        illuminance_threshold: 10
+        after_wait_actions:
+          - wait_template: "{{ is_state('input_boolean.housekeeping_mode', 'off') }}"
+          # Our living rooms are «open» between. Wait until motion in both are off to turn off the lights
+          - wait_template: "{{ is_state('binary_sensor.inner_living_room_motion_sensor_home_security_motion_detection', 'off') }}"
+        wait_actions_before_dim: false
+        delay: 15

+ 66 - 0
Master bathroom/master_bathroom_lights.yaml

@@ -0,0 +1,66 @@
+switch:
+  - platform: template
+    switches: 
+      master_bathroom_light_automation:
+        friendly_name: "Master bathroom: Light automation"
+        value_template: "{{ is_state('automation.master_bathroom_motion_active_lights', 'on') }}"
+        turn_on:
+          service: automation.turn_on
+          target:
+            entity_id: automation.master_bathroom_motion_active_lights
+        turn_off:
+          service: automation.turn_off
+          target:
+            entity_id: automation.master_bathroom_motion_active_lights
+        icon_template: >-
+          {% if is_state('automation.master_bathroom_motion_active_lights', 'on') %}
+            mdi:motion-sensor
+          {% else %}
+            mdi:motion-sensor-off
+          {% endif %}
+
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/motion_detected_lights.yaml
+automation:
+  - id: 'master_bathroom_motion_active_lights'
+    alias: "Master bathroom: Motion active lights"
+    use_blueprint:
+      path: motion_detected_lights.yaml
+      input:
+        trigger_sensors:
+          - binary_sensor.master_bathroom_motion_sensor_home_security_motion_detection
+        synced_lights:
+          - light.master_bathroom_ceiling_lights
+        after_wait_actions:
+          - wait_template: "{{ is_state('input_boolean.housekeeping_mode', 'off') }}"
+          - if: "{{ not states('sensor.master_bathroom_humidity_change') in ['unavailable', 'unknown'] }}"
+            then:
+              wait_template: "{{ states('sensor.master_bathroom_humidity_change')|int < 0 }}"
+          - choose:
+            - conditions: >
+                {{ states('media_player.master_bathroom_speaker') in ['playing', 'paused', 'idle'] }}
+              sequence:
+                # Wait for media_player to stop before cutting lights
+                - wait_template: >-
+                    {{ is_state('media_player.master_bathroom_speaker', 'playing') }}
+                  timeout: 30
+                - choose:
+                  - conditions: >-
+                      {{ wait.completed }}
+                    sequence:
+                      - wait_for_trigger:
+                        - platform: state
+                          entity_id: media_player.master_bathroom_speaker
+                          to: "off"
+                          for: 30
+                        - platform: state
+                          entity_id: media_player.master_bathroom_speaker
+                          to: "unavailable"
+                          for: 30
+                        - platform: state
+                          entity_id: media_player.master_bathroom_speaker
+                          to: "paused"
+                          for: 60
+                        - platform: state
+                          entity_id: media_player.master_bathroom_speaker
+                          to: "idle"
+                          for: 60

+ 15 - 0
Master bedroom/master_bedroom_dashboard.yaml

@@ -0,0 +1,15 @@
+# Require: https://github.com/jmgiaever/home-assistant-blueprints/blob/master/automation/cast_lovelace_on_motion.yaml
+automation:
+  - id: 'master_bedroom_dashboard'
+    alias: "Master bedroom: Cast lovelace on motion detection"
+    description: ''
+    use_blueprint:
+      path: cast_lovelace_on_motion.yaml
+      input:
+        trigger_sensors:
+        - binary_sensor.master_bedroom_motion_sensor_home_security_motion_detection
+        media_devices:
+        - media_player.master_bedroom_left_display
+        - media_player.master_bedroom_right_display
+        dashboard_path: lovelace
+        dashboard_view: master-bedroom