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

Support for PAN11 Power seitch with energy meter #5

Closed
wants to merge 4 commits into from

Conversation

Brimstedt
Copy link
Contributor

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 ?

Changed Binarypowerswitch to support reading meter values.
# Conflicts:
#	src/main/java/com/whizzosoftware/wzwave/product/ProductRegistry.java
@whizzosoftware
Copy link
Owner

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!

@Brimstedt
Copy link
Contributor Author

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

@whizzosoftware
Copy link
Owner

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).

@Brimstedt Brimstedt closed this Sep 21, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 58.81% when pulling 4d1659e on Brimstedt:master into 34b3cd9 on whizzosoftware:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants