I'm trying to get a script working that replace my clock thermostat program on my Plugwise Anna thermostat and use Domoticz instead. This because I can add extra's like temperatures, 'someone home' or other switches. But I have some issues with the setpoint setting. I manage to get the thermostat switching between presets, but not temperatures.
This is my script for testing to set the setpoint on 20 degrees when it's manual set to something higher then 20 degrees:
Code: Select all
return {
on = {
timer = { 'every minute'}
},
active = true,
execute = function(domoticz, device, triggerInfo)
local Anna = domoticz.devices('Anna-kachel') -- plugwise Anna thermostaat
local temp = domoticz.devices('Woonkamer') -- plugwise Anna temperatuur
local setpointValue = tonumber(Anna.state)
if setpointValue >= 20.5 then
domoticz.log('De thermostaat stond ingesteld op:' .. setpointValue)
device.Anna.updateSetPoint(20)
domoticz.log('De thermostaat staat nu ingesteld op:' .. setpointValue)
end
end
}
}
What am I doing wrong?2017-12-29 11:50:00.221 dzVents: Info: ------ Start internal script: Test-Anna:, trigger: every minute
2017-12-29 11:50:00.224 dzVents: Info: De thermostaat stond ingesteld op:21
2017-12-29 11:50:00.224 Error: dzVents: Error: An error occured when calling event handler Test-Anna
2017-12-29 11:50:00.224 Error: dzVents: Error: ...domoticz/scripts/dzVents/generated_scripts/Test-Anna.lua:15: attempt to index local 'device' (a nil value)
2017-12-29 11:50:00.224 dzVents: Info: ------ Finished Test-Anna
Also when I adjust the setpoint manually with Domoticz, it adjust on the thermostat, but in the logging this appears:
2017-12-29 11:49:29.485 Error: AnnaThermostat: Error getting current state!