Page 1 of 1

dzVents - howto get Thermostat value

Posted: Thursday 14 December 2017 11:44
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?

Re: dzVents - howto get Thermostat value

Posted: Thursday 14 December 2017 11:48
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))

Re: dzVents - howto get Thermostat value

Posted: Thursday 14 December 2017 11:51
by tuxmartin
Thank you, it works.

Re: dzVents - howto get Thermostat value

Posted: Thursday 14 December 2017 16:05
by dannybloe
I don't remember that I created a domoticz.debug() method. Didn't you mean domoticz.log()?

Re: dzVents - howto get Thermostat value

Posted: Wednesday 21 March 2018 23:29
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)