Hi guys, just needing some coding help here, I’d like to keep one of my lights on between the hours of 10pm and 5am and up until now I’ve had 2 automations handling this but I would really like just one, here’s what I’ve got so far:
automation:
alias: Turn on Backdoor at 22:00
hide_entity: False
trigger:
platform: time
seconds: ‘/3’
condition:
condition: time
after: ‘17:08:00’
before: ‘17:08:30’
action:
service: light.turn_on
entity_id: light.backdoor
I feel like it has something to do with the light.turn_on part… I thought maybe something like light.payload…
I’m not a coder so I’m not sure, as no errors are thrown and the light does turn on.
You could totally do this in one thing. You’d have to add two triggers, one at your start time and one at your end time. You can leave your condition the same. In your action you’d have to template it so that you can figure if you should turn on or off based on what time it is.
Can you please show me with the code I have provided, or at least give me an idea. I’m not a coder but I’ll figure it out with logic with what you provide haha
@Bahnburner perhaps but for the front end I’d prefer 1 automation to be active to do multiple things than 2
[quote=“HellfireZA, post:5, topic:18888, full:true”]@Bahnburner perhaps but for the front end I’d prefer 1 automation to be active to do multiple things than 2
[/quote]
If your concerned with how they would appear on the front end, you could always combine the automations in a group, hide the group and the automations from the frontend, and then use a template switch to turn the group on and off.