dzVents 2.0 - Z-wave radiator valve control
Posted: Friday 14 July 2017 13:27
Hi,
I want to share my "problem" and mainly solution
I started converting my few LUA scripts to dzVents. Chance to cleanup, and it's best time in summer to tune heating scripts.
My setup:
- 3 virtual switches - "Night" and "Away" with timers, "Vacation" for manual override and longer absence.
On change of these switches, script decides if Eco or Comfort (temps set in variables) and updates Setpoint value of virtual Setpoint device
- virtual Setpoint device, which is "master" device for Z-wave thermostatic valves. On change of this device, setpoint temperature is sent to thermostatic valves. It can be changed also manually to override temperature if needed.
- 2 Z-wave Comfort Setpoint devices of thermostatic valves - controlled by "master" virtual Setpoint
- 2 Z-wave Thermostat Mode devices of thermostatic valves - can be set to Off / Eco / Comfort. Using only Off for summer and Comfort for heating season. Comfort temp is set by scripts and devices above.
Problem 1 - virtual Setpoint device:
- dzVents updateSetPoint method is updating device by sending URL json.htm?type=command¶m=udevice... In case of virtual setpoint device, device update is performed twice. Main cause is not problem of dzVens, it is somewhere in JSON API. In web GUI, it works OK. Discovered via browser debug tools, it is using json.htm?type=command¶m=setsetpoint... call. Created then new device-adapter script, which matches: device.hardwareTypeValue == 15 (virtual/dummy HW) and device.deviceSubType == 'SetPoint')
Try also change original thermostat_setpoint_device.lua for using setsetpoint JSON call, works OK for virtual dev, bot not for Z-wave setpoint dev. Strange and challenging behavior of different scripting and API methods
Problem 2 - Thermostat Mode device:
- has no special device adapter in dzVents. Also update from web GUI is possible only via Edit option, where it is possible to change mode. Tested and discovered, that generic device.update method works with correct nValue and sValue. nValue sets mode by numeric value - in my case:
0;Off; 1;Heat; 2;Heat Econ. sValue is not important, but must be sent any.
Json status of my device
Created new device-adapter script, which matches:
device.deviceSubType == 'Thermostat Mode'
That's it
Not tested with different devices, have no more...
Danny, if you find it use ful, code is here:
https://github.com/milanvo/domoticz/commits/milanvo
I am learning to use Git, so let me know if i can provide it another way.
I want to share my "problem" and mainly solution
I started converting my few LUA scripts to dzVents. Chance to cleanup, and it's best time in summer to tune heating scripts.
My setup:
- 3 virtual switches - "Night" and "Away" with timers, "Vacation" for manual override and longer absence.
On change of these switches, script decides if Eco or Comfort (temps set in variables) and updates Setpoint value of virtual Setpoint device
- virtual Setpoint device, which is "master" device for Z-wave thermostatic valves. On change of this device, setpoint temperature is sent to thermostatic valves. It can be changed also manually to override temperature if needed.
- 2 Z-wave Comfort Setpoint devices of thermostatic valves - controlled by "master" virtual Setpoint
- 2 Z-wave Thermostat Mode devices of thermostatic valves - can be set to Off / Eco / Comfort. Using only Off for summer and Comfort for heating season. Comfort temp is set by scripts and devices above.
Problem 1 - virtual Setpoint device:
- dzVents updateSetPoint method is updating device by sending URL json.htm?type=command¶m=udevice... In case of virtual setpoint device, device update is performed twice. Main cause is not problem of dzVens, it is somewhere in JSON API. In web GUI, it works OK. Discovered via browser debug tools, it is using json.htm?type=command¶m=setsetpoint... call. Created then new device-adapter script, which matches: device.hardwareTypeValue == 15 (virtual/dummy HW) and device.deviceSubType == 'SetPoint')
Try also change original thermostat_setpoint_device.lua for using setsetpoint JSON call, works OK for virtual dev, bot not for Z-wave setpoint dev. Strange and challenging behavior of different scripting and API methods
Problem 2 - Thermostat Mode device:
- has no special device adapter in dzVents. Also update from web GUI is possible only via Edit option, where it is possible to change mode. Tested and discovered, that generic device.update method works with correct nValue and sValue. nValue sets mode by numeric value - in my case:
0;Off; 1;Heat; 2;Heat Econ. sValue is not important, but must be sent any.
Json status of my device
Code: Select all
{
"ActTime" : 1500029183,
"ServerTime" : "2017-07-14 12:46:23",
"Sunrise" : "05:10",
"Sunset" : "21:06",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 70,
"CustomImage" : 0,
"Data" : "Off",
"Description" : "",
"Favorite" : 0,
"HardwareID" : 12,
"HardwareName" : "ZWave",
"HardwareType" : "OpenZWave USB",
"HardwareTypeVal" : 21,
"HaveTimeout" : true,
"ID" : "00000201",
"LastUpdate" : "2017-07-12 21:31:50",
"Mode" : 0,
"Modes" : "0;Off;1;Heat;2;Heat Econ;",
"Name" : "Obyv TH-V Thermostat Mode",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" : [ 0 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "Thermostat Mode",
"Timers" : "false",
"Type" : "General",
"TypeImg" : "mode",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "80"
}
],
"status" : "OK",
"title" : "Devices"
}device.deviceSubType == 'Thermostat Mode'
That's it
Not tested with different devices, have no more...
Danny, if you find it use ful, code is here:
https://github.com/milanvo/domoticz/commits/milanvo
I am learning to use Git, so let me know if i can provide it another way.