I found a hard-coded limit by using the service "cover.set_cover_position".
I created a MQTT Cover with MQTT Discovery and set the "position_open" to 1024.
If I now call the service "cover.set_cover_position" with a position higher than 100, I get the error: value must be at most 100 for dictionary value @ data['position']
configuration.yaml
{
"name": "MQTT Cover",
"command_topic": "home-assistant/cover/set",
"position_topic": "home-assistant/cover/position",
"availability_topic": "home-assistant/cover/availability",
"set_position_topic": "home-assistant/cover/set_position",
"qos": 0,
"retain": true,
"payload_open": "OPEN",
"payload_close": "CLOSE",
"payload_stop": "STOP",
"position_open": 1024,
"position_closed": 0,
"payload_available": "online",
"payload_not_available": "offline",
"optimistic": false
}
Failed to call service cover/set_cover_position. value must be at most 100 for dictionary value @ data['position']
A quick look at device_action.py implies that there is a hard coded limit of 100:
https://github.com/home-assistant/core/blob/dbf383f7139668c2a76cb548a7a992a5ba159197/homeassistant/components/cover/device_action.py#L50
Hey there @home-assistant/core, mind taking a look at this issue as its been labeled with a integration (cover
) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
Hey @emontnemery,
I saw you write that code. Maybe you have a solution?
@sim-san Home Assistant always works with the range 0..100 internally.
The configuration options for mqtt.cover
translate between Home Assistant's internal range and the range understood by your MQTT device.
With your configuration:
But this behavior does not work on my installation. What cloud be the error ?
I don't see the use of the the position_open
https://github.com/home-assistant/core/search?q=position_open&type=
But this behavior does not work on my installation. What cloud be the error ?
Please give an example of what is not working.
I don't see the use of the the position_open
It's used here to translate Home Assistants internal position in the range 0..100 to the range of the device:
https://github.com/home-assistant/core/blob/19734e7b2cdd8169159c1e6227f2216cdb79e3b4/homeassistant/components/mqtt/cover.py#L546
And used here to convert the position reported by the device to Home Assistant's internal position in the range 0..100:
https://github.com/home-assistant/core/blob/19734e7b2cdd8169159c1e6227f2216cdb79e3b4/homeassistant/components/mqtt/cover.py#L588
Please give an example of what is not working.
I send these discovery message:
Message 0 received on homeassistant/cover/pixtend-7d3aa3/ao_0/config at 5:49 PM:
{
"name": "Analog Output 0",
"position_topic": "pixtend-7d3aa3/ao/0/position",
"set_position_topic": "pixtend-7d3aa3/ao/0/set_position",
"position_closed": 0,
"position_open": 1023,
"payload_open": "OPEN",
"payload_close": "CLOSE",
"payload_stop": "STOP",
"retain": false,
"optimistic": false,
"device_class": "damper",
"device": {
"connections": [
[
"mac",
"b8:27:eb:55:36:4a"
]
],
"identifiers": "SNb8:27:eb:55:36:4a",
"manufacturer": "Qube Solutions GmbH",
"model": "Version L v21",
"name": "PiXtend V2",
"sw_version": "1"
},
"unique_id": "3120ace492"
}
And then I call the service cover.set_cover_position
:
entity_id: cover.analog_output_0
position: 50
And I get on the set_position
topic following message:
Message 1 received on pixtend-7d3aa3/ao/0/set_position at 5:53 PM:
50
Can you help me ? What is my error ?
mqtt documentation
mqtt source
(message by IssueLinks)
@sim-san Thanks for the example, there is indeed a bug in MQTT cover.
Edit: Maybe you can give the patch in #36222 a try?
How can I use this patch in my home-assistant installation ?
Since it's a small patch, you can just edit the .py-file directly and then restart home-assistant.
Ok, I will try it. Where does i find the sources in a docker installation ?
@sim-san Inside a HASS Docker image, navigate to /usr/src/homeassistant/
.
@sim-san Thanks for the example, there is indeed a bug in MQTT cover.
Edit: Maybe you can give the patch in #36222 a try?
Yes, our patch works
Should I leave also a comment on the PR ?
No need, thanks a lot for testing
Most helpful comment
Yes, our patch works