Page 1 of 1

Set Thermostat Setpoint when adding a Schedule(timer)

Posted: Thursday 21 October 2021 12:56
by johnrwoods
I would like to add a new schedule(timer) with a specific setpoint to a Thermostat using dzVents.

In dzVents I am calling the json api using the addtimer parameter but cannot see an option in the parameters that would allow me to set the setpoint.
In the UI to add a Timer to a Thermostat there is a field to add a "Value" which then appears as "Temperature, {value}" in the Command column in the list of timers:
Capture.PNG
Capture.PNG (16.27 KiB) Viewed 684 times

This is the code I would like to use (the idx is the deviceId of the Thermostat):

Code: Select all

local function addSchedule(domoticz, idx, command, hour, minute, days)
    local jsonString  = "/json.htm?type=command" ..
    			 "&param=addtimer" ..
                         "&idx=" .. idx ..
                         "&active=true" ..
                         "&timertype=" ..
                         "&hour=" .. hour .. 
                         "&min=" .. minute .. 
                         "&randomness=false" ..
                         "&command=" .. command ..
                         "&days=" .. days 
    domoticz.openURL( domoticz.settings["Domoticz url"] .. jsonString )
end
Can anyone help me with this?
Thanks in advance

Re: Set Thermostat Setpoint when adding a Schedule(timer)

Posted: Thursday 21 October 2021 13:48
by waltervl
Sorry, I do not know the answer.
But thinking the other way, why not using the dzVents script as a timer? I suppose that is what dzVents is basically designed for.

Re: Set Thermostat Setpoint when adding a Schedule(timer)

Posted: Thursday 21 October 2021 22:53
by johnrwoods
I had considered this but I think it would be rather messy for my particular scenario.

I have 20+ thermostats which need to have different temperature settings throughout the day and each of them is on a different schedule.

I guess that if the API cannot handle the setting of the Setpoint for a Thermostat timer then I will have no option but to set it up in dzVents.

Thanks for your help.

As an aside, how do I view the source code that handles the API call to add a Thermostat timer? I would be interested in looking at that.

Re: Set Thermostat Setpoint when adding a Schedule(timer)

Posted: Friday 22 October 2021 11:38
by waltervl
Some of the code can be found here: https://github.com/domoticz/domoticz/tr ... app/timers

Re: Set Thermostat Setpoint when adding a Schedule(timer)

Posted: Sunday 24 October 2021 12:33
by rrozema
I think there is an additional reason why your plan of using timers for the thermostat will not work: the timer will fire when the time set for this timer is reached and this is when the setpoint on that timer will be used to set the setpoint on the thermostat. If you change the setpoint on that timer after the time is reached, the thermostat will not be changed with it to the new setpoint. In other words, the setpoint on the thermostat will not change until the next timer is reached.

You can test this for yourself easily: put a timer on one of your thermostats with a time before the current time, the change the setpoint on this timer. For your plan to work, the thermostat should change it's setpoint with the timer's setpoint, but it doesn't do so. It's a timer, not a heating plan.