dzVents - howto get Thermostat value Topic is solved

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

dzVents - howto get Thermostat value

Post by tuxmartin » Thursday 14 December 2017 12:44

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 12:48, edited 2 times in total.

User avatar
emme
Posts: 901
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: dzVents - howto get Thermostat value

Post by emme » Thursday 14 December 2017 12:48

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: 32
Joined: Wednesday 06 September 2017 12:47
Target OS: Linux
Domoticz version:
Location: CZ
Contact:

Re: dzVents - howto get Thermostat value

Post by tuxmartin » Thursday 14 December 2017 12:51

Thank you, it works.

dannybloe
Posts: 1480
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents - howto get Thermostat value

Post by dannybloe » Thursday 14 December 2017 17:05

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: 55
Joined: Saturday 25 November 2017 18:18
Target OS: Raspberry Pi
Domoticz version: v3.8153
Location: Czech Rep.
Contact:

Re: dzVents - howto get Thermostat value

Post by kimot » Thursday 22 March 2018 0:29

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)

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests