Page 4 of 5
Re: Toon Energy Readings on Domoticz
Posted: Tuesday 23 February 2016 11:43
by gielie
marktn wrote:Maybe a good wiki is an idea? I see a lot in this post. But don“t know where to start.
send from tapatalk app.
Start with the basics, how to read out Toon and create a switch.
Re: Toon Energy Readings on Domoticz
Posted: Wednesday 24 February 2016 10:11
by MatthijsPH
gielie wrote:
Could you post the complete code and the name of your switches so I can compare.
my script "script_variable_verwarming.lua" looks like this:
Code: Select all
local toonState = 'varToonState'
local toonScene = 'varToonScene'
local toonSwitch= 'toonScenes'
commandArray = {}
if uservariablechanged[toonState] then
if uservariables[toonState] == 0 then
commandArray['Variable:' .. toonScene] = tostring('Comfort')
commandArray[toonSwitch]='Set Level 40'
print('Toon ingesteld op scene Comfort')
elseif uservariables[toonState] == 1 then
commandArray['Variable:' .. toonScene] = tostring('Thuis')
commandArray[toonSwitch]='Set Level 30'
print('Toon ingesteld op scene Thuis')
elseif uservariables[toonState] == 2 then
commandArray['Variable:' .. toonScene] = tostring('Slapen')
commandArray[toonSwitch]='Set Level 20'
print('Toon ingesteld op scene Slapen')
elseif uservariables[toonState] == 3 then
commandArray['Variable:' .. toonScene] = tostring('Weg')
commandArray[toonSwitch]='Set Level 10'
print('Toon ingesteld op scene Weg')
elseif uservariables[toonState] == 4 then
commandArray['Variable:' .. toonScene] = tostring('Overig')
commandArray[toonSwitch]='Set Level 0'
print('Toon ingesteld op scene Overig')
end
end
return commandArray
Re: Toon Energy Readings on Domoticz
Posted: Sunday 28 February 2016 15:18
by kurniawan77
gielie wrote:
Its not working, what is wrong?
Could you post the complete code and the name of your switches so I can compare.
Sorry for my delay... I didn't post the full script in the previous post because i thought it was kinda easy to figure it out. I am just starting with lua and wanted the script to be cofigurable so anyone can use it...
so here it is:
Code: Select all
-- 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
Just configure settings to yours... This script reads from the Toon setpoint
Screenshot:

Re: Toon Energy Readings on Domoticz
Posted: Sunday 28 February 2016 20:57
by marcoheijkoop
marcoheijkoop wrote:I'm getting this error when following above steps
Code: Select all
Traceback (most recent call last):
File "/usr/local/domoticz/var/scripts/toon2domoticz.py", line 33, in <module>
state = toon.get_program_state()
File "/usr/lib/python2.7/site-packages/Toon.py", line 108, in get_program_state
self.retrieve_toon_state()
File "/usr/lib/python2.7/site-packages/Toon.py", line 72, in retrieve_toon_state
raise Exception('Incomplete response')
Exception: Incomplete response
Still can't figure out what is wrong. If i check the line it looks likes i didn't get any response from Toon.
But i can't figure out why. If i login on Toon op Afstand everything looks fine
Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 13:50
by kurniawan77
Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 19:44
by marktn
Thanks for the wiki link! That helps a lot.
With
http://192.168.1.9:7979/json.htm?type=c ... 01&state=0 i can switch my toon.
Only with the virtual switch under domoticz, it doesn't work,
https://www.dropbox.com/s/nfypq3dmyd3sl ... 5.png?dl=0
I do see a error:
2016-03-01 19:36:45.071 Error: ToonThermostat: Error getting current state!
What is going wrong?
Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 19:58
by kurniawan77
I get that error once in a while too. It's just eneco's crap server. They go down sometimes...
Just got one btw...

Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 20:03
by marktn
kurniawan77 wrote:
I get that error once in a while too. It's just eneco's crap server. They go down sometimes...
Just got one btw...

Thanks! But it also doensn't switch. When i paste the link in my browsers it works, only not in domoticz with a virtual switch
Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 20:22
by kurniawan77
marktn wrote:kurniawan77 wrote:
I get that error once in a while too. It's just eneco's crap server. They go down sometimes...
Just got one btw...

Thanks! But it also doensn't switch. When i paste the link in my browsers it works, only not in domoticz with a virtual switch
That's strange, if it works in a browser then it should work in Domoticz, it does the same... Might try changing the IP to 127.0.0.1. Otherwise it's just a coincidence... You could check on eneco's forum for any info of the server being down or not.
Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 20:30
by marktn
kurniawan77 wrote:marktn wrote:kurniawan77 wrote:
I get that error once in a while too. It's just eneco's crap server. They go down sometimes...
Just got one btw...

Thanks! But it also doensn't switch. When i paste the link in my browsers it works, only not in domoticz with a virtual switch
That's strange, if it works in a browser then it should work in Domoticz, it does the same... Might try changing the IP to 127.0.0.1. Otherwise it's just a coincidence... You could check on eneco's forum for any info of the server being down or not.
I have changed the ip adress but no succes. I can give you access to domoticz? Maybe a setting that is wrong.
Is this normal?
In the browser it works, then a problem at eneco is not possible.
https://www.dropbox.com/s/h37h3942zv6md ... 6.png?dl=0
Re: RE: Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 20:44
by kurniawan77
Why is your idx in the last post 3901 and in this one 4305?
marktn wrote:kurniawan77 wrote:
That's strange, if it works in a browser then it should work in Domoticz, it does the same... Might try changing the IP to 127.0.0.1. Otherwise it's just a coincidence... You could check on eneco's forum for any info of the server being down or not.
I have changed the ip adress but no succes. I can give you access to domoticz? Maybe a setting that is wrong.
Is this normal?
In the browser it works, then a problem at eneco is not possible.
https://www.dropbox.com/s/h37h3942zv6md ... 6.png?dl=0
[/quote]
Re: RE: Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 20:52
by marktn
https://www.dropbox.com/s/6ks7yab3wj9ow ... 7.png?dl=0
4305 is the virtual switch. The level set 30% is normal?
kurniawan77 wrote:Why is your idx in the last post 3901 and in this one 4305?
marktn wrote:kurniawan77 wrote:
That's strange, if it works in a browser then it should work in Domoticz, it does the same... Might try changing the IP to 127.0.0.1. Otherwise it's just a coincidence... You could check on eneco's forum for any info of the server being down or not.
I have changed the ip adress but no succes. I can give you access to domoticz? Maybe a setting that is wrong.
Is this normal?
In the browser it works, then a problem at eneco is not possible.
https://www.dropbox.com/s/h37h3942zv6md ... 6.png?dl=0
[/quote]
Re: RE: Re: RE: Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 21:07
by kurniawan77
Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 21:08
by kurniawan77
Is your selector protected?
Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 21:08
by marktn
kurniawan77 wrote:
Yep, that level 30 home
Any other ideas to get it work? I can give you access to domoticz!?
send from tapatalk app.
Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 21:09
by kurniawan77
marktn wrote:kurniawan77 wrote:
Yep, that level 30 home
Any other ideas to get it work? I can give you access to domoticz!?
send from tapatalk app.
I could give it a try... Beloof niks
Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Tuesday 01 March 2016 21:22
by marktn
kurniawan77 wrote:marktn wrote:kurniawan77 wrote:
Yep, that level 30 home
Any other ideas to get it work? I can give you access to domoticz!?
send from tapatalk app.
I could give it a try... Beloof niks
See PM
Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: RE: Re: Toon Energy Readings on Domoticz
Posted: Wednesday 02 March 2016 9:38
by kurniawan77
marktn wrote:kurniawan77 wrote:marktn wrote:
Any other ideas to get it work? I can give you access to domoticz!?
send from tapatalk app.
I could give it a try... Beloof niks
See PM
Nailed it!!! Issue solved by configuring your local IP addresses in settings (no username and password)

Re: Toon Energy Readings on Domoticz
Posted: Wednesday 02 March 2016 10:10
by marktn
Thanks for helping!
send from tapatalk app.
Re: Toon Energy Readings on Domoticz
Posted: Wednesday 02 March 2016 14:08
by gielie
kurniawan77 wrote:gielie wrote:
Its not working, what is wrong?
Could you post the complete code and the name of your switches so I can compare.
Sorry for my delay... I didn't post the full script in the previous post because i thought it was kinda easy to figure it out. I am just starting with lua and wanted the script to be cofigurable so anyone can use it...
so here it is:
Great thanks, i finaly got it working.