Martin 3 роки тому
батько
коміт
16501d5bc1
2 змінених файлів з 135 додано та 53 видалено
  1. 30 53
      hass/confs/configuration.yaml
  2. 105 0
      hass/confs/lovelace.json

+ 30 - 53
hass/confs/configuration.yaml

@@ -1,12 +1,16 @@
 # this file goes in ~homeassistant/.homeassistant/
+# scp ~/workspaces/vscode/home-assistance/hass/confs/configuration.yaml homeassistant@hass:~/.homeassistant/
+# scp ~/workspaces/vscode/home-assistance/hass/confs/lovelace.json homeassistant@hass:~/.homeassistant/.storage/lovelace
+# ssh hass
+# sudo systemctl restart home-assistant@homeassistant && sudo journalctl -f -u home-assistant@homeassistant
 
 homeassistant:
   name: Home
-  latitude: 52.1187
-  longitude: 5.0994
-  elevation: 10
+  latitude: 47.1662
+  longitude: 8.5155
+  elevation: 425
   unit_system: metric
-  time_zone: Europe/Dublin
+  time_zone: Europe/Zurich
   # customize: !include customize.yaml
 
 # Configure a default setup of Home Assistant (frontend, api, etc)
@@ -70,47 +74,15 @@ sensor:
 #     enable_websocket: false
 
 script:
-
-  lights_on_partial:
-    sequence:
-      - service: homeassistant.turn_on
-        entity_id: switch.wenzhou_tkb_0
-      - service: homeassistant.turn_on
-        entity_id: switch.wenzhou_tkb_1
-
   lights_on:
     sequence:
       - 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_off:
     sequence:
-      # - 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_off_partial:
-    sequence:
-      - 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_3
 
 automation:
   # - alias: Turn off lights (time, partial)
@@ -130,11 +102,16 @@ automation:
       - service: script.lights_off
 
   - alias: Turn on lights (solar)
-    # 30 min past sunset
     trigger:
-      platform: sun
-      event: sunset
-      offset: "00:30:00"
+      platform: numeric_state
+      entity_id: sun.sun
+      attribute: elevation
+      below: 35
+    # 30 min past sunset
+    # trigger:
+    #   platform: sun
+    #   event: sunset
+    #   offset: "00:30:00"
     # trigger:
     #   platform: time_pattern
     #   hours: '16'
@@ -146,18 +123,18 @@ automation:
     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.aeon_labs_zw100_multisensor_6_burglar state: {{ states('sensor.aeon_labs_zw100_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
@@ -175,7 +152,7 @@ automation:
         entity_id: sensor.solar_angle
         below: 0
     action:
-      - service: script.lights_on_partial
+      - service: script.lights_on
 
   - alias: Turn off lights (no motion)
     initial_state: true

+ 105 - 0
hass/confs/lovelace.json

@@ -0,0 +1,105 @@
+{
+    "version": 1,
+    "key": "lovelace",
+    "data": {
+        "config": {
+            "title": "Home",
+            "views": [
+                {
+                    "path": "default_view",
+                    "title": "Home",
+                    "badges": [
+                        {
+                            "entity": "binary_sensor.updater"
+                        },
+                        {
+                            "entity": "person.martin"
+                        },
+                        {
+                            "entity": "sensor.solar_angle"
+                        },
+                        {
+                            "entity": "sun.sun"
+                        }
+                    ],
+                    "cards": [
+                        {
+                            "type": "entities",
+                            "entities": [
+                                {
+                                    "entity": "script.lights_off"
+                                },
+                                {
+                                    "entity": "script.lights_on"
+                                }
+                            ],
+                            "title": "Script",
+                            "state_color": true
+                        },
+                        {
+                            "type": "entities",
+                            "entities": [
+                                {
+                                    "entity": "automation.turn_on_lights_solar"
+                                },
+                                {
+                                    "entity": "automation.turn_on_lights_motion"
+                                },
+                                {
+                                    "entity": "automation.turn_off_lights_time"
+                                },
+                                {
+                                    "entity": "automation.turn_off_lights_no_motion"
+                                }
+                            ],
+                            "title": "Automations",
+                            "state_color": true
+                        }
+                    ]
+                },
+                {
+                    "title": "2",
+                    "path": "2",
+                    "badges": [],
+                    "cards": [
+                        {
+                            "type": "entities",
+                            "entities": [
+                                {
+                                    "entity": "zwave.aeon_labs_zw090_z_stick_gen5_eu"
+                                }
+                            ],
+                            "title": "Z-Wave",
+                            "state_color": true,
+                            "show_header_toggle": true
+                        },
+                        {
+                            "type": "weather-forecast",
+                            "entity": "weather.home",
+                            "show_forecast": false
+                        },
+                        {
+                            "type": "entities",
+                            "entities": [
+                                {
+                                    "entity": "switch.wenzhou_tkb_0"
+                                },
+                                {
+                                    "entity": "switch.wenzhou_tkb_1"
+                                },
+                                {
+                                    "entity": "switch.wenzhou_tkb_2"
+                                },
+                                {
+                                    "entity": "switch.wenzhou_tkb_3"
+                                }
+                            ],
+                            "title": "Switch",
+                            "state_color": true
+                        }
+                    ]
+                }
+            ]
+        }
+    }
+}