Version
Build/Run method
zwavejs2mqtt version: I'm not sure how to get this. I'm using zwavejs/zwavejs2mqtt:dev pulled on 24th Dec
Describe the bug
Autodiscovered devices for Greeenwave PowerNode 6-plugs are using wrong topics
Manufacturer ID: 153
Product Type: 3
Product ID: 4



I'm pretty confident in earlier versions of ZWaveJS2MQTT the autodiscovered devices were right (kwh sensors pointed out towards the right kwh topics, the same with the "w". In fact, even "previous value" and "delta time" devices were autodiscovered (and they don't now) so I'm not sure if this could be some kind of regression.
I've tried "rediscovering" the node and also "Refreshing Node Info" with no luck. For now, you need to edit the HASS device JSON and set the proper proper topics manually.
@billiaz I think this has been broken by one of the last changes, could you investigate?
Or maybe @AlCalzone Did you changed something on your side that could have messed up units?
Or maybe @AlCalzone Did you changed something on your side that could have messed up units?
Nothing that comes to mind. I'll need to see the usual files to investigate (log and cache)
I think it is only related with the autodiscovered devices for HASS provide by ZWaveJS2MQTT, not ZWaveJS itself because at Meter CC you can get all the information (timeDelta, Previous values, current values,...). The point is the generated JSON for HASS devices is a little bit messy: object_id names mention"w_meter" or "kwh_meter" and their topics pointed out to deltaTime ones and things like that.
Please find attached a couple of JSON for my two GreenWave Powernodes:
powernode.zip
I think it is only related with the autodiscovered devices for HASS provide by ZWaveJS2MQTT, not ZWaveJS itself because at Meter CC you can get all the information (timeDelta, Previous values, current values,...). The point is the generated JSON for HASS devices is a little bit messy: object_id names mention"w_meter" or "kwh_meter" and their topics pointed out to deltaTime ones and things like that.
Please find attached a couple of JSON for my two GreenWave Powernodes:
powernode.zip
I will take a look.
I suspect you talk about hass discovery,
If you are on slack, also ping me to talk/debug this
@katiuskt I can reproduce this on my Fibaros. Therefore I can debug it there
@robertsLando
I found the issues causing this. When I discover a node this happens in "milliseconds"
first write on discovery topic:
{
"value_template":"{{ value_json.value }}",
"device_class":"power",
"unit_of_measurement":"kWh",
"state_topic":"zwave2mqtt/Guestroom/switch/50/1/value/65537",
"json_attributes_topic":"zwave2mqtt/Guestroom/switch/50/1/value/65537",
"device":{
"identifiers":[
"zwavejs2mqtt_0xcddb486e_node66"
],
"manufacturer":"Fibargroup",
"model":"Single Switch 2 (FGS213)",
"name":"Guestroom-switch",
"sw_version":"3.3"
},
"name":"Guestroom-switch Value (Electric, Consumed)",
"unique_id":"zwavejs2mqtt_0xcddb486e_66-50-1-value-65537"
}
second:
{
"value_template":"{{ value_json.value }}",
"device_class":"power",
"unit_of_measurement":"kWh",
"state_topic":"zwave2mqtt/Guestroom/switch/50/0/value/65537",
"json_attributes_topic":"zwave2mqtt/Guestroom/switch/50/0/value/65537",
"device":{
"identifiers":[
"zwavejs2mqtt_0xcddb486e_node66"
],
"manufacturer":"Fibargroup",
"model":"Single Switch 2 (FGS213)",
"name":"Guestroom-switch",
"sw_version":"3.3"
},
"name":"Guestroom-switch Value (Electric, Consumed)",
"unique_id":"zwavejs2mqtt_0xcddb486e_66-50-0-value-65537"
}
and third:
{
"value_template":"{{ value_json.value }}",
"device_class":"power",
"unit_of_measurement":"s",
"state_topic":"zwave2mqtt/Guestroom/switch/50/0/deltaTime/65537",
"json_attributes_topic":"zwave2mqtt/Guestroom/switch/50/0/deltaTime/65537",
"device":{
"identifiers":[
"zwavejs2mqtt_0xcddb486e_node66"
],
"manufacturer":"Fibargroup",
"model":"Single Switch 2 (FGS213)",
"name":"Guestroom-switch",
"sw_version":"3.3"
},
"name":"Guestroom-switch Time since the previous reading",
"unique_id":"zwavejs2mqtt_0xcddb486e_66-50-0-deltaTime-65537"
}
in total 6. The discovery topic does not contain the deltaTime and 65573, where unique id does
MQTT topic: homeassistant/sensor/Guestroom-switch/electric1_kwh_meter/config
this should be also causing the other issue #108 @robertsLando
@robertsLando I suspect this change caused it: https://github.com/zwave-js/zwavejs2mqtt/commit/311d0b446977acd05aba736abbbef0e8e897523a#diff-f8b02b650fe9a88dd67e7f9f1264bc28fa5868c6e99ac5c47962f04037c4329c
Suspect cause the constants.js does not return the full object id.
To be presise:
Tracing back the cfg.object_id I found constant.meterType (for instance) do not include on id the propertyName and PropertyKey. Causing the topic, which is based on object_id to overwrite hass discovery
I believe this needs to be fixed for object_id to make sense! I will search further where can be caused. Scenes issue from #108 should be due to the same problem
@katiuskt
I believe having the same solution as notifications (for sensors) :https://github.com/zwave-js/zwavejs2mqtt/blob/35e755ef1904daf327ecbd954bbc3a0c9ca6933c/lib/Gateway.js#L1510
would be the solution.
@katiuskt if you can test the #112 and report back would be helpful
I suspect this change caused it: 311d0b4#diff-f8b02b650fe9a88dd67e7f9f1264bc28fa5868c6e99ac5c47962f04037c4329c
Let me investigate, I think too
Tested latest docker dev version, it is working now and all devices are autodiscovered.
Thank you!
Most helpful comment
Tested latest docker dev version, it is working now and all devices are autodiscovered.
Thank you!