binary_sensor.garagedoorpi state changes from on to off successfully. However, my binary_sensor.garage_door state remains “Closed” and doesn’t change when garagedoorpi does.
Any suggestions?
thanks
Personally, I’d go with @tom_l’s solution. But the reason your template isn’t updating is because you’re checking against the states 'On' and 'Off'. Removing the capital O’s and replacing them with lowercase will make your template work. The second reason your template isn’t working is because binary sensors only accept true/false as an answer. You’re returning ‘closed’ and ‘open’. Both of those in the jinja and python world resolve to TRUE. So even if you fix the states, the template still won’t work as expected. Which is why you should go with @tom_l’s solution.
Whenever you are writing a template, you need to look at the states page. The states page will display the state of any sensor. What you see in the UI is a translated state. That typically means that the UI state isn’t the real state, it’s just a pretty version of the real state or a pretty translated version of the real state.
Is there an expected delay for the template to update? I made the suggested change and when I change my gpio state, binary_sensor.garagedoorpi changes instantly in Lovelace. However, the template doesn’t change states. It remains as “Closed”.
I also noticed that remote_rpi_gpio platform doesn’t support device_class. Seems like a possible enhancement.