Page 7 of 22
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 13 November 2017 8:50
by gielie
FunFair wrote: ↑Sunday 12 November 2017 20:30
Not that much, just change the parser to read the value from the correct dev_x and do some editing to the calculations. If you can wait a few days I'll change it for elec and gas aswell.
That would be great, thanks.
One other thing, i do have high and low tariv but i cant figure this out from the output i have created, how do i read this?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 13 November 2017 12:30
by FunFair
gielie wrote: ↑Monday 13 November 2017 8:50
FunFair wrote: ↑Sunday 12 November 2017 20:30
Not that much, just change the parser to read the value from the correct dev_x and do some editing to the calculations. If you can wait a few days I'll change it for elec and gas aswell.
That would be great, thanks.
One other thing, i do have high and low tariv but i cant figure this out from the output i have created, how do i read this?
Try the script attached as a file. I've replaced dev_3.3 to dev_3.2 and removed the adding of the 2 tariffs.
If you don't have a smart meter I don't know if it's possible to differentiate between low and normal tariff. Toon does not store these values seperately to my knowledge.
The gas readout script does not have to be altered.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 13 November 2017 15:31
by gielie
This works perfect, thanks.
I keep wondering how my Toon makes the difference between the high and low tarief, maybe its a time thing.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 15 November 2017 15:56
by anandus
terrorsource wrote: ↑Wednesday 10 May 2017 17:59
[...]
Is working, but gives an error in logs:
Error: EventSystem: in ToonThermostat: [string "-- Script used for Toon Thermostaat utility d..."]:8: bad argument #1 to 'pairs' (table expected, got nil)
[...]
Did you find out how to fix this?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Friday 17 November 2017 15:55
by gielie
Im using the Toon script from the ts and its working great, i only want to add 1 thing and i cant get it to work by myself.
Code: Select all
if currentProgramState == 0 then currentProgramState = '10' -- No
elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary
end
I want to add something to the last rule, when currentProgramState == 2 set currentProgramState ='20' After 30 minutes.
So it goes back to the program after Toon is set manualy.
How can i achieve this, someone here who can help me with this?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Sunday 10 December 2017 15:59
by DennisD
I updated my toon to 4.9.23 and the happ_thermstat did changed somewhat. I used the previous happ_thermstat to see if my boiler was on for my hot water or heating to switch some things (rollerblinds when i was taking a shower, and using dbe on my convector when heating was on), unfortunately this was gone after I upgraded. I therefore made some changes to the original script_toon_time.lua so i have a selector switch which would switch between off, hotwater and heating, in order to get things working again like i wanted.
Add the following user variable UV_ToonBurnerName , type string , name Branderinfo
Add the following selector switch : Name it Branderinfo and change the levels to: 0:OFF 1:CV 2:WW (delete the 3rd)
Now copy and paste the code to a text editor and name it script_time_toon.lua and upload it to your lua folder.
Code: Select all
-- Time script runs every minute, intended to sync Domoticz with Toon in case the value is changed on the physical device.
-- Updates Toon Thermostat Sensor to value set on Toon
-- Updates Toon Temperature Sensor to value set on Toon
-- Updates Toon Scenes switch based on program set on Toon
-- Updates Toon Auto Program switch to value set on Toon
-- Updates Toon program information text to value set on Toon
-- Udates Toon Burner status in order to see in domoticz if tyou boiler is on for the hotwater or heating or off (still is a undefined number which i must hunt down)
commandArray = {}
ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
ToonScenesSensorName = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
ToonBurnerName = uservariables['UV_ToonBurnerName']
ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
ToonIP = uservariables['UV_ToonIP']
DomoticzIP = uservariables['UV_DomoticzIP']
json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")() -- For Raspberry
local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
local ThermostatInfo = handle:read('*all')
handle:close()
-- JSON data from Toon contains a extra "," which should not be there.
ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")
jsonThermostatInfo = json:decode(ThermostatInfo)
currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
currentProgramState = tonumber(jsonThermostatInfo.programState)
currentActiveState = tonumber(jsonThermostatInfo.activeState)
currentNextTime = jsonThermostatInfo.nextTime
currentBurnerInfo = tonumber(jsonThermostatInfo.burnerInfo)
currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
-- Update the thermostat sensor to current setpoint
if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
end
-- Update the temperature sensor to current room temperature
if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then
print('Updating the temperature sensor to new value: ' ..currentTemperature)
commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
end
-- Update the toon scene selector sensor to current program state
CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]
if currentActiveState == -1 then currentActiveState = '50' -- Manual
elseif currentActiveState == 0 then currentActiveState = '40' -- Comfort
elseif currentActiveState == 1 then currentActiveState = '30' -- Home
elseif currentActiveState == 2 then currentActiveState = '20' -- Sleep
elseif currentActiveState == 3 then currentActiveState = '10' -- Away
end
if CurrentToonScenesSensorValue ~= currentActiveState then -- Update toon selector if it has changed
print ('Updating Toon Scenes selector')
commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
end
-- Updates the toon auto program switch
CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]
if currentProgramState == 0 then currentProgramState = '10' -- No
elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary
end
if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
print ('Updating Toon Auto Program selector')
commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
end
-- Updates the toon program information text box
CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
if currentNextTime == 0 or currentNextSetPoint == 0 then
ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
else
ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
end
if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
end
-- Update the toon burner selector to current program state
CurrentToonBurnerValue = otherdevices_svalues[ToonBurnerName]
if currentBurnerInfo == 0 then currentBurnerInfo = '0' -- uit
elseif currentBurnerInfo == 1 then currentBurnerInfo = '10' -- cv aan
elseif currentBurnerInfo == 2 then currentBurnerInfo = '20' -- warmwater aan
end
if CurrentToonBurnerValue ~= currentBurnerInfo then -- Update toon burner selector if it has changed
print ('Updating Toon burner info')
commandArray[7] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonBurnerName], currentBurnerInfo)}
end
--
return commandArray
Re: Controlling Toon [HACKED] from Domoticz
Posted: Tuesday 12 December 2017 21:09
by michel30
Hello All,
Thanks for explain how I can connect my Toon in Domoticz this works great
Now I want to add Toon in Siri, I can switch my lights on in Siri with Domoticz, but Toon I don't get in
I see Toon Auto Program as light switch and Toon Scenes as Light switch, I cannot use this in apple home kit so properly I do something wrong.
I also can not see the temperature etc.
This is how I set it up:
Re: Controlling Toon [HACKED] from Domoticz
Posted: Friday 15 December 2017 9:26
by ronalddehaan
Hi guys, I've asked this before but unfortunately, there has been no reply yet
Can someone help me with a 'dummy' manual to add the rooted Toon to Domoticz?
I've tried it with OP's write-up, but I kept running into things that weren't clear to me. I'm no Domoticz guru
I am running Domoticz on a Windows 7 VM, on an ESXi6 host.
Until now I've been able to get everything up and running, but adding Toon this way is proving to be a bit too technical for me
If someone can send me clear instructions about the proper steps in the right order, I will happily write down a nice manual for everyone

Re: Controlling Toon [HACKED] from Domoticz
Posted: Friday 15 December 2017 19:56
by michel30
Where are you stuck?
Did install the scrip?
Did you add the variable?
if you did that, than you can add a dummy file.
After that you can edit these dummy files..
I am stuck that I see my dummy file in siri but it a light switch, I also cannot say heee Siri what is the tempature.
Regards,
Michel
Re: Controlling Toon [HACKED] from Domoticz
Posted: Tuesday 19 December 2017 22:16
by michel30
@DennisD
I updated my toon to 4.9.23 but for some how the Toon Temperature does not work anymore it stays on 0
The Toon Program Information stay on hello world
The Toon Thermostat is doing nothing.
I delete these 3 in Domoticz and recreate it again like on the first page.
I upload the script in the LUA directory but nothing happens
The only thing what I can see in the log is:
2017-12-19 21:59:00.678 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_toon.lua: /home/pi/domoticz/scripts/lua/script_time_toon.lua:41: attempt to perform arithmetic on field '?' (a nil value)
In line 41 I see this: if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
IPtoon/happ_thermstat?action=getThermostatInfo I see this:
result: "ok",
currentTemp: "2282",
currentSetpoint: "1900",
currentInternalBoilerSetpoint: "6",
programState: "2",
activeState: "-1",
nextProgram: "1",
nextState: "2",
nextTime: "1513719000",
nextSetpoint: "1700",
randomConfigId: "1804289383",
errorFound: "255",
connection: "0",
burnerInfo: "0",
otCommError: "0",
currentModulationLevel: "0"
I don't known why this is not working anymore, I hope you could help me with this one.
Thanks..
Regards,
Michel
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 20 December 2017 19:37
by Eggybert
Hello,
I'm also a new guy who bought an toon on Marktplaats.
I rooted the toon with no trouble but the firmware was really old. (3.0.36 or something)
I successfully update to 4.10.6 and still have root acces. (I couldn't edit the base-qb2-ene_4.10.6-1196-0_qb2 to keep ssh access, encrypted?)
But I have some trouble getting happ_thermstat? to work. (403)
If I understand it correct the way the website works you can only access qmf/www/
In this folder I can acces all the folder without getting the 403 error. (changed the forcedwhitelist=0 for this)
But in this firmware the folder happ_thermstat or anything that has to do with it is missing. (see attachments)
I can only find happ_thermstat in qmf/sbin/happ_thermstat. but this looks like the actual program.
Can anyone show me how the www looks like in older firmware version when the /happ_thermstat?action=getThermostatInfo is working.
Edit:
Never mind, I start to understand the file structure better.
The sbin folder can also be executed (please correct me if I'm wrong)
I get 403 on all files there except hdrv_hue and hdrv_zwave (these are on the whitelist)
So it looks like the whitelist 0 is not working.
I can only find the whitelist in /qmf/etc/qmf_release.xml
I tried without luck:
Code: Select all
<hcb_web>
<port>10080</port>
<defaultEntry>/qmf/www/</defaultEntry>
<enforceWhitelist>0</enforceWhitelist>
<whitelist>
<item>hdrv_zwave</item>
<item>hdrv_hue</item>
<item>happ_thermstat</item>
</whitelist>
</hcb_web>
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 20 December 2017 22:24
by michel30

I found my problem
I had an space after in the user variable at the end of some of these words UV_ToonTemperatureSensorName
So good to know that you always need to check that you don't make an mistake like an space at the end

Re: Controlling Toon [HACKED] from Domoticz
Posted: Friday 22 December 2017 22:14
by michel30
FunFair wrote: ↑Monday 13 November 2017 12:30
gielie wrote: ↑Monday 13 November 2017 8:50
FunFair wrote: ↑Sunday 12 November 2017 20:30
Not that much, just change the parser to read the value from the correct dev_x and do some editing to the calculations. If you can wait a few days I'll change it for elec and gas aswell.
That would be great, thanks.
One other thing, i do have high and low tariv but i cant figure this out from the output i have created, how do i read this?
Try the script attached as a file. I've replaced dev_3.3 to dev_3.2 and removed the adding of the 2 tariffs.
If you don't have a smart meter I don't know if it's possible to differentiate between low and normal tariff. Toon does not store these values seperately to my knowledge.
The gas readout script does not have to be altered.
Do you need to install PHP on the Raspberry pi1 ?
For me it is not working when I try this command: ./analog_electricity_data_json.php I received this error message
-bash: ./analog_electricity_data_json.php: /usr/bin/php: bad interpreter: No such file or directory
When I check the folder /usr/bin there is no map PHP.
On my Raspberry I have Domoticz running.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Saturday 23 December 2017 15:38
by Eggybert
Eggybert wrote: ↑Wednesday 20 December 2017 19:37
Code: Select all
<hcb_web>
<port>10080</port>
<defaultEntry>/qmf/www/</defaultEntry>
<enforceWhitelist>0</enforceWhitelist>
<whitelist>
<item>hdrv_zwave</item>
<item>hdrv_hue</item>
<item>happ_thermstat</item>
</whitelist>
</hcb_web>
After installing the toon store and change the qmf_release.xml to the following it's working now.
The project
Code: Select all
<hcb_web>
<defaultEntry>/hdrv_zwave/</defaultEntry>
<enforceWhitelist>0</enforceWhitelist>
<whitelist>
<item>hdrv_zwave</item>
<item>hdrv_hue</item>
</whitelist>
</hcb_web>
Re: Controlling Toon [HACKED] from Domoticz
Posted: Saturday 23 December 2017 20:26
by michel30
Hello,
PHP is now working on my raspberry pi and I install the gas_data_json.php and analog_electricity_data_json.php meters.
I changed the IP adress plus IDX.
I had needed also to 3.1 to dev 2.1 and 2.2 because when I open the website of the toon there was no dev 3.1 and I had an error in this scrip.
the only two problem for now is this:
for the gas_data_json.php:
./gas_data_json.php
PHP Notice: Undefined index: result in /home/pi/domoticz/scripts/p1_meter/gas_data_json.php on line 36
Gas Value Domoticz = 0 liters
Gas Value Toon = 7360.00 liters
{
"status" : "ERR"
}
and for the analog_electricity_data_json.php:
./analog_electricity_data_json.php
PHP Notice: Undefined index: result in /home/pi/domoticz/scripts/p1_meter/analog_electricity_data_json.php on line 42
Electricity Counter Domoticz = 0 Wh
Electricity Counter Toon = 123970.00 Wh
Electricity Usage Toon = 743 Watt
{
"status" : "ERR"
}
I don't know where this error is comming from so hopefully somebody could help me.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Tuesday 26 December 2017 17:20
by michel30
Finaly I found my issue.
IDX was on hardware not on device now it is working for me also with analog meter.
Does somebody knows how I can get TOON in siri?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 28 December 2017 12:06
by glsf91
Is it possible to switch the Holiday on/off on Toon from domoticz?
If yes, how can I do this?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Saturday 30 December 2017 19:59
by michel30
Yes you can
Go to setup > more options > events
On the left you will see things what you can conrol so you could say I am on holiday so to this with my Toon. etc.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Saturday 30 December 2017 21:36
by glsf91
michel30 wrote: ↑Saturday 30 December 2017 19:59
Yes you can
Go to setup > more options > events
On the left you will see things what you can conrol so you could say I am on holiday so to this with my Toon. etc.
That is also some solution.
But I was referring to the holiday function in Toon itself.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 03 January 2018 20:08
by glsf91
I have another strange problem with using dzVents on Toon Temperature device:
When I use this code time triggered it works fine:
Code: Select all
return {
active = true,
on = {
timer = {
'every minute'
}
},
execute = function(domoticz, device)
domoticz.log('Script temp active')
if ( domoticz.devices('Toon Temperature').temperature >= 19.0 ) then
domoticz.log('Toon temp te hoog')
end
end
}
But if I do almost the same with device triggered:
Code: Select all
return {
active = true,
on = {
devices = {
'Toon Temperature'
}
},
execute = function(domoticz, device)
domoticz.log('Script TempKamerTeHoog active')
if (device.temperature >= 19.0 ) then
domoticz.log('Temperatuur kamer is te hoog')
end
end
}
it won't work. It never gets triggered.
I use ToonGetInfo from a few posts
https://www.domoticz.com/forum/posting. ... 1#pr161078 above this post.
In the log I see:
2018-01-03 20:02:00.471 LUA: Updating the temperature sensor to new value: 20.26
2018-01-03 20:02:00.471 EventSystem: Script event triggered: ToonGetInfo
but not followed by logging from above script.
So why is updating Toon Temperature not triggering the device script?
I'am using beta V3.8755.