Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Wrong topics for autodiscovered devices of Greenwave PowerNode 6-plug #109

Closed
1 of 3 tasks
katiuskt opened this issue Dec 24, 2020 · 12 comments · Fixed by #112
Closed
1 of 3 tasks

[bug] Wrong topics for autodiscovered devices of Greenwave PowerNode 6-plug #109

katiuskt opened this issue Dec 24, 2020 · 12 comments · Fixed by #112
Assignees
Labels
bug Something isn't working

Comments

@katiuskt
Copy link

Version

Build/Run method

  • Docker
  • PKG
  • Manually built (git clone - npm install - npm run build )

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
image
image

  • kwh_meter sensors unit_of_measurement should be kWh, not seconds. The point out to [node]/X/deltaTime/65537 instead to [node]/X/value/65537 (with X=1 to 6)
  • w_meter sensors unit_of_measurement should be W, not seconds. They point out to [node]/X/deltaTime/66049 instead to [node]/X/value/66049 (with X=1 to 6)

image

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.

@katiuskt katiuskt added the bug Something isn't working label Dec 24, 2020
@robertsLando
Copy link
Member

@billiaz I think this has been broken by one of the last changes, could you investigate?

@robertsLando
Copy link
Member

Or maybe @AlCalzone Did you changed something on your side that could have messed up units?

@AlCalzone
Copy link
Member

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)

@katiuskt
Copy link
Author

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

@varet80
Copy link
Collaborator

varet80 commented Dec 26, 2020

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

@varet80 varet80 self-assigned this Dec 26, 2020
@varet80
Copy link
Collaborator

varet80 commented Dec 26, 2020

@katiuskt I can reproduce this on my Fibaros. Therefore I can debug it there
@robertsLando

@varet80
Copy link
Collaborator

varet80 commented Dec 26, 2020

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

@varet80
Copy link
Collaborator

varet80 commented Dec 26, 2020

@robertsLando I suspect this change caused it: 311d0b4#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

@varet80
Copy link
Collaborator

varet80 commented Dec 26, 2020

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.

@varet80
Copy link
Collaborator

varet80 commented Dec 26, 2020

@katiuskt if you can test the #112 and report back would be helpful

@robertsLando
Copy link
Member

I suspect this change caused it: 311d0b4#diff-f8b02b650fe9a88dd67e7f9f1264bc28fa5868c6e99ac5c47962f04037c4329c

Let me investigate, I think too

@robertsLando robertsLando linked a pull request Dec 28, 2020 that will close this issue
robertsLando added a commit that referenced this issue Dec 28, 2020
Co-authored-by: V. Aretakis <v.aretakis@elsevier.com>
Co-authored-by: Daniel Lando <daniel.sorridi@gmail.com>
@katiuskt
Copy link
Author

Tested latest docker dev version, it is working now and all devices are autodiscovered.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants