diff --git a/hass/automation/light.yaml b/hass/automation/light.yaml index 6dbaf4c..3557d6a 100644 --- a/hass/automation/light.yaml +++ b/hass/automation/light.yaml @@ -115,3 +115,39 @@ value_template: "{{ wait.trigger is none }}" - service: light.turn_off entity_id: light.second_floor_hallway_light + +- alias: Turn on fred bathroom lights when motion is detected + id: Turn_on_fred_bathroom_lights_when_motion_is_detected + trigger: + - platform: state + entity_id: binary_sensor.second_floor_motion + to: "on" + condition: + - and: + - condition: time + after: '19:00:00' + before: '07:00:00' + - or: + - condition: state + entity_id: light.fred_bathroom_main_light + state: "off" + - condition: state + entity_id: light.fred_bathroom_main_light + attribute: brightness + state: 103 + mode: restart + action: + - service: light.turn_on + data: + entity_id: light.fred_bathroom_main_light + brightness: 103 + - wait_for_trigger: + - platform: state + entity_id: light.fred_bathroom_main_light + timeout: + seconds: 5 + - condition: template + value_template: "{{ wait.trigger is none }}" + - service: light.turn_off + entity_id: light.fred_bathroom_main_light + diff --git a/hass/automation/zwave.yaml b/hass/automation/zwave.yaml index 0ecd9aa..fc826c0 100644 --- a/hass/automation/zwave.yaml +++ b/hass/automation/zwave.yaml @@ -15,6 +15,7 @@ # switch.entrance_light: c63159c0b13882f64616192ab5723bbb # switch.light_front: cc0f80b851b180f1a279a28c960c522d # switch.master_bathroom_fan: 8a48d9a7bc38aaaa6a273c71f800df70 +# light.fred_bathroom_main_light: d4119fed834e0ae4ab2c0217b69769d5 # ------------------------------ - alias: Frederique main light brightness trigger: @@ -169,7 +170,9 @@ variables: light_entity_id: >- {{ device_entities(trigger.event.data.device_id) | first }} - condition: '{{ states(light_entity_id) != "unknown" }}' + condition: >- + {{ states(light_entity_id) != "unknown" and + light_entity_id not in states.group.zwave_dimmers_default_exclude.attributes.entity_id }} action: - service: light.turn_on data: @@ -368,3 +371,31 @@ entity_id: - light.kitchen_main_light - light.upper_stairs_light + +- alias: Fred bathroom main light single click up + id: fred_bathroom_main_light_single_click_up + trigger: + - platform: event + event_type: zwave_js_value_notification + event_data: + device_id: "d4119fed834e0ae4ab2c0217b69769d5" + property_key_name: "001" + value: "KeyPressed" + mode: single + max_exceeded: silent + variables: + brightness: > + {{ 103 if (19 <= now().hour or now().hour < 7) and + is_state('switch.baby_monitor', 'on') else 255 }} + action: + - service: light.turn_on + data: + entity_id: light.fred_bathroom_main_light + brightness: "{{ brightness }}" + - condition: "{{ brightness == 103 }}" + - delay: "00:00:05" + - service: light.turn_off + data: + entity_id: light.fred_bathroom_main_light + + diff --git a/hass/groups.yaml b/hass/groups.yaml index 49458dd..a90939e 100644 --- a/hass/groups.yaml +++ b/hass/groups.yaml @@ -12,6 +12,10 @@ zwave_dimmers_default_low: - light.living_room_main_light - light.salle_de_lecture +zwave_dimmers_default_exclude: + entities: + - light.fred_bathroom_main_light + all_people: entities: - person.yan