I have a few trigger and conditions that i copy and paste a few times,
- alias: turn on room x lights after sunset
trigger:
- platform: sun
event: sunset
offset: "-00:15:00"
- platform: state
entity_id: group.residents
state: 'home'
condition:
condition: and
conditions:
- condition: time
before: '22:55:00'
- condition: and
conditions:
- condition: sun
after: sunset
after_offset: "-00:15:00"
- condition: or
conditions:
- condition: state
entity_id: input_boolean.other_on_vacation
state: 'on'
- condition: state
entity_id: group.residents
state: 'home'
Now this is error prone, if i find a bug i have to fix it in all the places where i used it!
So my idea is to turn this into something like this
reuable_trigger:
sunset_lights_on:
trigger:
- platform: sun
event: sunset
offset: "-00:15:00"
- platform: state
entity_id: group.residents
state: 'home'
condition:
condition: and
conditions:
- condition: time
before: '22:55:00'
- condition: and
conditions:
- condition: sun
after: sunset
after_offset: "-00:15:00"
- condition: or
conditions:
- condition: state
entity_id: input_boolean.other_on_vacation
state: 'on'
- condition: state
entity_id: group.residents
state: 'home'
That then could be used like this
- alias: turn on room x lights after sunset
trigger:
- platform: reuable
entity_id: reuable_trigger.sunset_lights_on
Is there any way to do this currently, if not it would be nice if it was added!