Pages

Thursday, December 15, 2016

Remote Control of the hot water pump

Next step was to replace the timer switch for the hot water pump with a Z-Wave switch. I already had a Hostmann / Secure ASR-ZW boiler receiver unit that I had bought with the room thermostat and decided to use this. I had some doubts about the switch suitability because of something I had read on the HeatGenius website.



However according to the pump specification the maximum operating current is 0.47A at startup and the switch has a current limit of 3A so I didn't see a problem.

I left the installation to my husband! He added it alongside the existing timer such that we would be able to revert to the old method should the Z-Wave solution fail in some way.

The Hardware


New Z-Wave Switch alongside existing timer control


And the hot water pump 

Once installed, he checked that the on/off buttons were operating the pump and then left the remote part to me.

The ZWay SmartHome User Interface


The switch was easily included in the Z-Wave network and showed up in the ZWay web based UI (SmartHome) as two virtual devices as follows.

Which correspond to the two command classes ThermostatMode (64) and SwitchBinary (37)

Switching either to the on position resulted in the on light illuminating at the switch and the pump operating. And switching either to the off position resulted in the off light illuminating and the pump turning off.

All these events appeared in the event log of the SmartHome UI.

However, pressing ON or OFF at the switch did not result in the status being fed back to zway and nothing appeared in the event log. In order to report the actual status of the switch it is necessary to poll by forcing a SwitchBinary Get to be sent to the switch. This was not a big issue to implement in my ZWay module.

      // poll for the hot water pump status
      // this is necessary because if the pump is activated manually we do not receive a notification
      zway.devices[pumpController].instances[0].commandClasses[37].Get();

See this post for the Vera Controller that reports the same experience.

Adding control to my API


Either of the zway virtual devices created allow the pump to be turned on and off but I opted for the SwitchBinary (37) for my control. This can be activated from the browser with this command:

http://192.168.1.180:8083/ZWaveAPI/Run/zway.devices[37].instances[0].commandClasses[37].Set(true)

which I added to my ZWay module on the rPi:

Room.prototype.setPumpStatus = function (status) {
  console.log("setPumpStatus status is " + status + " (" + typeof(status) + ")");
  // set the actual status and wait for the response before updating our data
  // structures and starting the timer if necessary
  zway.devices[37].instances[0].commandClasses[37].Set(status);
}

registered GET and POST elements with my API:

    zAutomationAPI.router.get("/hillview/pumpstatus/:roomID",zAutomationAPI.ROLE.USER,getPumpStatus,[parseInt]);
    zAutomationAPI.router.post("/hillview/pumpstatus/:roomID",zAutomationAPI.ROLE.USER,setPumpStatus,[parseInt]);

and tested using a Python script.

By default, if the ASR-ZW is turned on it remains on for 45 minutes unless instructed otherwise. It is good to know that it will not remain on indefinitely. However, 45 minutes is way longer than required so I have set the rPi to automatically turn the switch off after 5 minutes of operation. I have made this timer configurable and also report how long the pump is running for. This required two further additions to the API:

pumpDuration GET & POST
pumpTime GET

Adding control via my Android App


I added a button to the Android App which operates the same as the on/off buttons on the device itself.



This has been operating the pump successfully for over a week now. The pump is only running when actually needed and I no longer have to rely on timed intervals to have hot water in my kitchen and utility room. Really pleased with the result!

However a hardware button in the kitchen would be much more convenient. On to the next step.

No comments: