Hello all,
I’ve been using Home Assistant for a few years now and with the move to a house of my own, the need for automation is increasing and has pushed me to my limits. I hope you can help me avoid many probably unnecessarily complicated automations.
I have several shutters in my house that I would like to automate using different “events” throughout the day.
Examples:
When it is bright enough outside, I want the shutters to go up automatically, but only if the floor is occupied by a resident. However, if the sun is shining directly, the shutters should go down again halfway. (And also go up again when the direct sunlight ends).
When the TV comes on, certain shutters should go down again regardless of sunlight and brightness.
So, many different triggers that should affect the state of my shutters:
- brightness outside
- sunlight
- occupancy of the floor
- (sometimes) state of the TV
I started to create an automation for each state change of a trigger, but in the end I have to check the state of all other triggers at the same time for each state change of one of the triggers to determine the correct target state for my shutters. This leads to many very long and confusing automations.
Is there a way to build these automations more simply?
I had first considered if it would be easier to determine the state of the shutter via a variable and set the variable depending on the trigger. But in the end this does not reduce the complexity. On the contrary, this would lead to even more automations.
I am unfortunately at the end with my creativity and hope here a push in the right direction. I would be happy to get more clues for my research to build these automations easier.
Thanks a lot
Alex
Example Automation for TV turns off
alias: Erdgeschoss - Fernseher geht aus
description: ''
trigger:
- platform: device
device_id: 91b4e4c94d2f446611a751515a5f30cd
domain: media_player
entity_id: media_player.samsung_q8_series_65
type: turned_off
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.tageshelligkeit
state: 'off'
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.erdgeschoss_occupancy
state: 'on'
sequence:
- service: light.turn_on
data: {}
target:
entity_id:
- light.stehlampe
- light.lampe_kuche
- service: cover.close_cover
data: {}
target:
entity_id: cover.rolladen_wohnzimmer_fernseher
default:
- service: light.turn_off
data: {}
target:
entity_id:
- light.lampe_kuche
- light.stehlampe
- service: cover.close_cover
data: {}
target:
entity_id: cover.rolladen_wohnzimmer_fernseher
- conditions:
- condition: state
entity_id: input_boolean.tageshelligkeit
state: 'on'
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.erdgeschoss_occupancy
state: 'on'
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.sonnenstand_ostseite
state: 'on'
sequence:
- device_id: 656e3b35f60a8c124288a6b17d87db9d
domain: cover
entity_id: cover.rolladen_wohnzimmer_fernseher
type: set_position
position: 30
- service: light.turn_off
data: {}
target:
entity_id:
- light.stehlampe
- light.lampe_kuche
- conditions:
- condition: state
entity_id: binary_sensor.sonnenstand_ostseite
state: 'off'
sequence:
- device_id: 656e3b35f60a8c124288a6b17d87db9d
domain: cover
entity_id: cover.rolladen_wohnzimmer_fernseher
type: set_position
position: 100
- service: light.turn_off
data: {}
target:
entity_id:
- light.stehlampe
- light.lampe_kuche
default: []
- conditions:
- condition: state
entity_id: binary_sensor.erdgeschoss_occupancy
state: 'off'
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.sonnenstand_ostseite
state: 'on'
sequence:
- device_id: 656e3b35f60a8c124288a6b17d87db9d
domain: cover
entity_id: cover.rolladen_wohnzimmer_fernseher
type: set_position
position: 30
- service: light.turn_off
data: {}
target:
entity_id:
- light.stehlampe
- light.lampe_kuche
- conditions:
- condition: state
entity_id: binary_sensor.sonnenstand_ostseite
state: 'off'
sequence:
- device_id: 656e3b35f60a8c124288a6b17d87db9d
domain: cover
entity_id: cover.rolladen_wohnzimmer_fernseher
type: set_position
position: 0
- service: light.turn_off
data: {}
target:
entity_id:
- light.stehlampe
- light.lampe_kuche
default: []
default: []
default: []
mode: single