Lua script commandarray cannot update a thermostat setpoint

Moderator: leecollings

Post Reply
coppo23
Posts: 5
Joined: Sunday 05 April 2015 20:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Lua script commandarray cannot update a thermostat setpoint

Post by coppo23 »

I am using the latest domoticz on a Pi. (3.4834)

I have a problem that I cannot update a virtual thermostat setpoint using commandarray and am hoping I have done something silly that someone else will spot!

The script will run for more than 10 seconds. If I change the setpoint to type temperature, rather than thermostat setpoint - everything works OK. The script scans through a dozen or more zones so I potentially could have multiple setpoint updates from the same pass of the script. I'd prefer to use a setpoint rather than a straight temperature device for the extra functionality you get on the web gui.

The setpoint device looks like this in the devices list:
280 test dummy 0014167 1 HC_DiningRoom_Setpoint Thermostat SetPoint 21.2

The code that updates the devices is shown below and - as I say works for every other device - apart from thermostat setpoint.

I have searched in the forums and did find this issue:
http://easydomoticz.com/forum/viewtopic ... 8&start=10
but the only solution appeared to be JSON URL based which I don't want to implement having had problems with os.execute curl calls before.

Code: Select all

function issueDeviceUpdate(deviceID, deviceValue)
  commandArray[commandArrayIndex] = {['UpdateDevice'] = deviceID .. "|0|" .. tostring(deviceValue)}
  commandArrayIndex = commandArrayIndex + 1
end
The log output is as follows
2016-03-29 12:19:00.420 LUA: (HeatingCoordinator) Temp = '-1', Setpoint = '5.2', Heat Needed = 'On'
2016-03-29 12:19:00.420 LUA: ==== ZONE: 5 HotWater =========
2016-03-29 12:19:00.421 LUA: (HeatingCoordinator) Zone is Unoccupied and turned Off
2016-03-29 12:19:00.421 LUA: (HeatingCoordinator) Temp = '17.3', Setpoint = '5.2', Heat Needed = 'Off'
2016-03-29 12:19:00.421 LUA:
******** BOILER **********
2016-03-29 12:19:00.421 LUA: Heat Needed by 1 of 5 radiator zones
2016-03-29 12:19:00.421 LUA: Boiler state HCN_Boiler remains On
2016-03-29 12:19:00.421 LUA: Radiator Zone valve HCN_HeatingValve remains On
2016-03-29 12:19:00.421 LUA: (HeatingCoordinator) END
2016-03-29 12:19:00.423 EventSystem: Sending SetPoint to device....
2016-03-29 12:19:10.411 Error: EventSystem: Warning!, lua script /home/pi/domoticz/scripts/lua/script_time_heatingcoordinator.lua has been running for more than 10 seconds
2016-03-29 12:19:00.423 (test dummy) Thermostat (HC_DiningRoom_Setpoint)
Please can anyone offer any ideas as to what may be wrong?

(UPDATE: 18:21 29th mar Since the original post I have discovered that the setpoint does change to the required value - eventually. The script times out and sometime after that - the value updates.)

Thanks

Coppo
coppo23
Posts: 5
Joined: Sunday 05 April 2015 20:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Lua script commandarray cannot update a thermostat setpoint

Post by coppo23 »

UPDATE: I have now found a work around using commandarray[OpenURL] options

Code: Select all

function issueURLCommand (URLString)
  print(string.format("Index %s URL = [%s]",commandArrayIndex ,URLString))
  commandArray[commandArrayIndex] = {['OpenURL']= URLString }
  commandArrayIndex = commandArrayIndex + 1
 end
and

Code: Select all

if newSetpoint ~= oldSetpoint then
      print("Issue set point update was ".. oldSetpoint ..'is '..newSetpoint ..'id= '..zoneSetpointIDX)
      issueURLCommand('http://'.. DomoticzIP..':'..DomoticzPort..'/json.htm?type=command&param=udevice&idx='..zoneSetpointIDX..'&nvalue=0&svalue='..tostring(newSetpoint))
end
This avoids the need to use updatedevice for the thermostat type devices - but I now think that the inability to update a thermostat device normally using updatedevice may be a bug in Domoticz.

Coppo
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest