OpenZWave / qt-openzwave

QT5 Wrapper for OpenZWave
GNU Lesser General Public License v3.0
105 stars 30 forks source link

Can't reset power meter because valueidkey is invalid #151

Open mew1033 opened 4 years ago

mew1033 commented 4 years ago

I'm trying to figure out how to reset the energy usage meter on a few of my devices. I tracked down the command class (COMMAND_CLASS_METER) and found the entry in my node. For this one that I was testing, it's node 10, instance 1, command class 50. I tried to publish a message to the setvalue command and got this error:

2020-08-06 23:09:35.065440096  [20200806 23:09:35.065 MDT] [ozw.mqtt.commands] [debug]: Got  "OpenZWave/1/command/setvalue/"  Message:  "{\"ValueIDKey\": 72339069195812900,\"Value\": true}"
2020-08-06 23:09:35.065816776  [20200806 23:09:35.065 MDT] [ozw.mqtt.commands] [warning]: Invalid VidKey in field  "ValueIDKey"  for message
2020-08-06 23:09:35.065913901  [20200806 23:09:35.065 MDT] [ozw.mqtt.commands] [warning]: Message Processing for  "setvalue"  failed:  "{\"ValueIDKey\": 72339069195812900,\"Value\": true}"

Any ideas? Could it be because the ValueIDKey is so large it doesn't fit in an int?

Is there a different/better way to reset meters?

kpine commented 4 years ago

Value id keys are unsigned 64, so that value is not too large. Can you post both the topic and json for that value? There have been cases of the topic vidkey not matching the json one.

Also, you can't currently reset meters because of #139.

mew1033 commented 4 years ago

Thanks for looking at responding so quickly! Here's the topic:

OpenZWave/1/node/10/instance/1/commandclass/50/value/72339069195812888/

And here's the json at that topic:


{
  "Label": "Reset",
  "Value": false,
  "Units": "",
  "ValueSet": false,
  "ValuePolled": false,
  "ChangeVerified": false,
  "Min": 0,
  "Max": 0,
  "Type": "Button",
  "Instance": 1,
  "CommandClass": "COMMAND_CLASS_METER",
  "Index": 257,
  "Node": 10,
  "Genre": "System",
  "Help": "",
  "ValueIDKey": 72339069195812900,
  "ReadOnly": false,
  "WriteOnly": true,
  "Event": "valueAdded",
  "TimeStamp": 1596775648
}

So until https://github.com/OpenZWave/qt-openzwave/pull/144 is merged, there's no way to reset the power usage? 
kpine commented 4 years ago

These don't match: OpenZWave/1/node/10/instance/1/commandclass/50/value/72339069195812888/ "ValueIDKey": 72339069195812900,

Unless there's some cases I'm unaware of, I could expect both of those to be equal. You might try using 72339069195812888 in the command instead and see if the error goes away.

So until https://github.com/OpenZWave/qt-openzwave/pull/144 is merged, there's no way to reset the power usage?

Correct. That PR or some other code change. You could cherry pick that PR and build the container image locally and use it until it's fixed.

mew1033 commented 4 years ago

You are right, they are different. But that's definitely what it shows, I just checked again in MQTT Explorer: image

Anything I can/should do to figure out why they're different?

kpine commented 4 years ago

I would assume there is a bug somewhere and you'd need to examine the code. I think the 2900 number is the wrong one. Here is a decoding of the VIDs.

72339069195812888:
{'command_class': 50,
 'genre': 3,
 'genre_name': 'system',
 'index': 257,
 'instance': 1,
 'node': 10,
 'type': 8,
 'type_name': 'button',
 'vid_hex': '10100000acc8018'}
72339069195812900:
{'command_class': 50,
 'genre': 3,
 'genre_name': 'system',
 'index': 257,
 'instance': 2,
 'node': 10,
 'type': 4,
 'type_name': 'list',
 'vid_hex': '10100000acc8024'}

Index 257 is for "Reset". The 2900 number has the wrong instance number and type.

You could also examine your ozwcache file and see if anything looks out of place.

l3arcf commented 3 years ago

@mew1033 , where has this landed right now? I have a similar need and, believe it or not, I have exactly the same MQTT Explorer outputs. My two 'power reset' nodes are different products and have different VID's to their corresponding values. I was actually hoping for an ozw.reset_node_meters service at some point (like the pre-beta implementation).

From the thread above I am guessing that prerequisites are being whittled away and wondered where you had got to and how I can help.