Selaa lähdekoodia

hass conf for hallway light

Martin 7 vuotta sitten
vanhempi
commit
d90434837c
1 muutettua tiedostoa jossa 183 lisäystä ja 138 poistoa
  1. 183 138
      hass/confs/configuration.yaml

+ 183 - 138
hass/confs/configuration.yaml

@@ -1,16 +1,12 @@
+# this file goes in ~homeassistant/.homeassistant/
+
 homeassistant:
-  # Name of the location where Home Assistant is running
   name: Home
-  # Location required to calculate the time the sun rises and sets
   latitude: 52.1187
   longitude: 5.0994
-  # Impacts weather/sunrise data (altitude above sea level in meters)
   elevation: 0
-  # metric for Metric, imperial for Imperial
   unit_system: metric
-  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
   time_zone: Europe/Dublin
-  # Customization file
   customize: !include customize.yaml
 
 # Configure a default setup of Home Assistant (frontend, api, etc)
@@ -51,68 +47,49 @@ sensor:
       # - dewpointTemperature
 
 
-mqtt:
-  broker: localhost
+# used for snips
+# mqtt:
+#   broker: localhost
 
 #tts:
 #  - platform: google
 
-media_player:
-  - platform: kodi
-    host: tv
-    port: 8080
-    tcp_port: 9090
-    username: kodi
-    password: kodi
-    timeout: 10
-    enable_websocket: false
+# media_player:
+#   - platform: kodi
+#     host: tv
+#     port: 8080
+#     tcp_port: 9090
+#     username: kodi
+#     password: kodi
+#     timeout: 10
+#     enable_websocket: false
 
 script:
-  water_immersion:
-    sequence:
-      - service: system_log.write
-        data_template:
-          message: Test 1 ({{duration}})...
-      - delay: '{{duration}}'
-      - service: system_log.write
-        data:
-          message: Test 2...
-
-
-automation:
-  # - alias: time
-  #   trigger:
-  #     platform: time_pattern
-  #     hours: '1'
-  #     minutes: '*'
-  #   action:
+  # test_function:
+  #   sequence:
+  #     - service: system_log.write
+  #       data_template:
+  #         message: Test 1 ({{duration}})...
+  #     - delay: '{{duration}}'
   #     - service: system_log.write
   #       data:
-  #         message: "time."
+  #         message: Test 2...
 
-  - alias: water immersion (weekdays)
+automation:
+  - alias: Log motion detection status
     initial_state: false
     trigger:
-      - platform: time
-        at: '23:01:00'
+      platform: event
+      event_type: time_changed
     condition:
-      condition: time
-      weekday:
-        - mon
-        - tue
-        - wed
-        - thu
-        - fri
+      condition: template
+      value_template: "{{ now().second % 10 == 0 }}"
     action:
-      - service: script.water_immersion
-        data:
-          duration: '00:00:10'
-
-
-
-
+      - service: system_log.write
+        data_template:
+          message: "sensor.aeotec_multisensor_6_burglar state: {{ states('sensor.aeotec_multisensor_6_burglar') }}"
 
-  - alias: Turn on kitchen light when there is movement
+  - alias: Turn on hallway light (motion)
     initial_state: true
     trigger:
       - platform: state
@@ -126,12 +103,23 @@ automation:
     action:
       - service: system_log.write
         data:
-          message: "***** State to 8 *****"
-      - service: snips.say
+          message: "***** State to 8 -- turn on hallway light"
+      - service: homeassistant.turn_on
+        entity_id: switch.wenzhou_tkb_0
+
+  - alias: Turn off hallway light (midnight timer)
+    trigger:
+      platform: time_pattern
+      hours: '0'
+      minutes: '0'
+    action:
+      - service: system_log.write
         data:
-          text: on, on, on
+          message: "Midnight -- turning off the hallway light"
+      - service: homeassistant.turn_off
+        entity_id: switch.wenzhou_tkb_0
 
-  - alias: Turn off kitchen light 10 minutes after last movement
+  - alias: Turn off hallway light (no motion)
     initial_state: true
     trigger:
       - platform: state
@@ -139,95 +127,152 @@ automation:
         from: "8"
         to: "0"
         for:
-          minutes: 2
+          minutes: 1
       - platform: state
         entity_id: sensor.aeotec_multisensor_6_burglar
         from: "3"
         to: "0"
         for:
-          minutes: 2
+          minutes: 1
+    condition:
+      - condition: time
+        after: '00:00:00'
+        before: '16:00:00'
     action:
       - service: system_log.write
         data:
-          message: "***** State to 0 *****"
-      - service: snips.say
-        data:
-          text: off, off, off
-
-snips:
-intent_script:
-  # hello:
-    # - service: persistent_notification.create
-    #   data:
-    #     message: ":-)"
-    #     title: "Hello Miranda!"
-    #     notification_id: "hello-notification"
-    # action:
-    #   - service: script.kodi_play_artist
-    #     data:
-    #       a: "1"
-    #       b: "2"
-
-  timeNow:
-    action:
-      - service: snips.say
-        data_template:
-          text: >
-            {{now().hour % 12}} {% if now().minute < 10 %}oh{% endif %} {{now().minute}}
-      
-  bye:
-    action:
-      - service: script.water_immersion
-        data:
-          duration: '00:00:10'
+          message: "***** Turning off the hallway light"
+      - service: homeassistant.turn_off
+        entity_id: switch.wenzhou_tkb_0
 
-  playArtist:
-    action:
-      - service: system_log.write
-        data_template:
-          message: >
-            Playing {{artist_name}}...
-      - service: snips.say
-        data_template:
-          text: >
-            Playing {{artist_name}}
-      - service: media_player.play_media
-        data:
-          entity_id: "media_player.kodi"
-          media_content_type: "music"
-          media_content_id: "/mnt/nas/music/misc/15-seconds-of-silence.mp3"
-      - service: media_player.clear_playlist
-        data:
-          entity_id: "media_player.kodi"
-      - service: media_player.kodi_add_to_playlist
-        data_template:
-          entity_id: "media_player.kodi"
-          media_type: "ALBUM"
-          media_name: "ALL"
-          artist_name: >
-            {{artist_name}}
-      - service: media_player.media_next_track
-        data:
-          entity_id: "media_player.kodi"
-      - service: system_log.write
-        data:
-          message: Done.
+  # - alias: water immersion (weekdays)
+  #   initial_state: false
+  #   trigger:
+  #     - platform: time
+  #       at: '23:01:00'
+  #   condition:
+  #     condition: time
+  #     weekday:
+  #       - mon
+  #       - tue
+  #       - wed
+  #       - thu
+  #       - fri
+  #   action:
+  #     - service: script.test_function
+  #       data:
+  #         duration: '00:00:10'
 
-  speakerInterrupt:
-    action:
-      - service: media_player.media_stop
-        data:
-          entity_id: "media_player.kodi"
+  # - alias: Turn on kitchen light when there is movement
+  #   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"
+  #   action:
+  #     - service: system_log.write
+  #       data:
+  #         message: "***** State to 8"
+  #     - service: snips.say
+  #       data:
+  #         text: on, on, on
 
-  nextSong:
-    action:
-      - service: media_player.media_next_track
-        data:
-          entity_id: "media_player.kodi"
+  # - alias: Turn off kitchen light 10 minutes after last movement
+  #   initial_state: true
+  #   trigger:
+  #     - platform: state
+  #       entity_id: sensor.aeotec_multisensor_6_burglar
+  #       from: "8"
+  #       to: "0"
+  #       for:
+  #         minutes: 2
+  #     - platform: state
+  #       entity_id: sensor.aeotec_multisensor_6_burglar
+  #       from: "3"
+  #       to: "0"
+  #       for:
+  #         minutes: 2
+  #   action:
+  #     - service: system_log.write
+  #       data:
+  #         message: "***** State to 0"
+  #     - service: snips.say
+  #       data:
+  #         text: off, off, off
 
-  turnOffTV:
-    action:
-      - service: media_player.kodi_call_method
-        data:
-          entity_id: media_player.kodi
-          method: System.Shutdown
+# snips:
+# intent_script:
+#   hello:
+#     - service: persistent_notification.create
+#       data:
+#         message: ":-)"
+#         title: "Hello Miranda!"
+#         notification_id: "hello-notification"
+#     action:
+#       - service: script.kodi_play_artist
+#         data:
+#           a: "1"
+#   timeNow:
+#     action:
+#       - service: snips.say
+#         data_template:
+#           text: >
+#             {{now().hour % 12}} {% if now().minute < 10 %}oh{% endif %} {{now().minute}}
+#   bye:
+#     action:
+#       - service: script.test_function
+#         data:
+#           duration: '00:00:10'
+#   playArtist:
+#     action:
+#       - service: system_log.write
+#         data_template:
+#           message: >
+#             Playing {{artist_name}}...
+#       - service: snips.say
+#         data_template:
+#           text: >
+#             Playing {{artist_name}}
+#       - service: media_player.play_media
+#         data:
+#           entity_id: "media_player.kodi"
+#           media_content_type: "music"
+#           media_content_id: "/mnt/nas/music/misc/15-seconds-of-silence.mp3"
+#       - service: media_player.clear_playlist
+#         data:
+#           entity_id: "media_player.kodi"
+#       - service: media_player.kodi_add_to_playlist
+#         data_template:
+#           entity_id: "media_player.kodi"
+#           media_type: "ALBUM"
+#           media_name: "ALL"
+#           artist_name: >
+#             {{artist_name}}
+#       - service: media_player.media_next_track
+#         data:
+#           entity_id: "media_player.kodi"
+#       - service: system_log.write
+#         data:
+#           message: Done.
+#   speakerInterrupt:
+#     action:
+#       - service: media_player.media_stop
+#         data:
+#           entity_id: "media_player.kodi"
+#   nextSong:
+#     action:
+#       - service: media_player.media_next_track
+#         data:
+#           entity_id: "media_player.kodi"
+#   turnOffTV:
+#     action:
+#       - service: media_player.kodi_call_method
+#         data:
+#           entity_id: media_player.kodi
+#           method: System.Shutdown
+