It doesn’t matter what the time is as the condition should prevent the toggle if the switch is off. But yes it should be in 24hr clock 23:30:00’ . As for the - I agree it should not be needed as it’s not a list but sometimes it just only seems to work with the -
However I think petro has the problem as it’s probably not triggering at all atm.
So I think what is happening is that HA is not using my condition because it is not identifying the state of the reed sensor. Well, it kind of does. If I click on my switch on my dashboard and the garage is closed it says ‘sensor state off’ and if the garage door is open it says ‘sensor state on’. If I manually trigger my automation when the garage door is open, the garage door will close and visa versa. This is telling me that HA is not actually reading the sensor state because in theory if my garage door was closed and I manually triggered my automation, nothing would happen because the sensor condition of ‘off’ would not be met.
Idk what my options are now. HA CAN see the sensor change because I can see it from the dashboard, but I can’t get the automation to work with it.
I did a bit more testing and my results are interesting. HA detects the ‘on’ state of the sensor just fine. If I set my state condition to ‘on’ it behaves accordingly, but obviously backwards. What’s happening is that HA is ignoring my condition state of ‘off’ and treating it as ‘on’. Essentially, if my garage door is open, it triggers to shut it and if my garage door is closed when the trigger fires, the garage door opens instead of the condition stopping the trigger.
I think I finally nailed down what’s going on. HA can’t determine what the state actually is, it’s all confused. If you look at the screenshot, it thinks the off state is on. I THINK I have to fix this using templates, but I don’t fully understand how all of that works. Any suggestions to get HA to register the states correctly? I wouldn’t mind having an ‘open’ and ‘closed’ state instead since this is a garage door.
Could you show a screenshot like the one above, but then with the states when the door is closed? Then we can see the exact difference between the two states, should make it easier to make a template for you.
Edit: I’m also curious as to why your sensor is defined as a ‘Momentary switch’. My first thought was that this is actually a pulse type switch which in only ‘on’ for a very short period.
Keith,
I think I’ve been going off the state of the switch this whole time and not the state of the sensor. Yes, the sensor_state is an attribute and it looks like I’ll need to make a template to make it work in my automation. I have not made templates before, what is required to do that? Do I make a new yaml file?
Everyone, thanks for your help. A great community like this is how everyone moves forward.
With that said, I finally got it working with help from petro. I was ultimately missing the sensor state via a template condition. The sensor state value in my automation had to be ‘off’ instead of ‘on’ though. Setting it to off makes the automation trigger only if the sensor state is off, which means the garage door is open. I’ve pasted my final code below I also used the automation tool provided by HA as it made things easier to ensure proper formatting: