Trying to automate my A/C to turn on if it colder than 17°C after 5:30am, but the automation fails if the temp falls below 17°C before 5:30am.
Is there a better way to do this.
As I can see it failed due to the time being 3:47 am and not after 05:30.
Format your attached code with </> otherwise it is difficult to see if you have any faults in that.
I think the conditions looks OK so that makes be think about the trigger before it. Try removing the above: 0 and see if that works. I checked all my similar automations and they just use either above or below so it might be worth a try.
As Mark noted, the condition should work anyways but you didn’t use the ”and” for anything so I removed it. As I said in my first answer, make sure the condition is met.
The trigger seems ok, and is also triggered according to the trace but the condition is not met.
Edit: As said below the automation will not trigger again if temp goes below 17 before 05:30 and stays below. I would change according to the suggestions below.
The automation is logically flawed given what you want, but it works exactly as it should as per your description in the first post. What you need to do is to change from a numeric_state to a state trigger so that it triggers in all state changes. Then put the temperature as a condition with the time condition.
Also, do away with the device calls and use normal service calls.
EDIT: As @koying said (beat me to it). I missed the time trigger. You should add that too.