dzVents 2.0 - Z-wave radiator valve control

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

dzVents 2.0 - Z-wave radiator valve control

Post by mivo »

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&param=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&param=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"
}
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.
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by dannybloe »

Interestingly I have been writing many integration tests for the next version of dzVents and discovered that a couple of adapters had bugs and that there were quite a few adapters missing. So I will definitely look at your adapters as I know there aren't way enough of them yet. Fortunately you can do most of the stuff with just the generic adapter so it shouldn't stop people. But adapters makes life a lot easier and your scripts smaller and better readable.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by dannybloe »

So this mode device is for a zwave thermostat?
And why did you add the device.hardwareTypeValue == 15 in the other adpater?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by dannybloe »

Ah.. I see, to make it different from the opentherm gateway adapter. Which is alarmingly the same as a dummy setpoint device. But as I don't have the OTGW hardware I don't want to change the OTGW adapter.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by mivo »

Hi,

my script with device.hardwareTypeValue == 15 (15 is dummy/virtual HW) on GitHub here was my testing adapter for Virtual Setpoint device - I wanted to let your original thermostat_setpoint_device adapter intact. Now with dzVents 2.1 it is not needed - setsetpoint JSON call works OK for dummy/virtual HW and real OpenZwave Setpoint device also. Thank you !

Second script on GitHub here is for Zwave thermostat mode (like - off, Heat Eco, Heat). As you written - this can be done by generic update method and is not necessary.

Thanks again for your great work and effort.
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by dannybloe »

It's ok to have an adapter for the zwave thermostat. Can you post the data for this device from domoticzData.lua file as generated in the debug mode (loglevel). You can find it in /path/to/domoticz/scripts/dzVents.lua (don't forget to turn debug mode off afterwards).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by mivo »

Device data from domoticzData.lua:

Code: Select all

[22] = {
                ["description"] = "";
                ["lastUpdate"] = "2017-07-17 08:49:5] = "00000201";
                ["deviceType"] = "General";
                ["subType"] = "Thermostat Mode";
                ["timedOut"] = true;
                ["rawData"] = {
                };
                ["data"] = {
                        ["_state"] = "0";
                        ["_nValue"] = 0;
                        ["hardwareName"] = "ZWave";
                        ["hardwareID"] = 12;
                        ["icon"] = "mode";
                        ["hardwareTypeValue"] = 21;
                        ["hardwareType"] = "OpenZWave USB";
                };
                ["switchTypeValue"] = 0;
                ["changed"] = false;
                ["signalLevel"] = 12;
                ["name"] = "Obyv TH-V Thermostat Mode";
                ["batteryLevel"] = 255;
                ["description"] = "";
                ["switchType"] = "On/Off";
                ["lastUpdate"] = "2017-07-17 08:49:53";
                ["id"] = 80;
        };
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by dannybloe »

So how do you determine the current mode?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by mivo »

Without specific handling by device-adapter, current mode is available as numeric value in attribute device.state (and nValue also, it is same).

"Human readable" modes table Domoticz get from OpenZwave and are visible in device status JSON ("Modes" : "0;Off;1;Heat;2;Heat Econ;").

Code: Select all

{
   "ActTime" : 1500300105,
   "ServerTime" : "2017-07-17 16:01:45",
   "Sunrise" : "05:13",
   "Sunset" : "21:03",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 85,
         "CustomImage" : 0,
         "Data" : "Heat",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 12,
         "HardwareName" : "ZWave",
         "HardwareType" : "OpenZWave USB",
         "HardwareTypeVal" : 21,
         "HaveTimeout" : false,
         "ID" : "00000201",
         "LastUpdate" : "2017-07-17 16:01:44",
         "Mode" : 1,
         "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"
}
Then I update device nValue to desired mode. I don't know if numeric mode values are somehow standardized, or they are specific to type / vendor of Zwave device.
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by dannybloe »

Aha.. so these modes are they always the same or is it configurable somehow/somewhere?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mivo
Posts: 80
Joined: Friday 21 April 2017 8:58
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Czechia
Contact:

Re: dzVents 2.0 - Z-wave radiator valve control

Post by mivo »

I think modes are detected by Domoticz for specific Z-wave device in time of creation / detection, don't know if updated from OpenZwave on regular basis. For my type of Z-wave radiator thermostatic valves (Eurotronic Comet Z-Wave), they are "hardware defined". There are some options in OpenZwave (XML config files etc.), but never "hacked" it so deep.
My toys:
Raspberry Pi 3 + UPS PIco HV3.0 A Stack
Minibian (Raspbian Jessie) + Domoticz beta
RFLink 433 Gateway, 1wire DS18B20 temp sensors (GPIO)
RaZberry module + 2x Comet Z-Wave + Z-wave socket
---
Plugins: WeMo Switch, UPS PIco HV3.0A on GitHub
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest