Browse Source

Changes to lights, notify device and birthdays

Joachim M. Giæver 1 year ago
parent
commit
37e310c307

+ 10 - 6
General/birthdays.yaml

@@ -25,7 +25,8 @@ script:
 # Require: https://github.com/jmgiaever/home-assistant-public-config/blob/master/General/notify_device.yaml
 # Uses: https://github.com/tybritten/ical-sensor-homeassistant
 automation:
-  - alias: "Birthday: Notify on birthday!"
+  - id: "birthday_notify"
+    alias: "Birthday: Notify on birthdays"
     trigger: 
       - platform: calendar
         event: start
@@ -52,13 +53,14 @@ automation:
           rexp_lang: '.*?lang:?\s*([a-zA-Z\_]+)'
           langs:
             no_nb: '+47' # If no lang, check phone number and set `no_nb` as lang if necessary
-          notify_devices: >-
-            {{ state_attr('group.owners_notify_devices', 'entity_id')|list }}
+          notify_devices: >- #joachims_notify_devices
+            {{ state_attr('group.notify_user_devices', 'entity_id')|list }}
       - repeat: # Loop thorugh all the birthdays
           for_each: "{{ birthdays }}"
           sequence:
             - variables:
                 name: "{{ (states(repeat.item).split('-')[:-1]|join('-')|trim).split(' ')[0]|lower|title }}"
+                full_name: "{{ states(repeat.item).split('-')[:-1]|join('-')|trim }}"
                 details: '{{ state_attr(repeat.item, "description")|striptags }}'
                 phones: >-
                   {{ details|regex_findall(rexp_phone, ignorecase=true) }}
@@ -89,9 +91,9 @@ automation:
                   title: "It is {{ name }}'s birthday. 🎁"
                   message: >-
                     {% if age is not false %}
-                      {{ name }} is turning {{ age }} today.
+                      {{ full_name }} is turning {{ age }} today.
                     {% else %}
-                      {{ name }} is getting one year older today.
+                      {{ full_name }} is getting one year older today.
                     {% endif %}
                     Send your congratulations 🎉 to let him/her
                     know that you appreciate them. 🥳
@@ -102,12 +104,14 @@ automation:
                       - action: DISMISS
                         title: Dismiss 💩
                     color: '#ebb1bb'
+                    persistent: true
                     group: "birthday-notifications"
+                    tag: "birthday-notification-{{ full_name|regex_replace(find='([^a-z]+)', replace='-', ignorecase=true)|lower }}"
                     channel: "Birthdays"
                     importance: high
                     icon_url: /local/icons/notifications/cake.png
                     notification_icon: "mdi:cake"
-                  
+
             - repeat: # Loop through all the devices that will be notified.
                 for_each: "{{ notify_devices }}"
                 sequence:

+ 1 - 0
General/notify_device.yaml

@@ -27,6 +27,7 @@ script:
           Respects «Days» too in YAML mode.
         selector:
           duration:
+    mode: parallel
     max: 200
     use_blueprint:
       path: notify_user.yaml

+ 2 - 1
Guest room/guestroom_dashboard.yaml

@@ -10,6 +10,7 @@ automation:
         - 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
+        - media_player.guest_room_left_display
+        - media_player.guest_room_right_display
         dashboard_path: lovelace
         dashboard_view: guest-bedroom

+ 4 - 4
Hallway/hallway_lights.yaml

@@ -11,10 +11,10 @@ automation:
           - 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
+        #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

+ 6 - 5
Inner living room/inner_living_room_lights.yaml

@@ -7,14 +7,15 @@ automation:
       input:
         trigger_sensors:
           - binary_sensor.inner_living_room_motion_sensor_home_security_motion_detection
+          #- binary_sensor.test_on_off_bool
         synced_lights:
           - light.inner_living_room_chandelier_light
-        illuminance_sensors:
-          - sensor.inner_living_room_motion_sensor_illuminance
-        illuminance_threshold: 10
+        #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
+          # - wait_template: "{{ is_state_attr('automation.living_room_motion_active_lights', 'current', 0) }}"
+        wait_actions_before_dim: []
         delay: 15

+ 3 - 3
Kitchen/kitchen_lights.yaml

@@ -11,9 +11,9 @@ automation:
           - light.kitchen_counter_lights
           - light.kitchen_dining_table_light
           - light.kitchen_stairway_lights
-        illuminance_sensors:
-          - sensor.kitchen_motion_sensor_illuminance
-        illuminance_threshold: 10
+        #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

+ 5 - 5
Living room/living_room_lights.yaml

@@ -10,12 +10,12 @@ automation:
         synced_lights:
           - light.living_room_chandelier_light
           - light.living_room_piano_light
-        illuminance_sensors:
-          - sensor.living_room_motion_sensor_illuminance
-        illuminance_threshold: 10
+        #illuminance_sensors:
+        #  - sensor.living_room_motion_sensor_illuminance
+        #illuminance_threshold: 10
         after_wait_actions:
           - wait_template: "{{ is_state('input_boolean.housekeeping_mode', 'off') }}"
+        wait_actions_before_dim:
           # 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
+          - wait_template: "{{ is_state_attr('automation.inner_living_room_motion_active_lights', 'current', 0) }}"
         delay: 15