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

Improvement for userModules/BaseModule #513

Open
av01d opened this issue Dec 6, 2020 · 0 comments
Open

Improvement for userModules/BaseModule #513

av01d opened this issue Dec 6, 2020 · 0 comments

Comments

@av01d
Copy link

av01d commented Dec 6, 2020

The BaseModule Z-Way HA module is a very handy base for HA modules.
One of its great features is that it does not process "events" of devices/sensors which last level equals the newly measured level:

File userModules/BaseModule/index.js, around line 80:

BaseModule.prototype.handleLevelModification = function(vDev) {
...
   // Not changed
   if (lastLevel == newLevel) return;
...
}

This works fine for most devices and sensors, but it does not work for scene controller devices. On those controllers, you want every push to be processed, even if the same button in pressed in sequence.

(Use case: One of the buttons on a scene controller is used to simply toggle a light on and off. The first push on the button turns light on, the next press turns it off. With the current BaseModule implementation, only the very first press is registered).

These are the ones I have:
https://www.thesmartesthouse.com/products/hank-z-wave-plus-four-button-scene-controller-hkzw-scn04
http://manuals-backend.z-wave.info/make.php?lang=en&sku=REMEZRC90

For both these devices, the following is true:

vDev.get('deviceType') == 'sensorDiscrete'

and the commandClass is 91 for both (Scene Controller Configuration Command Class).

I would like to propose to make a very small change to userModules/BaseModule/index.js
Instead of

   // Not changed
   if (lastLevel == newLevel) return;

do

if (deviceType != 'sensorDiscrete' && lastLevel == newLevel) {
   return;
}

Now we can properly handle button presses on scene controllers.
Thanks in advance!

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

No branches or pull requests

1 participant