From dd27cdc952ee08b1391433c2b868297bee9a085c Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 9 Jul 2026 23:14:23 +0200 Subject: [PATCH] Add sleep switch for living room --- apps/global/virtualevents.yaml | 4 +++- apps/rooms/living_room.yaml | 28 +++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/apps/global/virtualevents.yaml b/apps/global/virtualevents.yaml index 80b45e2..94f37c7 100644 --- a/apps/global/virtualevents.yaml +++ b/apps/global/virtualevents.yaml @@ -17,4 +17,6 @@ virtual_events: event_name: turn_off_all_lights event_condition: binary_sensor.is_everybody_sleeping - + turn_off_all_living_room_lights: + event_name: turn_off_all_living_room_lights + event_condition: binary_sensor.is_living_room_sleeping or binary_sensor.projector_on diff --git a/apps/rooms/living_room.yaml b/apps/rooms/living_room.yaml index 2fedde3..6f5a8c6 100644 --- a/apps/rooms/living_room.yaml +++ b/apps/rooms/living_room.yaml @@ -14,6 +14,10 @@ light_mezzanine_01: 35: binary_sensor.day_interval_night 100: True + off_events: + - turn_off_all_lights + - turn_off_all_living_room_lights + light_mezzanine_02: module: smartlight class: SmartLight @@ -30,6 +34,10 @@ light_mezzanine_02: 25: binary_sensor.day_interval_night 100: True + off_events: + - turn_off_all_lights + - turn_off_all_living_room_lights + light_bookshelves: module: smartlight class: SmartLight @@ -77,6 +85,8 @@ light_living_room: off_events: - turn_off_all_lights + - turn_off_all_living_room_lights + projection_screen: module: smartshutter @@ -113,4 +123,20 @@ mezzanine_curtains: close_conditions: trigger_conditions: binary_sensor.projector_on or not binary_sensor.projector_off_for_a_while - disable_conditions: self == 'closed' and (binary_sensor.is_dark_outside or binary_sensor.is_anybody_sleeping) \ No newline at end of file + disable_conditions: self == 'closed' and (binary_sensor.is_dark_outside or binary_sensor.is_anybody_sleeping) + +living_room_sleep_switch: + module: smartswitch + class: SmartSwitch + + entity: input_boolean.living_room_sleeping + + toggle_events: + button_press: + event_name: state_changed + debounce_seconds: 0.5 + event_data: + entity_id: event.living_room_bilresa_button_bouton_2 + new_state: + attributes: + event_type: multi_press_1 \ No newline at end of file