So I’ve got this cover entity I use for my window blinds and it seems the HA developer’s mentality is that a 100 position state on a cover means that it’s 100% open instead of it being 100% closed. Sadly this causes an issue for me where if I click to close my blinds it will run the closing service, moving the number closer to 100 from 0 and even set the state of the cover to closing, only to then hit 100 position and set it’s state to open.
So to rectify this imo flawed design behavior within HA, I’ve tried to make use of a cover template to manually change the state of the template cover to be an inverse of the actual cover using the value_template attribute. Sadly when doing this it becomes impossible to simultaneously use the position_template attribute to retrieve the position updates from the original cover, since the template has some dumb built in feature that makes the position_template automatically overwrite the open, close, true and false states set by default or by the value_template and instead base them off the position of the cover, with of course 0 being closed and 100 being open. Which is the exact issue I was trying to circumvent in the first place.
It legitimately makes no sense to me that they would implement the cover in a way that has your position number count up from 0 to 100, call it “closing” the cover and then the moment it reaches 100 suddenly call that state “open”. Does anyone have an idea as to how I could achieve a cover with 100 position giving a closed state and 0 giving an open state?
IMHO its not a flaw its just the way its implemented. Tasmota also defines 100% as fully open. For me that works just fine and I would have issues if would be the other way round. You could argue that it would be nice if that would be a configuriation option and indeed that’s propably a good idea. So you could create a request for it in the feature request section.
Just to clarify, I don’t believe the 100% fully open or closed state is flawed design. I’d argue the fact that when I click the close button, see the position number rise from 0 → 100 with the entity state “CLOSING” reach the 100 position and then set it’s state to “OPEN”, is flawed design or at the very least lacing in congruity. This is the default behavior in HA for this cover. Additionally having the template also automatically apply this logic kind of defeats part of the purpose of the template, or at the very least reduces it’s flexibility.
For a gate or a window I totally understand that that a 0 position should be a closed state with a 100 position as open. But for a cloth screen that drops down from the ceiling or some curtains sliding closed, having the state be dynamically adjustable regardless of a 100 or 0 position would be a major boon.
I take it from your reply that you don’t know of a way to achieve this functionality through some workaround without it being natively supported? In that case I’ll see about making a feature request.
Curious to know what your use case might be for knowing whether a cover is ‘opening’ or ‘closing’?
Like you, I tried to set this up for my Zemismart Tuya/Zigbee covers using the template cover as they don’t report the ‘opening/closing’ state to HA - and actually the wifi covers report 0% as ‘open’, while the Zigbee covers report 0% as ‘closed’, so this was even more confusing!
But I couldn’t get it to work as you’ve found, and in the end just gave up on the value_template part and decided I could live with just knowing whether each cover was fully open, fully closed, or at a %age position somewhere in between. At least with the template, the % now means the same thing for all my covers.
Is there a scenario I’m missing where it’s helpful to know a cover is momentarily active, and which direction its moving in?
There probably is a use case for knowing which direction the cover is moving in, but that was not my issue. Funny that you mention the difference between the open/closed state 0/100 positions between your different Wifi and zigbee blinds. Another reason to allow users to define this manually.
I currently have a working template that inverts the open/close state of the Cover, but it doesn’t dynamically get the position state from the Tuya Blinds hardware, since using the position_template from the Cover Template in unison with the value_template will overwrite the state behavior of the value_template and instead base it on position again. But if you manually set a position, it will store it and go to that position. If you want me to, I can post it.
Additionally, I made a feature request for this, so please upvote it here: