Page 1 of 1

Essent ICY Thermostat

Posted: Tuesday 11 August 2015 21:50
by JuanUil
Hi Folks,

I had a lot of problems finding the right way to control my Essent Thermostat.
Especially for putting it in a continuous temperature mode.
I have found a way of doing this by a Lua scipt.
Maybe it is old news for a lot of you but maybe some beginners (like me) find it helpfull.
I have made a dummy switch Constant temperature and one called home or away.
Further on I have made the heating program for workdays and weekend so now you can delete the programming in the thermostat.
Any questions don't hesitate to reply

Enjoy
Juan

Code: Select all

-- ~/domoticz/scripts/lua/script_device_Thermostaat.lua

commandArray = {}

-- bepalen dag, tijd, setpoint en kamertemperatuur
dag = tostring(os.date("%a"));
uur = tonumber(os.date("%H"));
min = tonumber(os.date("%M"));
setpoint = tonumber(otherdevices_svalues['Room Setpoint'])
werkelijk= tonumber(otherdevices_svalues['Room Temperature'])

-- Temperatuur instellingen
dagtemperatuur = 20.5
nachttempteratuur = 15
vorstbeveiliging = 10

-- Bepaling werkweek of weekend
if (dag=='Mon' or dag=='Tue' or dag=='Wen' or dag=='Thu' or dag=='Fri') then
	werkweek = true; weekend = false
elseif (dag=='Sat' or dag=='Sun') then
	werkweek = false ; weekend = true 
end

-- Als we thuis zijn temperatuur instellen volgens een schema
-- Als er een constante temperatuur is ingesteld dan deze volgen
if (otherdevices['Thuis']=='On' and otherdevices['Vaste temperatuur']=='Off') then


-- Dagtemperatuur instellen voor werkdagen en weekend
	if (werkweek and uur==7 and min==0 and setpoint<dagtemperatuur) then
		setpoint=dagtemperatuur
		set = "6|0|" .. setpoint
		commandArray ['UpdateDevice']= '6|0|' .. setpoint  
	elseif (weekend and uur==8 and min==0 and setpoint<dagtemperatuur) then
		setpoint=dagtemperatuur
		set = "6|0|" .. setpoint
		commandArray ['UpdateDevice']= '6|0|' .. setpoint  
	end

-- Nachttemperatuur instellen voor werkdagen en weekend
	if (werkweek and uur==22 and min==30 and setpoint>nachttempteratuur) then
		setpoint=nachttempteratuur
		set = "6|0|" .. setpoint
		commandArray ['UpdateDevice']= '6|0|' .. setpoint  
	elseif (weekend and uur==23 and min==30 and setpoint>nachttempteratuur) then
		setpoint=nachttempteratuur
		set = "6|0|" .. setpoint
		commandArray ['UpdateDevice']= '6|0|' .. setpoint  
	end
	
end

if (devicechanged['Thuis']=='Off') then
--	print ('Het is vandaag : '.. dagned)
--	print ('Het Setpoint= : '.. setpoint)
	setpoint=vorstbeveiliging
--	print ('Het is aangepast naar : '.. setpoint)
	set = "6|0|" .. setpoint
	commandArray ['UpdateDevice']= '6|0|' .. setpoint  
	commandArray ['Vaste temperatuur']= 'On'
end

if (otherdevices['Vaste temperatuur']=='On' and otherdevices['Thuis']=='On' and setpoint<dagtemperatuur) then
	setpoint=dagtemperatuur
	set = "6|0|" .. setpoint
	commandArray ['UpdateDevice']= '6|0|' .. setpoint  
end

return commandArray


Re: Essent ICY Thermostat

Posted: Wednesday 04 November 2015 9:13
by raymond
Great script first of all. I have done it through a work around but get stuck a little.
I have created multiple virtual switches (which you can use in blocky too) to get more programmed Temperatures and times. The standard ICY is too limited.

On the Virtual Set Point, I have used the Timers function, which follows the same concept as your script.

The one thing that I want to do is to disable the Timers when I'm long gone. I have created a group of virtual switch for this too, but that goes by On and Off actions through JSON.
It's a bit tricky, but as soon as you read the JSON commands (Chrome browser) you can actually use them.
The one thing I wonder about, is the command I use now "sets" the timers each and every time, and switches them On or Off.

Code: Select all

http://192.168.200.6:8084/json.htm?type=command&param=updatesetpointtimer&idx=2&active=true&timertype=2&date=11/03/2015&hour=7&min=0&tvalue=18&days=256
Does anybody know if there are other commands for the &param=updatesetpointtimer? (idx is the idx of the timer, not the device)

If I leave anything out, the JSON return with an error. Just using &active=false would do the trick, but gives an error too.

The general idea is to have the Timers function do it's work, and have a Override button (Group) to switch each timer Off.

Cheers,

Ray

Re: Essent ICY Thermostat

Posted: Wednesday 04 November 2015 10:57
by D'rMorris
Nice script! I have one remark: I think you can better retrieve your temperature settings via uservariables.
So, in stead of:

Code: Select all

-- Temperatuur instellingen
dagtemperatuur = 20.5
nachttempteratuur = 15
vorstbeveiliging = 10
do:

Code: Select all

dagtemperatuur = uservariables["dagtemperatuur"]
nachttempteratuur = uservariables["nachttempteratuur"]
vorstbeveiliging = uservariables["vorstbeveiliging"]
You can then set those values in the Domoticz uservariables settings. This is much easier to update when you want to change it. Next to that, you can also update the variables with another script for example.
Same goes for the if statement with the hours:

Code: Select all

if (werkweek and uur==7 ...
You can better put this in uservariables, much easier :).

Re: Essent ICY Thermostat

Posted: Sunday 08 November 2015 22:45
by JuanUil
Tnx for your comments
I have taken them to my new script which is in viewtopic.php?f=38&t=8799&p=60861#p60861
Tnx again for your possitive replies!!
Jan