-
Notifications
You must be signed in to change notification settings - Fork 4
Improvement for userModules/BaseModule #4
Description
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!