dzVents - howto get Thermostat value Topic is solved

Moderator: leecollings

Post Reply
tuxmartin
Posts: 11
Joined: Wednesday 06 September 2017 12:47
Target OS: Linux
Domoticz version:
Location: CZ
Contact:

dzVents - howto get Thermostat value

Post by tuxmartin »

Hi,
I'm dzVents begginer.
I wrote simple script for heating control:

Code: Select all

local room1_thermostat = domoticz.devices('room1_thermostat') -- 12
local room1_temperature = domoticz.devices('room1_temperature') -- 14

domoticz.log(room1_thermostat.setPoint)

if (room1_temperature < room1_thermostat.setPoint ) then
It crash on if statement (line 65):

Code: Select all

2017-12-14 11:36:00.426 LUA: Info: ------ Start internal script: heating_dzVents:, trigger: every 1 minutes
2017-12-14 11:36:00.540 Error: LUA: Error: An error occured when calling event handler heating_dzVents
2017-12-14 11:36:00.540 Error: LUA: Error: ...pts/dzVents/generated_scripts/heating_dzVents.lua:65: attempt to call field 'setPoint' (a number value)
2017-12-14 11:36:00.541 LUA: Info: ------ Finished heating_dzVents
"domoticz.log()" write good value to log.

I'm using device type "Thermostat".

At wiki http://www.domoticz.com/wiki/DzVents:_n ... _set_point is only:

Code: Select all

Thermostat set point
    setPoint: Number.
    updateSetPoint(setPoint):Function.
How can I get current value from thermostat?
Last edited by tuxmartin on Thursday 14 December 2017 11:48, edited 2 times in total.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: dzVents - howto get Thermostat value

Post by emme »

it is:

Code: Select all

if (room1_temperature.temperature < room1_thermostat.setPoint ) then
room1_temperature is assignet to a table, not to a specific value.... you have to specify the field ;)

more... it looks like the error could be NOT in the if, but in the debug:

domoticz.debug requires string:

Code: Select all

domoticz.debug(tostring(room1_thermostat.setPoint))
The most dangerous phrase in any language is:
"We always done this way"
tuxmartin
Posts: 11
Joined: Wednesday 06 September 2017 12:47
Target OS: Linux
Domoticz version:
Location: CZ
Contact:

Re: dzVents - howto get Thermostat value

Post by tuxmartin »

Thank you, it works.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents - howto get Thermostat value

Post by dannybloe »

I don't remember that I created a domoticz.debug() method. Didn't you mean domoticz.log()?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
kimot
Posts: 105
Joined: Saturday 25 November 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: dzVents - howto get Thermostat value

Post by kimot »

Here is my way to obtain thermostat setpoint ( and send it to ESPeasy ):

Code: Select all

 	local setpoint = domoticz.devices('Filip_Setpoint')
        local url= 'http://x.x.x.x/control?cmd=event,HeatSetpoint='..(setpoint.state)..''
        print(url)
        domoticz.openURL(url)
RPi2 Domoticz v 4.10717
10 x Sonoff Basic - ESPeasy
1 x Wemos D1 - ESPeasy
1 x Shelly Plus Plug S
1 x Sonoff S26 - ESPeasy
1 x Shelly 1
1 x MySensors HC-SR04
1 x MySenosrs wifi gateway
1 x RFLink
4x Cam IPC-T240H
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest