I have a shutter that I control via a template switch. When turned on, the switch sets the shutter to a fixed position. Then the switch is turned off, the shutter opens. This works fine, but in the UI the switch behavior could be improved.
When the shutter is fully open and I toggle the switch, the following behavior is observed:
Switch turns on
A few seconds pass
Switch turns off
Many seconds pass
Switch turns on
I use the Somfy API to control my shutter and this causes a delay in cover status updates (since it’s not a local API). And that makes the switch behavior noticeable. Is there a way to fix this?
Not sure what the ‘fully open’ position is, but it seems as though it would be greater than 25.
So, if it’s fully open, the switch would be off, so toggling it would be to turn it on. Optimistically, the switch stays in the on position until the state of the cover changes and the value_template is evaluated again. Moving the cover probably takes some time, so the position goes through states of “fully open - 1”, “fully-open - 2”, etc. The switch’s value_template would evaluate to ‘off’, until it gets to less than 25, at which poinnt it would turn back on again.
I think what makes it weird is that upper bound on the position. You can see how as the cover goes from closed to fully open, the value_template would evaluate to off, then on, and finally off again. That’s really three states and doesn’t really lend itself to a switch, which only has two.
Maybe replace the switch with an input_select like:
I’m kind of with @petro with this one though…It’s probably going to be more trouble than it’s worth, unless you can figure out a new condition that actually only has two states for your cover.
Also, it’s not the sort of state that can change instantaneously like power to a light. It’s going to take time for the cover to move between two different positions. Even the input_select method is going to have a problem with that.
He may be able to template it if his cover has an intermediate state sent to an attribute or the main state. Like “opening” or “closing”. I don’t know of many covers that do this.