Script for Toon

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Iwannetjes
Posts: 12
Joined: Wednesday 27 April 2016 21:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Script for Toon

Post by Iwannetjes »

Hi everyone,

I connected my Eneco Toon in Domoticz....
i used this tutorial
https://www.domoticz.com/wiki/Toon

and i see my toon and temperature and made a virtual switch ,
but it says something about a script :? but i dont know where to put it and how ???
can someone please help me???

this is the script :

-- 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 wil not be executed.

commandArray = {}

-- Settings: Configure as desired

-- Name of the switch with the temperature setpoint.
ThermostatSetPointName = 'Room Setpoint'

-- Temperature SetPoints.
HomeSetPoint = '20.50'
ComfortSetPoint = '21.00'
SleepSetPoint = '19.00'
AwaySetPoint = '17.50'
OffSetPoint = '6.00' --optional

-- Name of the selector for Toon
ToonSelector = 'Toon scenes'

-- Name of the levels in the selector
HomeLevel = 'Home'
ComfortLevel = 'Comfort'
SleepLevel = 'Sleep'
AwayLevel = 'Away'
OffLevel = 'Off' --optional

-- Values from each level name
HomeLevelValue = '30'
ComfortLevelValue = '40'
SleepLevelValue = '20'
AwayLevelValue = '10'
OffLevelValue = '0' --optional

-- 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] ~= 'Sleep') 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] ~= 'Away') 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] ~= 'Off') then
print("Updating '" .. ToonSelector .. "' selector to '" .. OffLevel .. "'")
commandArray['UpdateDevice'] = otherdevices_idx[ToonSelector]..'|1|'..OffLevelValue
end
end

return commandArray
amens
Posts: 7
Joined: Tuesday 03 May 2016 10:42
Target OS: Windows
Domoticz version:
Contact:

Re: Script for Toon

Post by amens »

It's a LUA script, you can set it in Settings -> Events. Actually, there is no need to enter the script if you don't want to read the current state of Toon.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest