Fully support this request. To make this more concrete, I put together what I’d consider as requirements to get this flexibility implemented - as basis for further discussion:
(0) Starting point: Physical/Raw Position
What all covers have in common, is the ability to move “something” linearly between two end positions A and B. This movement is represented by a position value between 0 and 100. Let’s call this raw_position
, which is controlled via commands
raw_open
→ move towards raw_position = 0
raw_close
→ move towards raw_position = 100
(1) Configurable Display Position
We want to be able to invert the interpretation how position 0 and 100 maps to the physical end positions A and B. Let’s define a setting
invert_position: (false)
which defines how the actual position
value relates to raw_positions
:
position
equals raw_position
if invert_position == false
position
equals 100-raw_position
if invert_position == true
(2) Configurable open/close directions
Allow inverting the direction of open/close command via new setting
invert_open_close: (false)
open
performs raw_open
and close
performs raw_close
if invert_open_close == false
open
performs raw_close
and close
performs raw_open
if invert_open_close == true
(3) Configurable States / Tristate
The usual opened
and closed
states represent end positions. And additional intermediate
state is suggested, which is assumed whenever the cover is no fully opened
or closed
.
The relation between state
and position
is defined via new settings
opened_upper_bound: 0
opened_lower_bound: 0
closed_upper_bound: 100
closed_lower_bound: 1
i.e. the state opened
is assumed when position
is between opened_lower_bound
and opened_upper_bound
, analogously for position closed
. The state intermediate
is assumed in all other cases. (see notes 1 and 2)
(4) Configurable Active State
Add a setting that allows to define which of above states is considered ‘active’ (–> e.g. causing the icon to be colored yellow in the standard UI representation)
active_opened: (true)
active_intermediate: (false)
active_closed: (false)
Summarizing:
Above logic adds a flexibility layer between the cover entity as defined in home assistant and the physical cover. With the given default values, the behavior is unchanged to the current way, but the new settings allow hopefully most other interpretations that have been discussed in this and related threads.
In analogy to above, tilt_position
should be handled in exactly the same way, to add this flexibility also to tilting covers.
How to implement?
I am trying to contribute as much as possible with above ‘specification’, but unfortunately, my development skills are limited, and I won’t be able to implement that myself. I’m hoping for someone knowledgeable to discuss my proposal and get this converted into usable code…
Note 1: With the given (default) values, the current behaviour is reproduced, to avoid breaking changes.
Note 2: I know that from a mathematical point of view, there should be a possibility to distinguish between “less than” and “less than or equal” for the bounds, as position is continuous and should be a float. With above default values, in fact, the state would be intermediate
for the case 0 < position < 1
(e.g. position = 0.1
), but I’m not even sure whether the current implementation allows float values here or is limited to discrete integer position
values.