Controlling Toon [HACKED] from Domoticz

For heating/cooling related questions in Domoticz

Moderator: leecollings

Maes
Posts: 34
Joined: Tuesday 05 April 2016 20:45
Target OS: -
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Maes »

Hi Walberg,

There are 2 ways to control Toon from domoticz;

- Through the setpoint (and subsequently the 1st LUA script I've posted.
- Through the selector switches (auto program & toon scenes).

When using the setpoint it's important to use the script I've posted. Take note that I've used several user variables that contain important information about the toon; IP, PORT, etc.

When you are implementing these scripts it's also important to test if your HTTP commands to the toon are working correctly by testing them in your own browser..

@EdwinK the wiki only tells you how to add a normal Toon, this topic explains how to add the "hacked" version..
walberg
Posts: 46
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by walberg »

Maes wrote: Sunday 01 October 2017 19:17 Hi Walberg,

There are 2 ways to control Toon from domoticz;

- Through the setpoint (and subsequently the 1st LUA script I've posted.
- Through the selector switches (auto program & toon scenes).
Strange, when ik use the selector switches, the toon changes for a few seconds but then goes back to its original position.
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

The first script seems not to be working for me, or I configured something wrong. I have no idea where I should enter a new setpoint for the temperature. Than again, I don't desire to enter a custom temperature.
I use the selector switches in combination with the 2nd script and all is working great. Getting the right temperatures, settings, etc.

I also tried to read the gas (and electricity) value from Toon into Domoticz from this post.
DennisD wrote: Wednesday 19 July 2017 20:59 Already figured out the gas usage, forgot to post it here :)

For the other values you want to pull from your toon, read this post (bit old, but files still function): https://www.domoticaforum.eu/viewtopic. ... oot#p77453 . I will attach all files to this post just to share!

For the gas_data_json file (modified electricity_data_json file):

Goto http://ip_toon/hdrv_zwave?action=getDevices.json and look for:

Code: Select all

"dev_3.1":{"uuid":"eneco-001-018946:hdrv_zwave_68927F8D936", "name":"HAE_METER_v2_1", "internalAddress":"3.1", "type":"gas", "supportsCrc":"0", "CurrentGasFlow":"0.00", "CurrentGasQuantity":"3080.00", "location":"(null)"},
. The most important bit is the dev_3.1 part because that can be different in other toons. Open gas_date_json.php and search for:

Code: Select all

$gasUsage= $parsed_json['dev_3.1']['CurrentGasQuantity']; 
now change the dev_3.1 to the one you have in the mentioned url. Make sure you change the ip_toon to the ip your toon has and also make a gasmeter (add virtual sensor) and fill in the idx. If you upload to mindergas you could also add your gas meter value to the following line:

Code: Select all

 $gasUsage= $parsed_json['dev_3.1']['CurrentGasQuantity'] + yourmetervalue;
Now domoticz will have the actual meter value and you can upload it to mindergas.
But I don't really understand what to do here. I'm quite new to domoticz, but can anyone explain how I implement this? Do I need to make new dummies, and upload the php files to my PI? or can I run it as a script in Domoticz? I really don't know :|
R0cc0
Posts: 7
Joined: Monday 26 January 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by R0cc0 »

I'm stuck with this as well.
Also my output from http://ip_toon/hdrv_zwave?action=getDevices.json doesn't have a dev_3.1
It looks like this:

Code: Select all

{ 
"dev_settings_device":{"uuid":"neco-001-002844:hdrv_zwave_104623C69244", "name":"settings_device", "internalAddress":"settings_device", "type":"settings_device", "supportsCrc":"49", "location":"(null)"},
"dev_3":{"uuid":"eneco-001-002844:hdrv_zwave_73123C62C14", "name":"FGWP011", "internalAddress":"3", "type":"FGWP011", "supportsCrc":"0", "supportedCC":"72 86 70 85 8e 25 73 32 31 7a", "TargetStatus":"-1", "CurrentElectricityFlow":"NaN", "CurrentElectricityQuantity":"NaN", "IsConnected":"0", "HealthValue":"1", "location":"(null)"},
"dev_4":{"uuid":"eneco-001-002844:hdrv_zwave_70223C6497C", "name":"HAE_METER_v2", "internalAddress":"4", "type":"HAE_METER_v2", "supportsCrc":"1", "supportedCC":"22 3c 3d 3e 56 60 70 72 7a 86 8b 73", "IsConnected":"1", "HealthValue":"10", "location":"(null)"},
"dev_4.1":{"uuid":"eneco-001-002844:hdrv_zwave_7024873497D", "name":"HAE_METER_v2_1", "internalAddress":"4.1", "type":"gas", "supportsCrc":"0", "CurrentGasFlow":"0.00", "CurrentGasQuantity":"50690.00", "location":"(null)"},
"dev_4.2":{"uuid":"eneco-001-002844:hdrv_zwave_7025CFF497D", "name":"HAE_METER_v2_2", "internalAddress":"4.2", "type":"elec", "supportsCrc":"0", "CurrentElectricityFlow":"76.00", "CurrentElectricityQuantity":"2167368.00", "location":"(null)"},
"dev_4.3":{"uuid":"eneco-001-002844:hdrv_zwave_70258EC497D", "name":"HAE_METER_v2_3", "internalAddress":"4.3", "type":"elec_delivered_nt", "supportsCrc":"0", "CurrentElectricityFlow":"NaN", "CurrentElectricityQuantity":"NaN", "location":"(null)"},
"dev_4.4":{"uuid":"eneco-001-002844:hdrv_zwave_7027CCD497D", "name":"HAE_METER_v2_4", "internalAddress":"4.4", "type":"elec_received_nt", "supportsCrc":"0", "CurrentElectricityFlow":"NaN", "CurrentElectricityQuantity":"NaN", "location":"(null)"},
"dev_4.5":{"uuid":"eneco-001-002844:hdrv_zwave_702D7AB497D", "name":"HAE_METER_v2_5", "internalAddress":"4.5", "type":"elec_delivered_lt", "supportsCrc":"0", "CurrentElectricityFlow":"NaN", "CurrentElectricityQuantity":"NaN", "location":"(null)"},
"dev_4.6":{"uuid":"eneco-001-002844:hdrv_zwave_7021EFB497D", "name":"HAE_METER_v2_6", "internalAddress":"4.6", "type":"elec_received_lt", "supportsCrc":"0", "CurrentElectricityFlow":"NaN", "CurrentElectricityQuantity":"NaN", "location":"(null)"}
}
I'm assuming I need to put the gas_data_json.php file in the Domoticz scripts folder, but then what?
rboers
Posts: 1
Joined: Wednesday 04 October 2017 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by rboers »

Did you try changing dev_3.1 to dev_4.1 in the gas_data_json.php script?

Change:

Code: Select all

$gasUsage= $parsed_json['dev_3.1']['CurrentGasQuantity']; 
To:

Code: Select all

$gasUsage= $parsed_json['dev_4.1']['CurrentGasQuantity'];
DennisD
Posts: 51
Joined: Friday 18 September 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by DennisD »

FunFair wrote: Wednesday 04 October 2017 11:37 The first script seems not to be working for me, or I configured something wrong. I have no idea where I should enter a new setpoint for the temperature. Than again, I don't desire to enter a custom temperature.
I use the selector switches in combination with the 2nd script and all is working great. Getting the right temperatures, settings, etc.

I also tried to read the gas (and electricity) value from Toon into Domoticz from this post.
DennisD wrote: Wednesday 19 July 2017 20:59 Already figured out the gas usage, forgot to post it here :)

For the other values you want to pull from your toon, read this post (bit old, but files still function): https://www.domoticaforum.eu/viewtopic. ... oot#p77453 . I will attach all files to this post just to share!

For the gas_data_json file (modified electricity_data_json file):

Goto http://ip_toon/hdrv_zwave?action=getDevices.json and look for:

Code: Select all

"dev_3.1":{"uuid":"eneco-001-018946:hdrv_zwave_68927F8D936", "name":"HAE_METER_v2_1", "internalAddress":"3.1", "type":"gas", "supportsCrc":"0", "CurrentGasFlow":"0.00", "CurrentGasQuantity":"3080.00", "location":"(null)"},
. The most important bit is the dev_3.1 part because that can be different in other toons. Open gas_date_json.php and search for:

Code: Select all

$gasUsage= $parsed_json['dev_3.1']['CurrentGasQuantity']; 
now change the dev_3.1 to the one you have in the mentioned url. Make sure you change the ip_toon to the ip your toon has and also make a gasmeter (add virtual sensor) and fill in the idx. If you upload to mindergas you could also add your gas meter value to the following line:

Code: Select all

 $gasUsage= $parsed_json['dev_3.1']['CurrentGasQuantity'] + yourmetervalue;
Now domoticz will have the actual meter value and you can upload it to mindergas.
But I don't really understand what to do here. I'm quite new to domoticz, but can anyone explain how I implement this? Do I need to make new dummies, and upload the php files to my PI? or can I run it as a script in Domoticz? I really don't know :|

I will try and explain howto make the gas sensor:
What i did was make a dummy switch in Domoticz/hardware and named it ToonHacked, just to keep things organized.After this is created click on make virtual sensor and then fill in a name that you want, in my case i did gas verbruik and in the pull down menu select gas. After this is created goto your devices (settings drop down menu) and search for "gas verbuik" or whatever name you called the virtual gas sensor, and look for the idx and remember/write it down.

Open the file gas_data_json.php and search for:

Code: Select all

$idx = 0;
and replace the 0 with your idx of the virtual gas sensor you just created. Also edit the line:

Code: Select all

$file_string_gas = file_get_contents('http://ip_toon/hdrv_zwave?action=getDevices.json');
and

Code: Select all

$gasusage = curl_init("http://ip_toon/json.htm?type=command&param=udevice&idx=$idx&nvalue=0&svalue=$gasUsage");
and replace ip_toon with the actual ip adress of you toon. Also do the steps described above to get the correct output of the /hdrv_zwave?action=getDevices.json. Upload the file to location in you domoticz folder (i did this in (home/pi/domoticz/scripts/php/) and do chmod +x gas_data_json.ph. Then type crontab -e and add the following line to it:

Code: Select all

*/1 * * * * /home/pi/domoticz/scripts/php/gas_data_json.php, save it on exit and the gas sensor should start updating.
Ikkeja
Posts: 1
Joined: Thursday 05 October 2017 15:51
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Ikkeja »

Thnx! Tonight Im gonna try all your steps. Been trying to read the gas usage values from json using LUA script but all I got were errors. Now i finally know where to put the PHP files :roll:
R0cc0
Posts: 7
Joined: Monday 26 January 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by R0cc0 »

you mention:

$gasusage = curl_init("http://ip_toon/json.htm?type=command&param=udevice&idx=$idx&nvalue=0&svalue=$gasUsage");
and replace ip_toon with the actual ip adress of you toon


Shouldn't this be the IP of Domoticz?
Anyway, it is working for me now and I have a readout of the gas usage and the gas meter reading.
Many thanks for your help Dennis!
DennisD
Posts: 51
Joined: Friday 18 September 2015 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by DennisD »

Regarding the ip, you are correct, my mistake, should have been up of domoticz. Glad you got it working now!
ronalddehaan
Posts: 11
Joined: Monday 09 October 2017 10:20
Target OS: Linux
Domoticz version: 2021.1
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by ronalddehaan »

Hi everybody, I've registered specially for this thread to be able to ask some questions.

So, I have a Toon, I've just rooted it and it's working ok now.
Now, I also have a Domoticz setup running on a Windows 7 VM that is also working quite nicely for me.

I used to have Toon connected to Domoticz through the 'official' way however because I am cutting Eneco loose I need to be able to control it in another way.
Here's the thing, I am by all means not an experienced Domoticz user so the tutorial in the OP of this thread gave me a headache and a lot of questions :lol:

Can somebody help me with a nooby tutorial, please? :oops:
If you want I am willing to write the step by step document myself if someone can provide me with the right info ;)
walberg
Posts: 46
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by walberg »

Tried to change Toon Scenes from Domoticz Switches from Home to Away, but after about 1 minute the system is back to Home? So there is something wrong with the script but what?
Toon switches  reads home standard<br />Home  standard
Toon switches reads home standard
Home standard
Schermafbeelding 2017-10-09 om 11.32.49.jpg (25.8 KiB) Viewed 3324 times
changed it 11:33 to away
changed it 11:33 to away
Schermafbeelding 2017-10-09 om 11.33.12.jpg (22.86 KiB) Viewed 3324 times
11:34 it is changed to home from itself
11:34 it is changed to home from itself
Schermafbeelding 2017-10-09 om 11.34.24.jpg (22.76 KiB) Viewed 3324 times
walberg
Posts: 46
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by walberg »

And here the fourth file (log file) i could not post it in the last file).
log file
log file
Schermafbeelding 2017-10-09 om 11.36.40.jpg (26.51 KiB) Viewed 3324 times
Maes
Posts: 34
Joined: Tuesday 05 April 2016 20:45
Target OS: -
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Maes »

Walberg,

It looks like the command to change the scene never reached the Toon.
Every minute the script runs to synchronise the changes from Toon to domoticz, so when this script runs after 1 minute the scene selector is back to Home.

The best way to test this is to press the selector switch in Domoticz while you are standing in front of your Toon. Confirm that you see the scene change on your Toon. I'm guessing it doesn't!

So if I'm right the problem is in the scene selector. Did you include the right triggers to this selector? IS the IP Address of your Toon correct?

Image
walberg
Posts: 46
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by walberg »

Yes your right, only Toon auto program is working (Switches when i am with ipad in front of Toon). But thermostat scenes and Program does not work.

Beneath my settings when edit Toon Scenes
Toon Scenes
Toon Scenes
Schermafbeelding 2017-10-09 om 14.45.13.jpg (94.44 KiB) Viewed 3304 times
And here Toon Thermostat (there's little to edit)
Toon setpoint
Toon setpoint
Schermafbeelding 2017-10-09 om 14.46.10.jpg (27.57 KiB) Viewed 3304 times
Maes
Posts: 34
Joined: Tuesday 05 April 2016 20:45
Target OS: -
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Maes »

Yo,

Look at your screenshot and my screenshot ;) ;) ;)

You are using @ instead of &
walberg
Posts: 46
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by walberg »

aaahrgg, I have seen these rules with the original several times, also with the Toon Auto program, which of course was good. Always looking at my own mistake. The switches now work. Thanks. Only the thermostat setting ToonThermostaat still does not work.
Maes
Posts: 34
Joined: Tuesday 05 April 2016 20:45
Target OS: -
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Maes »

What's going on with ToonThermostaat?

Post screenshots / etc
walberg
Posts: 46
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by walberg »

When pushing flame you got the arrows up en down but setting temperature change only for a few seconds on the dummy but not the setpoint on the Toon (printscreen of my VNC) by example setting temperature at 22 after a few seconds return to 20 on the Domoticz screen but at the VNC screen (= Toon) nothing changed.
change temperature
change temperature
Schermafbeelding 2017-10-09 om 18.18.00.jpg (22.6 KiB) Viewed 3288 times
On Toon the temperature Still stays 20
On Toon the temperature Still stays 20
Schermafbeelding 2017-10-09 om 18.18.56.jpg (93.83 KiB) Viewed 3288 times
after a few seconds  the Dummy gives 20 again
after a few seconds the Dummy gives 20 again
Schermafbeelding 2017-10-09 om 18.19.42.jpg (18.5 KiB) Viewed 3288 times
Maes
Posts: 34
Joined: Tuesday 05 April 2016 20:45
Target OS: -
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Maes »

So the script that's supposed to fire when you change the setpoint is not working.
Again the same problem as your Scene selector. This means the script that runs every minute is putting the setpoint in the domoticz back to what it is on the Toon. Can you show me the script that runs when you change the setpoint? (Should be called ToonSetPoint)
walberg
Posts: 46
Joined: Thursday 28 May 2015 18:41
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Location: Diemen Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by walberg »

-- Script used for Toon Thermostaat utility device, upon changing temp in Domoticz, temperature is sent to Toon.
--
commandArray = {}

ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
ToonIP = uservariables['UV_ToonIP']

for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName == ToonThermostatSensorName) then
if uservariables['UV_ToonChangedByDomoticz'] == 1 then
commandArray['Variable:UV_ToonChangedByDomoticz'] = '0'
else
SetPoint = otherdevices_svalues[ToonThermostatSensorName]
ToonCommand = string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', ToonIP, SetPoint*100)

print('Setting Toon setpoint to '.. SetPoint)
commandArray['OpenURL'] = ToonCommand
end
end
end

return commandArray

And here my dummy
Toon Thermostat
Toon Thermostat
Schermafbeelding 2017-10-09 om 18.20.09.jpg (26.16 KiB) Viewed 3287 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest