Closed Brimstedt closed 7 years ago
Hi Brimstedt,
Thank you for your contribution to WZWave. I've just reviewed your changes.
Your changes to ProductRegistry looks good!
As far as your change for BinaryPowerSwitch, if you take a look at the Binary Power Switch specific device class in the Z-Wave Device Class Specification (http://z-wave.sigmadesigns.com/wp-content/uploads/2016/08/SDS10242-29-Z-Wave-Device-Class-Specification.pdf) you will see the mandatory command classes are "all switch" (which I interpret to mean the Basic and Binary Switch command classes). It also mentions the "Protection" and "Clock" command classes are optional but recommended.
That would tell me that Binary Power Switches do not always have Meters and I know for certain they don't always have Multilevel Sensors since I have at least one Z-Wave device that reports itself as a binary power switch and doesn't report the MultilevelSensor command class. Therefore, it's not appropriate to add them for all binary power switches.
Having said that, you're device should have indicated that it had both the Meter and MultilevelSensor command classes when it was interviewed by WZWave. So, you should be able to call the getCommandClass() method on your ZWaveNode to obtain the MeterCommandClass and MultilevelSensorCommandClass objects and then call their getCurrentValue() and getValues() methods respectively.
So let me know if you want to create a new pull request without the BinaryPowerSwitch change or I can merge in the ProductRegistry and .gitignore updates manually.
Thanks again and let me know if you have any questions!
Thanks for reviewing!
So, what you're telling me is I do not need to add the commandclasses in constructor of BinaryPowerSwitch: addCommandClass(MeterCommandClass.ID, new MeterCommandClass()); addCommandClass(MultilevelSensorCommandClass.ID, new MultilevelSensorCommandClass());
But should getCurrentValue() still remainor are there other ways to get the actual data?
br
None of the changes to BinaryPowerSwitch are needed.
You should be able to get the current device values by calling (where "node" below is the appropriate ZWaveNode):
node.getCommandClass(MeterCommandClass.ID).getCurrentValue() node.getCommandClass(MultilevelSensorCommandClass.ID).getValues()
Just make sure those calls are made after WZWave has interviewed the node (e.g. anytime during or after your listener's onZWaveNodeAdded() callback method is invoked).
Quite new to ZWave and WZWave, but managed to get my switch with meter running. According to some docs I found it was a multilevelsensor and a meter, so adding those commandclasses to BinaryPowerSwitch. It works for me and my device, but not sure if all Binary Power Switches are Meters ?