I am trying to create a single automation to control my bedside light, currently this is done by means of four different automations, this clutters front end very quickly, I have:
this switches the light on at sunset, off at 23:30, on at 5:30 (only weekdays) and off at sunrise, I would like to combine all these into one automation, but I don’t think homeassistant follows this convention:
Thanks, is there a way of optimizing the four automations into one since they all control my bedside lamp using mostly time as a trigger for on and off.
The on is slightly more complicated, because you want it to turn on only during weekday mornings (you could possibly use the workday sensor instead. I’m using an offset on sunset for the condition here because I’m unsure if at the point the sunset trigger fires the condition sees it as after sunset.
- alias: 'bedside_on'
initial_state: True
trigger:
- platform: sun
event: sunset
- platform: time
at: '05:30:00'
condition:
- condition: or
conditions:
- condition: sun
after: sunset
after_offset: "-00:10:00"
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: switch.turn_on
entity_id: switch.Bedside_Lamp
I think it’s a matter of taste, but I surely prefer a hundred simple automation than a quarter of complicated ones :-). If you think they clutter the UI you can easily hide then using “hide_entity: True”. Most of my automations are hidden.