From 6310e39fd9f82948ef2122f19e188dd6ab19dbe7 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 21 Jun 2026 09:30:33 +0200 Subject: [PATCH] add some home cinema automation --- apps/global/virtualsensors.yaml | 40 ++++++++++++++++++++++++------ apps/rooms/living_room.yaml | 43 ++++++++++++++++++++++++++++++--- 2 files changed, 72 insertions(+), 11 deletions(-) diff --git a/apps/global/virtualsensors.yaml b/apps/global/virtualsensors.yaml index 02acde4..34c0d28 100644 --- a/apps/global/virtualsensors.yaml +++ b/apps/global/virtualsensors.yaml @@ -4,24 +4,48 @@ virtual_sensors: priority: 10 # default priority app is 50, since most of them require sensors created by virtual sensors, it's important that virtual_sensors start first sensors: - continuous_condition.is_apple_tv_idle: - time: 5 - conditions: media_player.apple_tv == 'paused' or media_player.apple_tv == 'idle' or media_player.apple_tv == 'standby' - - binary_sensor.is_apple_tv_on: media_player.apple_tv != 'off' binary_sensor.someone_home: person.maeva == 'home' or person.pierre == 'home' - binary_sensor.is_dark_outside: sun.sun == 'below_horizon' + binary_sensor.is_dark_outside: sun.sun == 'below_horizon' # living room sensors value_selector.living_room_ambiance_light: values: 0: - not binary_sensor.living_room_occupancy - - binary_sensor.is_apple_tv_on and not binary_sensor.is_apple_tv_idle + - binary_sensor.projector_on and not binary_sensor.is_vertex2_content_idle - light.living_room - sensor.mezzanine_motion_light_level > 10 - 1: binary_sensor.is_everybody_sleeping + 1: + - binary_sensor.is_everybody_sleeping + - binary_sensor.projector_on 2: true + + # home cinema sensors + binary_sensor.projector_on: switch.living_room_projector_plug and sensor.living_room_projector_plug_power > 50 + continuous_condition.projector_off_for_a_while: + time: 90 + default_value: on + conditions: not binary_sensor.projector_on + # is_apple_tv_on is not reliable as the the apple tv integration sometimes return "paused" when it's actually off, + # you should use is_using_apple_tv instead for most automation + binary_sensor.is_apple_tv_on: media_player.apple_tv != 'off' and media_player.apple_tv != 'idle' + binary_sensor.is_xbox_on: media_player.xbox != 'off' + binary_sensor.is_playstation_on: switch.ps5_136_power + retain_condition.vertex2_has_input_signal: + retain_time: 10 + conditions: sensor.hdfury_vertex2_07_output_tx0 or sensor.hdfury_vertex2_07_audio_output + binary_sensor.is_using_apple_tv: binary_sensor.is_apple_tv_on and binary_sensor.vertex2_has_input_signal and select.hdfury_vertex2_07_port_select_tx0 == 0 + binary_sensor.is_using_xbox: binary_sensor.is_xbox_on and binary_sensor.vertex2_has_input_signal and select.hdfury_vertex2_07_port_select_tx0 == 1 + binary_sensor.is_using_playstation: binary_sensor.is_playstation_on and binary_sensor.vertex2_has_input_signal and select.hdfury_vertex2_07_port_select_tx0 == 2 + + continuous_condition.is_vertex2_content_idle: + time: 5 + conditions: + trigger_conditions: + - binary_sensor.is_using_apple_tv and (media_player.apple_tv == 'paused' or media_player.apple_tv == 'idle' or media_player.apple_tv == 'standby') + # - binary_sensor.is_using_playstation and sensor.ps5_136_activity == 'idle' + # - binary_sensor.is_using_xbox and not binary_sensor.yetanotherpedro_in_game + #p1p sensors binary_sensor.p1p_is_printing: trigger_conditions: sensor.garage_p1p_etat_de_l_impression != 'idle' and sensor.garage_p1p_etat_de_l_impression != 'finish' and sensor.garage_p1p_etat_de_l_impression != 'idle' and sensor.garage_p1p_etat_de_l_impression != 'offline' diff --git a/apps/rooms/living_room.yaml b/apps/rooms/living_room.yaml index a3bb975..2fedde3 100644 --- a/apps/rooms/living_room.yaml +++ b/apps/rooms/living_room.yaml @@ -10,7 +10,7 @@ light_mezzanine_01: - light.living_room light_brightness_pct: - 15: binary_sensor.is_everybody_sleeping + 15: binary_sensor.is_everybody_sleeping or binary_sensor.projector_on 35: binary_sensor.day_interval_night 100: True @@ -26,7 +26,7 @@ light_mezzanine_02: - light.living_room light_brightness_pct: - 5: binary_sensor.is_everybody_sleeping + 5: binary_sensor.is_everybody_sleeping or binary_sensor.projector_on 25: binary_sensor.day_interval_night 100: True @@ -76,4 +76,41 @@ light_living_room: off_events: - - turn_off_all_lights \ No newline at end of file + - turn_off_all_lights + +projection_screen: + module: smartshutter + class: SmartShutter + entity: cover.living_room_projection_screen + close_position: 22 + + close_conditions: # close mean screen down + # when the projector is turn back on, it can happen that this condition is evaluated before projector_off_for_a_while is updated + # so I need to test both binary_sensor.projector_on and not binary_sensor.projector_off_for_a_while + trigger_conditions: binary_sensor.projector_on or not binary_sensor.projector_off_for_a_while + disable_conditions: + - binary_sensor.day_interval_night and not binary_sensor.projector_on + - binary_sensor.is_everybody_sleeping and not binary_sensor.projector_on + +bravia_theatre: + module: smartswitch + class: SmartSwitch + entity: media_player.bravia_theatre + + smart_conditions: binary_sensor.vertex2_has_input_signal + +w4000i: + module: smartswitch + class: SmartSwitch + entity: media_player.benq_w4000i + + smart_conditions: binary_sensor.vertex2_has_input_signal + +mezzanine_curtains: + module: smartshutter + class: SmartShutter + entity: cover.salon_mezzanine_curtain + + 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