Question about zwave_thermostat_mode_device.lua
Moderator: leecollings
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Question about zwave_thermostat_mode_device.lua
I have the Heatit zwave thermostat and i had problems to get the 'eco' working with a selector switch.
There are some people who got it working to use nvalue2 but that did not work for me so i tried nvalue3 which works fine:
http://127.0.0.1:8080/json.htm?type=com ... 8&nvalue=3
So will this line work in the zwave_thermostat_mode_device.lua?
-- modes from data: ["modes"] = "0;Off;1;Heat;2;Heat Econ;";
Also where is this file used for and what can i do with it?
There are some people who got it working to use nvalue2 but that did not work for me so i tried nvalue3 which works fine:
http://127.0.0.1:8080/json.htm?type=com ... 8&nvalue=3
So will this line work in the zwave_thermostat_mode_device.lua?
-- modes from data: ["modes"] = "0;Off;1;Heat;2;Heat Econ;";
Also where is this file used for and what can i do with it?
-
- Posts: 80
- Joined: Friday 21 April 2017 8:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Czechia
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
Hi,
zwave_thermostat_mode_device.lua in dzVents/runtime/device-adapters folder is script used internally by dzVents runtime for handling this type of device (deviceSubType == 'Thermostat Mode'). So you can easier get status and send updates to device.
Line with modes is commented out (by double dash --) and is only example of device modes (from my system
)
Doc for this type of device is on Wiki
https://www.domoticz.com/wiki/%27dzVent ... ostat_mode
Example of dzVents script part:
zwave_thermostat_mode_device.lua in dzVents/runtime/device-adapters folder is script used internally by dzVents runtime for handling this type of device (deviceSubType == 'Thermostat Mode'). So you can easier get status and send updates to device.
Line with modes is commented out (by double dash --) and is only example of device modes (from my system

Doc for this type of device is on Wiki
https://www.domoticz.com/wiki/%27dzVent ... ostat_mode
Example of dzVents script part:
Code: Select all
-- assign device variable
local dev = domoticz.devices('Some device')
-- log current mode
domoticz.log('Current mode: ' .. tostring(dev.modeString))
-- log available modes
domoticz.log('All modes: ' .. tostring(dev.modes))
-- update mode
dev.updateMode('Off')
-- dump all device info for debugging
dev.dump()
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
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
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
So you have one.
Can you check if yours also needs nvalue 3 for eco or nvalue 2 for eco?
Can you tell me which software version it is running?
PS. i still don't get it very well except that the script is for processing it in dzVents.
Can you check if yours also needs nvalue 3 for eco or nvalue 2 for eco?
Can you tell me which software version it is running?
PS. i still don't get it very well except that the script is for processing it in dzVents.
-
- Posts: 80
- Joined: Friday 21 April 2017 8:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Czechia
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
I have Comet Z-Wave thermostatic radiator valves. It has Heat Eco mode nvalue=2, but modes can differ by Zwave hardware vendor and type. Do you try to dev.dump() in dzVents script to see modes ?
Same info should be visible in JSON data of device (Modes:). Try this - replace ip, port and IDX with yours:
http://domoticz-ip:port/json.htm?type=devices&rid=IDX
Same info should be visible in JSON data of device (Modes:). Try this - replace ip, port and IDX with yours:
http://domoticz-ip:port/json.htm?type=devices&rid=IDX
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
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
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
That json only gives me sunset,sunrise and time, nothing more.
What should i do with dev.dump()?
Not everybody is a coder so just saying to put it in a script doesn't work for me.
Maybe somebody should write an example script for this kind of stuff.
This will help you guys out a lot more
What should i do with dev.dump()?
Not everybody is a coder so just saying to put it in a script doesn't work for me.
Maybe somebody should write an example script for this kind of stuff.
This will help you guys out a lot more

-
- Posts: 80
- Joined: Friday 21 April 2017 8:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Czechia
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
OK, lets start with basics 
Every Domoticz device (switch, sensor, thermostat etc.) has unique IDX. You can get it on Setup / Devices page. Find your device and in column Idx it is:
Take this IDX and modify this URL by your data:
You should see web page full of parameters of your device in JSON format. This way, you get device data, which Domoticz knows about your device. Please post JSON here.

Every Domoticz device (switch, sensor, thermostat etc.) has unique IDX. You can get it on Setup / Devices page. Find your device and in column Idx it is:
Take this IDX and modify this URL by your data:
You should see web page full of parameters of your device in JSON format. This way, you get device data, which Domoticz knows about your device. Please post JSON here.
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
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
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
I know about the IDX but i feel so stupid now, i did not remove IDX in the link but added the IDX right after itmivo wrote: ↑Thursday 10 August 2017 10:31 OK, lets start with basics
Every Domoticz device (switch, sensor, thermostat etc.) has unique IDX. You can get it on Setup / Devices page. Find your device and in column Idx it is:
2017-08-10 10_20_24-Domoticz.png
Take this IDX and modify this URL by your data:
2017-08-10 10_21_46-192.168.17.131_8080_json.htm_type=devices&rid=3.png
You should see web page full of parameters of your device in JSON format. This way, you get device data, which Domoticz knows about your device. Please post JSON here.

This is what is coming back:
Code: Select all
{
"ActTime" : 1502433050,
"ServerTime" : "2017-08-11 08:30:50",
"Sunrise" : "06:22",
"Sunset" : "21:11",
"result" : [
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "Off",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 16,
"HardwareName" : "Zwave USB",
"HardwareType" : "OpenZWave USB",
"HardwareTypeVal" : 21,
"HaveTimeout" : false,
"ID" : "00000A01",
"LastUpdate" : "2017-08-11 08:27:57",
"Mode" : 0,
"Modes" : "0;Off;1;Heat (Default);2;Cool;3;Energy Heat;",
"Name" : "Thermostat Mode woonkamer",
"Notifications" : "false",
"PlanID" : "12",
"PlanIDs" : [ 12 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : "-",
"SubType" : "Thermostat Mode",
"Timers" : "false",
"Type" : "General",
"TypeImg" : "mode",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "2288"
}
],
"status" : "OK",
"title" : "Devices"
}
-
- Posts: 80
- Joined: Friday 21 April 2017 8:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Czechia
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
OK, don't worry.
So your Zwave thermostat has these available modes:
dzVents script for changing modes can look like this:
So your Zwave thermostat has these available modes:
Code: Select all
"Modes" : "0;Off;1;Heat (Default);2;Cool;3;Energy Heat;"
Code: Select all
local LOGGING = true -- log status info
return {
active = true,
on = {
devices = {
'Eco switch' -- example switch device - if On, change mode to Eco
}
},
execute = function(domoticz, device, triggerInfo)
local newMode -- new mode variable
local devTherm = domoticz.devices('Thermostat Mode woonkamer') -- thermostat device variable
local devMode = devTherm.modeString -- current mode variable
if device.state == 'On' then
-- if Eco switch is On, change mode to Eco
newMode = 'Energy Heat'
else
newMode = 'Heat (default)'
end
if LOGGING then
domoticz.log('current mode: ' .. devMode)
domoticz.log('new Mode: ' .. newMode)
end
if devMode ~= newMode then
-- check if newMode not already set
domoticz.log('setting to: ' .. newMode)
devTherm.updateMode(newMode)
else
domoticz.log('already set: ' .. newMode)
end
end
}
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
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
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
Thanks, i am going to play with this soon.
-
- Posts: 90
- Joined: Sunday 20 March 2016 18:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: LA, Ca USA
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
I'm having a problem trying to change modes with my new zwave thermostat
I added the errors to the end of my code, line 28 is the updateMode line
Any advice would be appreciated, can't see what I'm doing wrong.
Code: Select all
local DownMode = domoticz.devices('Thermostat Downstairs Mode')
--Modes: "0;Off;1;Heat;2;Cool;3;Auto;4;Aux Heat;"
local ModeSet = domoticz.variables('ThermostatDownModeSet')
local newmode
if (ModeSet.changed) then
if (ModeSet.value == 0) then
newMode = 'Off'
end
if (ModeSet.value == 1) then
newMode = 'Heat'
end
if (ModeSet.value == 2) then
newMode = 'Cool'
end
DownMode.updateMode(newMode)
end
end
--2017-08-14 22:10:00.513 Error: dzVents: Error: An error occured when calling event handler ThermoDownMode
--2017-08-14 22:10:00.513 Error: dzVents: Error: ...icz/scripts/dzVents/generated_scripts/ThermoDownMode.lua:28: attempt to call field 'updateMode' (a nil value)
}
Any advice would be appreciated, can't see what I'm doing wrong.
-
- Posts: 80
- Joined: Friday 21 April 2017 8:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Czechia
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
Hi Randy,
It looks like your device DownMode has no updateMode method. Which version of Domoticz / dzVents are you using ? Please check also attributes of your device in dzVents script by:
and JSON call - replace ip, port and IDX with your values:
http://domoticz-ip:port/json.htm?type=devices&rid=IDX
It looks like your device DownMode has no updateMode method. Which version of Domoticz / dzVents are you using ? Please check also attributes of your device in dzVents script by:
Code: Select all
DownMode.dump()
http://domoticz-ip:port/json.htm?type=devices&rid=IDX
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
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
-
- Posts: 90
- Joined: Sunday 20 March 2016 18:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: LA, Ca USA
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
I was using version 2.1.0
I updated to 2.2.0 and it started working

So thanks for asking, that fixed it. Since my sw skills are pretty basic, I always assume I'm doing something wrong lol.
So now I'll be able to set a user variable, and change the mode. I want to do this because I can't change modes from an app, but I can change a user variable value. I'll probably make it 0 = off and 1 = auto so it's easy to remember.
I'm also going to make a time based script, which will turn off the downstairs thermostat at night, in case we forget lol. It will also turn off the upstairs thermostat during the day.
Randy
-
- Posts: 80
- Joined: Friday 21 April 2017 8:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Czechia
- Contact:
Re: Question about zwave_thermostat_mode_device.lua

I am using updateMode similar way - uservariable 0 / 1 for setting thermostats to off in summer. There is one way of changing setting in web Gui - Edit device on Utility page, and there are modes.
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
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
-
- Posts: 90
- Joined: Sunday 20 March 2016 18:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: LA, Ca USA
- Contact:
Re: Question about zwave_thermostat_mode_device.lua
Yeah, I can change modes from a PC with no problem, from the Utility page. But I wanted to be able to change modes from any device, just in case.
And now I can, with my new script.
Randy
Who is online
Users browsing this forum: Google [Bot] and 1 guest