I use a template binary sensor for controlling my garage door and checking its state. The template draws the data from a Shelly 1 with sensor add-on. Two days ago the template stopped working properly. While I’m still able to open and close the garage door, the state however isn’t shown anymore.
I think it’s something with the latest Core update. This is my binary sensor template, that I have in my template.yaml:
The entities are all correct, the Shelly is working fine. It’s just that HA isn’t registering/showing the state anymore and correspondingly doesn’t pass it through correctly to Apple HomeKit with HomeBridge.
position should be a number 0-100, not true/false. I saw the error later, but it says the same thing. The template does not look like legacy to me, and legacy still works for a couple of months. But this should never have worked.
The last release started validating templates, ensuring that each template produces the correct result for the attribute/state. What @Edwin_D is saying is correct. Ultimately this got by in the past erroneously. Even though your template worked, it really didn’t work.
Change the word position: in your YAML to state: and your template entity will work again.
Yes, and the is_state() function that you used to test it returns true or false based on wether it was on or off. Neither true nor false are valid to use as a number for the position. The state does allow for it, and translates it to open or closed. That is why petro’s fix helps. You either supply a numerical position for the slider or a state.