#Sunset/sunrise and hour

1 messages Β· Page 1 of 1 (latest)

timber anvil
#

Hi!
I'm new on HA (just few days old πŸ˜€ ) I have an light/motion automation and I want it to run at 30 min before sunset and stop at 23:30. Now I have after sunset -00:30 and before sunrise -08:00. And didn't stop at 23:30 but it not end at 23:30. Can I combine sunset and hour ?
Let's say to run before sunset -00:30 and stop at 23:30. I don't want to make time related I want it to run at sunset

cold slate
#

You mean in your conditions? You’d just have two conditions. One for the sun, and another for the time.

timber anvil
#

Now I have one condition for tsun and 2 for person location and main light switch. Do you mean that I have to make one condition for the sun and one for the time separately?

cold slate
#

Yup. One for the sun and one for time.

timber anvil
#

Just tested, I have set-up time to 22:36 and still run.

cold slate
#

Post the YAML for your automation.

fair impBOT
#

Please use a code share site to share code or logs, for example:

Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.

timber anvil
#

I want this automation to work at 30min before sunset and end at 23:30

sturdy trench
#

Are you pressing the RUN button in the GUI? That'll skip the conditions

timber anvil
#

The automation work very good: it start on sunset, light up on motion triggered, turn off light after 1 min (if no motion) but it run also after 23:30 πŸ˜€

sturdy trench
timber anvil
timber anvil
#

πŸ€” .. now I see the code... I guess I have to change the time check condition from "or" to "and" ... 😳

#

gonna test...

sturdy trench
#

Yes, it now has to be either after sunset (minus 30 minutes) or before 23:30

#

You can remove the entire weekday part if you want it on every day

timber anvil
#

πŸ‘ It work's . I've changed building block condition from or to and... Thank you both... πŸ˜€

sturdy trench
#

Great, can you please mark this thread as resolved, by adding the tag?

timber anvil
sturdy trench