Skip to content

Commit

Permalink
handle second bathroom light
Browse files Browse the repository at this point in the history
  • Loading branch information
yp87 committed Dec 15, 2024
1 parent c13ce2e commit c9dddac
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
36 changes: 36 additions & 0 deletions hass/automation/light.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

33 changes: 32 additions & 1 deletion hass/automation/zwave.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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


4 changes: 4 additions & 0 deletions hass/groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c9dddac

Please sign in to comment.