Pages

Friday, December 30, 2016

Adding a Fibaro Button to control my hot water pump

Controlling the hot water pump by activating a ZWave switch from my phone app is great, but it would be more convenient for everyone if this could also be operated by a simple button located close to where the water is needed.

The only ZWave button I could find was this one by Fibaro. 


It seemed overkill (and pricey) for my purposes, but I liked the look of it. It had not been on the market long and I wasn't sure that it was going to work with the ZWay software. But I took a chance and ordered it anyway.

Setting up the button


Including it into my ZWave network was straightforward. And it appeared in the SmartHome UI:


And here are some of the views from the Expert UI:

Interview Tab showing supported command classes

Configuration Tab
Association Tab


but I wasn't sure what to expect after that. According to the ZWave.me forum it is not yet supported by ZWay, but a couple of people had managed to catch a single click event which was all I needed. So I started fiddling with it and seeing what messages appeared.


What happens for a single button press?

Pressing the button once resulted in a notification appearing in the SmartHome UI:


Looking into the log file, the first message picked up after this button press was:

[2016-12-30 14:48:07.676] [D] [zway] RECEIVED: ( 01 08 00 04 00 28 02 98 40 01 )

followed by a series of SENDS and ACKS

and then what looked like the information I needed:

[2016-12-30 14:48:08.319] [D] [zway] SETDATA devices.40.instances.0.commandClasses.91.data.sequence = **********
[2016-12-30 14:48:08.319] [D] [zway] SETDATA devices.1.instances.0.commandClasses.91.data.srcNodeId = 40 (0x00000028)
[2016-12-30 14:48:08.320] [D] [zway] SETDATA devices.1.instances.0.commandClasses.91.data.srcInstanceId = 0 (0x00000000)
[2016-12-30 14:48:08.320] [D] [zway] SETDATA devices.1.instances.0.commandClasses.91.data.keyAttribute = 0 (0x00000000)
[2016-12-30 14:48:08.320] [D] [zway] SETDATA devices.1.instances.0.commandClasses.91.data.currentScene = 1 (0x00000001)
[2016-12-30 14:48:08.320] [D] [zway] SETDATA devices.40.instances.0.commandClasses.91.data.keyAttribute = 0 (0x00000000)
[2016-12-30 14:48:08.321] [D] [zway] SETDATA devices.40.instances.0.commandClasses.91.data.currentScene = 1 (0x00000001)
[2016-12-30 14:48:08.378] [I] [core] Notification: device-info (device-OnOff): {"dev":"Fibar Group (40.0.0.1) Button","l":"on"}

From the ZWave.me documentation command class 91 is a 'central scene command':



I did a little experimenting here and found that the following keyAttribute values resulted from Fibaro button presses:


press 1 time: 0x00
press 2 times: 0x03
press 3 times: 0x04
press 4 times: 0x05
press 5 times: 0x06
hold down: 0x02 followed by 0x01 once released

But really I was only interested in 'has it been pressed' rather than how many times or for how long. Still, it is good to know that even though the button is not officially supported it is possible to use all of its features. For my purposes I just needed to bind to changes in the keyAttribute.

Binding to the keyAttribute value

Here is my code:

        // find the hot water pump switch
         hotWaterSwitch = getDeviceByManufacturer(FIBARO_ID, FIBARO_BUTTON_ID, FIBARO_BUTTON_TYPE);
         console.log ("MYTESTMOD: hot water switch is " + hotWaterSwitch);
         if (hotWaterSwitch != -1) { 
            zway.devices[hotWaterSwitch].instances[0].commandClasses[91].data.keyAttribute.bind(
                                                      function() 
                                                      {
                                                        self.rooms[1].setPumpStatus(true);
                                                      });
         }
         else {
            controller.addNotification("error", "No Hot Water Switch Present", "module", "MyTestMod");
         }
         self.hotWaterSwitch = hotWaterSwitch;

And here is my button:



currently residing on top of my radio, close to the sink. Working great so far!

No comments: