Toon

From Domoticz
Jump to: navigation, search

Eneco Toon

If you have a (Dutch) Eneco 'Toon' thermostat you can now add this natively into Domoticz.

username:(email address)
password:xxxxx

This can be added to the Toon Hardware as shown:

Toon-Hardware.png

Go to your Devices and make a note of the IDX of the SetPoint device:

Toon-SetPoint-IDX.png

To set the SetPoint value edit the SetPoint utility device and set the SetPoint temperature:

SetPoint Adjust.png

JSON Calls

there are two json calls you can use to set the SetPoint and Program states:

For this you need to know the 'Idx' value of the SetPoint sensor. This can be found in the utility tab.

For this tutorial we are going to use the value 28 (same Idx as shown in the images below)

setting the setPoint via json

/json.htm?type=command&param=udevice&idx=28&nvalue=0&svalue=12.3

setting the programState via json

/json.htm?type=command&param=thermostatstate&idx=28&state=3

where the state equals:

STATE_RELAX = 0    [Comfort]
STATE_ACTIVE = 1   [Home/Thuis]
STATE_SLEEP = 2    [Sleep/Slapen]
STATE_AWAY = 3     [Away/Weg]
STATE_HOLIDAY = 4  [Holiday/Vakantie]

Mode Selector Switch

Create a selector switch with virtual hardware or switch and choose selector as switch type. Fill in the level names...

Toon-Selector Switch.png

With the json commands knowledge from above, fill in the fields as in my example. Change the ip address to your local Domoticz ip address. I have created an optional "Off" level which i use when the wheather is warmer during the summer.

To save you some time, the Selector Actions for the various Levels can be copied from the following (make sure to replace the IP Address, Port and SetPointIDX (bold text) with your own)


http://192.168.1.1:8080/json.htm?type=command&param=thermostatstate&idx=28&state=4

http://192.168.1.1:8080/json.htm?type=command&param=thermostatstate&idx=28&state=3

http://192.168.1.1:8080/json.htm?type=command&param=thermostatstate&idx=28&state=2

http://192.168.1.1:8080/json.htm?type=command&param=thermostatstate&idx=28&state=1

http://192.168.1.1:8080/json.htm?type=command&param=thermostatstate&idx=28&state=0


The finished switch looks like this:

Toon-Selector Switch (finished).png

Now if all is done, each level switch will send the commands to your Toon to set it's state.

But how will the selector know in which state the Toon is???

Well, the selector will get updated by...

The Script

This script updates the selector level, so it doesn't execute the command actions. This way when a user operates the Toon, it will not get a second command from the selector switch.

-- script_time_toonselector.lua
-- Reads the Toon Thermostat Setpoint Temperature and updates the
-- selector in Domoticz to represent the current Active State.
-- Off scene is an option, leave it out if not needed.
-- Action commands will not be executed.
 
commandArray = {}
 
-- Settings: Configure as desired
 
-- Name of the switch with the temperature setpoint.
ThermostatSetPointName = 'Room Setpoint' --Must match the name of you SetPoint device
 
-- Temperature SetPoints.
OffSetPoint = '6.00' --optional 
AwaySetPoint = '17.50'
SleepSetPoint = '19.00' 
HomeSetPoint = '20.50'   
ComfortSetPoint = '21.00'
 
-- Name of the selector for Toon
ToonSelector = 'Toon Scenes' --Must match (including case) the name of your Selector Switch
 
-- Name of the levels in the selector
OffLevel = 'Off' --optional
AwayLevel = 'Away'
SleepLevel = 'Sleep'
HomeLevel = 'Home'
ComfortLevel = 'Comfort'
 
-- Values from each level name
OffLevelValue = '0' --optional
AwayLevelValue = '10'
SleepLevelValue = '20'
HomeLevelValue = '30'
ComfortLevelValue = '40'
 
-- End of settings
 
-- Toon Thermostat SetPoint:
ThermostatSetPoint = otherdevices_svalues[ThermostatSetPointName]
 
if (ThermostatSetPoint == HomeSetPoint) then
        --print("SetPoint equals to Home");
		if (otherdevices[ToonSelector] ~= HomeLevel) then
		print("Updating '" .. ToonSelector .. "' selector to '" .. HomeLevel .. "'")
		commandArray['UpdateDevice'] = otherdevices_idx[ToonSelector]..'|1|'..HomeLevelValue
		end
 
elseif (ThermostatSetPoint == ComfortSetPoint) then
        --print("SetPoint equals to Comfort");
		if (otherdevices[ToonSelector] ~= ComfortLevel) then
		print("Updating '" .. ToonSelector .. "' selector to '" .. ComfortLevel .. "'")
		commandArray['UpdateDevice'] = otherdevices_idx[ToonSelector]..'|1|'..ComfortLevelValue
		end
 
elseif (ThermostatSetPoint == SleepSetPoint) then
        --print("SetPoint equals to Sleep");
		if (otherdevices[ToonSelector] ~= SleepLevel) then
		print("Updating '" .. ToonSelector .. "' selector to '" .. SleepLevel .. "'")
		commandArray['UpdateDevice'] = otherdevices_idx[ToonSelector]..'|1|'..SleepLevelValue
		end
 
elseif (ThermostatSetPoint == AwaySetPoint) then
        --print("SetPoint equals to Away");
		if (otherdevices[ToonSelector] ~= AwayLevel) then
		print("Updating '" .. ToonSelector .. "' selector to '" .. AwayLevel .. "'")
		commandArray['UpdateDevice'] = otherdevices_idx[ToonSelector]..'|1|'..AwayLevelValue
		end
 
-- Optional		
elseif (ThermostatSetPoint == OffSetPoint) then
        --print("SetPoint equals to Off");
		if (otherdevices[ToonSelector] ~= OffLevel) then
		print("Updating '" .. ToonSelector .. "' selector to '" .. OffLevel .. "'")
		commandArray['UpdateDevice'] = otherdevices_idx[ToonSelector]..'|1|'..OffLevelValue
		end
end
 
return commandArray

Good luck! And have fun!