Hi everybody,
I started not long time ago configuring my home assistant.
I really like it but I feel a little lost during selecting automations for the scene I generated.
Basically the big question for me is:
I would like to write an automation for controlling lights. actually my configuration is something like this:
- alias: 'Media player playing Light 1'
trigger:
- platform: state
entity_id: media_player.kodi
to: 'playing'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition:
after: '21:00:00'
before: '19:00:00'
action:
service: scene.turn_on
entity_id: scene.Movies_light1
- alias: 'Media player playing Light 2'
trigger:
- platform: state
entity_id: media_player.kodi
to: 'playing'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: scene.turn_on
entity_id: scene.Movies_light2
As you can see the code is mostly the same, it is working but… well I don’t like to repeat myself.
The condition for light 1 basically is a “if I am having dinner while watching tv don’t turn off the light on the table”.
Ideally I would write something like:
- alias: 'Media player playing Light 1'
trigger:
- platform: state
entity_id: media_player.kodi
to: 'playing'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
- condition:
after: '21:00:00'
before: '19:00:00'
service: scene.turn_on
entity_id: scene.Movies_light1
action:
service: scene.turn_on
entity_id: scene.Movies_light2
but I don’t think is something valid and I don’t see any example that do something like this.
can you confirm it is not possible?
or can you point me to some alternatives?