Closed i-am-snappy closed 4 years ago
I had a similar issue, I don't think that service call is working. see this for how to do this #67
Cheers Silfa - I spun my wheels for a bit with the service calls - Ended up pushing MQTT Publish packets out to change about 150 values. Was thinking I was doing something wrong with service calls. Once confirmed what the problem is, I'll close this..
You're using the value id. Did you try the parameter index value (1, 2, 3, etc.)? Same as core HA zwave. It should find the appropriate ValueID for you.
You indeed need to use the index of the config param. That said, we can easily improve this in the future by allowing some other methods to change config, like by name and valueid
I can see the Index value eg. 81 (and yes it is the same as HA Z-Wave). This is what i initially tried. Also tried versions of {}, yaml etc. Still doesn't work. Service call may be broken as Silfa mentions??
EDIT:
In MQTT Explorer, I can see the service call is calling the correct ValueIDKey but failing on Incorrect Field Type: Not Integer. I think I am doing something wrong...
The value is a list, so you need to specify the label of the list item, not an integer. It is probably a string, like the ones listed above it, e.g. "Night Light Mode".
Also tried strings and doesn't work.
It looks like it has got to do with the double quotes put around the value in the setvalue command initiated from service calls.
When I publish MQTT data it works, ie:
However through service call examples above it puts quotes around integer.
Yeah, it doesn't look like lists are properly supported just yet.
Here is the formatted mqtt dump for that config parameter:
{
"Label": "Configure the state of the LED",
"Value": {
"List": [
{
"Value": 0,
"Label": "The LED will follow the status (on/off) of its load. (Default)"
},
{
"Value": 1,
"Label": "When the state of the Switch changes, the LED will follow the status (on/off) of its load, but the LED will turn off after 5 seconds."
},
{
"Value": 2,
"Label": "Night Light Mode"
}
],
"Selected": "The LED will follow the status (on/off) of its load. (Default)",
"Selected_id": 0
},
"Units": "",
"Min": 0,
"Max": 1,
"Type": "List",
"Instance": 1,
"CommandClass": "COMMAND_CLASS_CONFIGURATION",
"Index": 81,
"Node": 7,
"Genre": "Config",
"Help": "",
"ValueIDKey": 22799473241227284,
"ReadOnly": false,
"WriteOnly": false,
"ValueSet": false,
"ValuePolled": false,
"ChangeVerified": false,
"Event": "valueAdded",
"TimeStamp": 1586583641
}
qt-openzwave wants you to send setValue with the position (index) of the list item. So if you want to set "Night Light Mode"
, you call setValue with integer 2, as you've done manually, not '2'
or "Night Light Mode"
. zwave_mqtt is detecting that the config parameter is a list type and converting whatever value you have given to a string.
So as you've observed, if you try a value of 2
, it probably gets converted to '2'
and sends it as the payload. I am assuming qt-openzwave wants an integer.
There's an existing issue https://github.com/cgarwood/python-openzwave-mqtt/issues/53 to support lists. The comment sounds like it's from the POV of reading list values, but setting them will obviously need to be considered somewhere.
Roger that - I know this is a work in progress, couldn't figure out if it were me or not. Setting list values via MQTT Publish is not that hard a work-around, now documented in this, and this #67. Will close issue as not to duplicate.
Blew away Z-Wave network and configuring from scratch in homeassistant_zwave_mqtt. Devices added fine via add_node.
I have been trying to use set_config_parameter from the HomeAssistant Services page, however it is not working. Warnings in log are along the lines of:
WARNING (MainThread) [custom_components.zwave_mqtt.services] Unknown config parameter 22799473241227284 on Node 7 with selection 1
I can change parameters via MQTT and publish as described by Isa: https://github.com/cgarwood/homeassistant-zwave_mqtt/issues/45#issuecomment-592093905 but was trying to accomplish via Services tab.
I am doing something wrong, but cant figure it out. Solution not explicitly indicated in https://github.com/cgarwood/homeassistant-zwave_mqtt/issues/67#issue-570540248 .
Also adding dump file: mqtt_dump.txt