Page 1 of 1

thermostat

Posted: Saturday 02 October 2021 6:12
by Cdzn
Hello there. I have thermostat and would like to heat and cool in time. I wrote these script but can`t change setpoint from it.

Code: Select all

local timer1 = 'every minute' --'at 06:00'
return {
    	on = {
		timer = { timer1}
			 },
			  logging = { level = domoticz.LOG_DEBUG },
			  
		   execute = function(domoticz,item,devices)
		     
		    if (item.isTimer) then domoticz.devices(3).SetPoint= 26
		  
	 end
 end
}
Setpoint just don`t setting at thermostat

Re: thermostat  [Solved]

Posted: Saturday 02 October 2021 8:29
by besix
Change

Code: Select all

if (item.isTimer) then domoticz.devices(3).SetPoint= 26
to

Code: Select all

if (item.isTimer) then domoticz.devices(3).updateSetPoint(26)

Re: thermostat

Posted: Saturday 02 October 2021 9:08
by Cdzn
besix wrote: Saturday 02 October 2021 8:29 Change

Code: Select all

if (item.isTimer) then domoticz.devices(3).SetPoint= 26
to

Code: Select all

if (item.isTimer) then domoticz.devices(3).updateSetPoint(26)
What I just didn’t do. Thanks. Why setpoint does`t work?

Re: thermostat

Posted: Saturday 02 October 2021 9:46
by EddyG

Re: thermostat

Posted: Saturday 02 October 2021 9:47
by besix

Code: Select all

return {
	on = {
		timer = {'every minute'},				-- causes the script to be called every minute
				 },
			  logging = { level = domoticz.LOG_DEBUG },
			  
		   execute = function(domoticz,item)
		     
		    if (item.isTimer) then 
		        domoticz.devices('SetPoint').updateSetPoint(26)
	   end
 end
}
Rename SetPoint to your thermostat and check

Re: thermostat

Posted: Saturday 02 October 2021 12:33
by Cdzn
besix wrote: Saturday 02 October 2021 9:47

Code: Select all

return {
	on = {
		timer = {'every minute'},				-- causes the script to be called every minute
				 },
			  logging = { level = domoticz.LOG_DEBUG },
			  
		   execute = function(domoticz,item)
		     
		    if (item.isTimer) then 
		        domoticz.devices('SetPoint').updateSetPoint(26)
	   end
 end
}
Rename SetPoint to your thermostat and check
Your 1st answer working. Thank You! every minure just for testing.

Re: thermostat

Posted: Saturday 02 October 2021 14:49
by Cdzn
One more question. How to make this work with 2 different timers
Spoiler: show

Code: Select all

local Timer1 = 'at 19:43'
local Timer2 = 'at 19:44'
return {
    	on = {
    	    timer = {Timer1, Timer2}
			 },
			  logging = { level = domoticz.LOG_DEBUG },
			  
		   execute = function(domoticz,item,devices)
		     
		    if (item.isTimer) then domoticz.devices(3).updateSetPoint(26)
		        return
		            end
		    if (item.isTimer) then domoticz.devices(3).updateSetPoint(24.5)
		        return
		        	end
		    
 end
}

Re: thermostat

Posted: Saturday 02 October 2021 17:47
by besix
I think it will help

Code: Select all

return 
{
	on = 
	   {timer = 
		   {'at 8:00',
		    'every 3 minutes between 9:30 and 23:00',
                    'at 23:01' }
        },
	logging = { level = domoticz.LOG_DEBUG },
		
	execute = function(dz, item)
    if item.isTimer then 
    if dz.time.matchesRule('at 8:00') then
        dz.devices('SetPoint').updateSetPoint(24)
		end
	if dz.time.matchesRule('every 3 minutes between 9:30 and 23:00') then
        dz.devices('SetPoint').updateSetPoint(23)	
            end
	if dz.time.matchesRule('at 23:01') then
        dz.devices('SetPoint').updateSetPoint(21)	
    end
  end
end
}

Re: thermostat

Posted: Saturday 02 October 2021 17:57
by Cdzn
besix wrote: Saturday 02 October 2021 17:47 I think it will help

Code: Select all

return 
{
	on = 
	   {timer = 
		   {'at 8:00',
		    'every 3 minutes between 9:30 and 23:00',
                    'at 23:01' }
        },
	logging = { level = domoticz.LOG_DEBUG },
		
	execute = function(dz, item)
    if item.isTimer then 
    if dz.time.matchesRule('at 8:00') then
        dz.devices('SetPoint').updateSetPoint(24)
		end
	if dz.time.matchesRule('every 3 minutes between 9:30 and 23:00') then
        dz.devices('SetPoint').updateSetPoint(23)	
            end
	if dz.time.matchesRule('at 23:01') then
        dz.devices('SetPoint').updateSetPoint(21)	
    end
  end
end
}
Thank You!!!

Re: thermostat

Posted: Monday 04 October 2021 20:50
by rrozema
Many thermostats have a 'mode' setting, switching between 'economy' and 'normal' modes. Both modes have their own setpoint, so you need to set the both temperatures only once, and you only switch the mode control from economy to normal and vice versa. This allows you to still adjust the 'normal' setpoint manually without having to re-code your script.

If your thermostat doesn't have such an economy mode, have a look at SVT, the Smart Virtual Thermostat plugin. If you can switch your heating on and off from domoticz using for example a simple esp relay, use this plugin to replace your normal thermostat and most likely you'll get better comfort plus on top of that use less energy for heating your house.

Re: thermostat

Posted: Wednesday 13 October 2021 11:45
by Cdzn
rrozema wrote: Monday 04 October 2021 20:50 Many thermostats have a 'mode' setting, switching between 'economy' and 'normal' modes. Both modes have their own setpoint, so you need to set the both temperatures only once, and you only switch the mode control from economy to normal and vice versa. This allows you to still adjust the 'normal' setpoint manually without having to re-code your script.

If your thermostat doesn't have such an economy mode, have a look at SVT, the Smart Virtual Thermostat plugin. If you can switch your heating on and off from domoticz using for example a simple esp relay, use this plugin to replace your normal thermostat and most likely you'll get better comfort plus on top of that use less energy for heating your house.
The problem is i using handmade thermostate with Nextion display and internal ESPeasy thermostat, not in domoticz, to have a possibility to change setpoint from Domoticz or from touchscreen.
NExt step i want to make script like this, which remember last setpoint, turn thermostate ON, after 30 minutes return setpoint to last value.

Code: Select all

return {
	on = {
		devices = {
			'Принудительный нагрев',
					}
	},
	logging = {
		level = domoticz.LOG_INFO,
		marker = 'template',
	},
	execute = function(domoticz, switch)
	  --local Lastsp = domoticz.devices(3).updateSetPoint(25)   
	    if (switch.state == 'On')
	    then domoticz.devices(3).updateSetPoint(27)
	         switch.switchOff().afterMin(30)
	      elseif (switch.state == 'Off')
            then domoticz.devices(3).updateSetPoint(24)
end
end
}

Re: thermostat

Posted: Wednesday 13 October 2021 16:13
by rrozema
If you are in control om the software inside the thermostat, why don't you rewrite it to be a device to show and enter a setpoint only. The setpoint set is sent into a setpoint device in Domoticz Then have your Domoticz do the actual work of regulating the heat source. For example by using svt.

Re: thermostat

Posted: Thursday 14 October 2021 11:45
by Cdzn
rrozema wrote: Wednesday 13 October 2021 16:13 If you are in control om the software inside the thermostat, why don't you rewrite it to be a device to show and enter a setpoint only. The setpoint set is sent into a setpoint device in Domoticz Then have your Domoticz do the actual work of regulating the heat source. For example by using svt.
I have no idead how to make it works

Re: thermostat

Posted: Thursday 14 October 2021 22:04
by rrozema
Cdzn wrote: Thursday 14 October 2021 11:45
rrozema wrote: Wednesday 13 October 2021 16:13 If you are in control om the software inside the thermostat, why don't you rewrite it to be a device to show and enter a setpoint only. The setpoint set is sent into a setpoint device in Domoticz Then have your Domoticz do the actual work of regulating the heat source. For example by using svt.
I have no idead how to make it works
Never mind. When you said
The problem is i using handmade thermostate with Nextion display and internal ESPeasy thermostat, not in domoticz, to have a possibility to change setpoint from Domoticz or from touchscreen.
I assumed you had written the software in the thermostat yourself.