2 Commits 584f11687b ... 51a67d618d

Author SHA1 Message Date
  Martin 51a67d618d add new lights; shift motion-detection action to partial lights-on 5 years ago
  Martin 3c96c3c123 enable motion-detection lights 5 years ago
1 changed files with 91 additions and 64 deletions
  1. 91 64
      hass/confs/configuration.yaml

+ 91 - 64
hass/confs/configuration.yaml

@@ -72,19 +72,37 @@ sensor:
 script:
   lights_off:
     sequence:
-      - service: system_log.write
-        data:
-          message: "***** Turning off the lights"
+      # - service: system_log.write
+      #   data:
+      #     message: "***** Turning off the lights"
       - service: homeassistant.turn_off
         entity_id: switch.wenzhou_tkb_0
       - service: homeassistant.turn_off
         entity_id: switch.wenzhou_tkb_1
+      - service: homeassistant.turn_off
+        entity_id: switch.wenzhou_tkb_2
+      - service: homeassistant.turn_off
+        entity_id: switch.wenzhou_tkb_3
 
   lights_on:
     sequence:
-      - service: system_log.write
-        data:
-          message: "***** Turning on the lights"
+      # - service: system_log.write
+      #   data:
+      #     message: "***** Turning on the lights"
+      - service: homeassistant.turn_on
+        entity_id: switch.wenzhou_tkb_0
+      - service: homeassistant.turn_on
+        entity_id: switch.wenzhou_tkb_1
+      - service: homeassistant.turn_on
+        entity_id: switch.wenzhou_tkb_2
+      - service: homeassistant.turn_on
+        entity_id: switch.wenzhou_tkb_3
+
+  lights_on_partial:
+    sequence:
+      # - service: system_log.write
+      #   data:
+      #     message: "***** Turning on the lights"
       - service: homeassistant.turn_on
         entity_id: switch.wenzhou_tkb_0
       - service: homeassistant.turn_on
@@ -99,66 +117,75 @@ automation:
     action:
       - service: script.lights_off
 
-  - alias: Turn on lights (time)
+  - alias: Turn on lights (solar)
+    # 30 min past sunset
     trigger:
-      platform: time_pattern
-      hours: '16'
-      minutes: '00'
+      platform: sun
+      event: sunset
+      offset: "00:30:00"
+    # trigger:
+    #   platform: time_pattern
+    #   hours: '16'
+    #   minutes: '00'
+    # condition:
+    #   - condition: numeric_state
+    #     entity_id: sensor.solar_angle
+    #     below: 0
     action:
       - service: script.lights_on
 
-  # - alias: Log motion detection status
-  #   initial_state: false
-  #   trigger:
-  #     platform: event
-  #     event_type: time_changed
-  #   condition:
-  #     condition: template
-  #     value_template: "{{ now().second % 10 == 0 }}"
-  #   action:
-  #     - service: system_log.write
-  #       data_template:
-  #         message: "sensor.aeotec_multisensor_6_burglar state: {{ states('sensor.aeotec_multisensor_6_burglar') }}"
+  - alias: Log motion detection status
+    initial_state: false
+    trigger:
+      platform: event
+      event_type: time_changed
+    condition:
+      condition: template
+      value_template: "{{ now().second % 10 == 0 }}"
+    action:
+      - service: system_log.write
+        data_template:
+          message: "sensor.aeon_labs_zw100_multisensor_6_burglar state: {{ states('sensor.aeon_labs_zw100_multisensor_6_burglar') }}"
 
-  # - alias: Turn on lights (motion)
-  #   initial_state: true
-  #   trigger:
-  #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
-  #       from: "0"
-  #       to: "8"
-  #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
-  #       from: "3"
-  #       to: "8"
-  #   condition:
-  #     - condition: numeric_state
-  #       entity_id: sensor.solar_angle
-  #       below: 0
-  #   action:
-  #     - service: script.lights_on
+  - alias: Turn on lights (motion)
+    initial_state: true
+    trigger:
+      - platform: state
+        entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
+        from: "0"
+        to: "8"
+      - platform: state
+        entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
+        from: "3"
+        to: "8"
+    condition:
+      - condition: numeric_state
+        entity_id: sensor.solar_angle
+        below: 0
+    action:
+      - service: script.lights_on_partial
 
-  # - alias: Turn off lights (no motion)
-  #   initial_state: true
-  #   trigger:
-  #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
-  #       from: "8"
-  #       to: "0"
-  #       for:
-  #         minutes: 1
-  #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
-  #       from: "3"
-  #       to: "0"
-  #       for:
-  #         minutes: 1
-  #   condition:
-  #     - condition: time
-  #       after: '23:30:00'
-  #       before: '19:00:00'
-  #   action:
-  #     - service: script.lights_off
+  - alias: Turn off lights (no motion)
+    initial_state: true
+    trigger:
+      - platform: state
+        entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
+        from: "8"
+        to: "0"
+        for:
+          minutes: 3
+      - platform: state
+        entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
+        from: "3"
+        to: "0"
+        for:
+          minutes: 3
+    condition:
+      - condition: time
+        after: '00:30:00'
+        before: '08:00:00'
+    action:
+      - service: script.lights_off
 
 
   # - alias: water immersion (weekdays)
@@ -183,11 +210,11 @@ automation:
   #   initial_state: true
   #   trigger:
   #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
+  #       entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
   #       from: "0"
   #       to: "8"
   #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
+  #       entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
   #       from: "3"
   #       to: "8"
   #   action:
@@ -202,13 +229,13 @@ automation:
   #   initial_state: true
   #   trigger:
   #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
+  #       entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
   #       from: "8"
   #       to: "0"
   #       for:
   #         minutes: 2
   #     - platform: state
-  #       entity_id: sensor.aeotec_multisensor_6_burglar
+  #       entity_id: sensor.aeon_labs_zw100_multisensor_6_burglar
   #       from: "3"
   #       to: "0"
   #       for: