Page 4 of 22
Re: Controlling Toon [HACKED] from Domoticz
Posted: Sunday 01 October 2017 19:17
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..
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 02 October 2017 14:01
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.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 04 October 2017 11:37
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
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 04 October 2017 15:26
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?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 04 October 2017 18:32
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'];
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 05 October 2017 8:20
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:
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¶m=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.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 05 October 2017 15:54
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
Re: Controlling Toon [HACKED] from Domoticz
Posted: Friday 06 October 2017 9:50
by R0cc0
you mention:
$gasusage = curl_init("http://ip_toon/json.htm?type=command¶m=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!
Re: Controlling Toon [HACKED] from Domoticz
Posted: Friday 06 October 2017 23:02
by DennisD
Regarding the ip, you are correct, my mistake, should have been up of domoticz. Glad you got it working now!
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 10:31
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
Can somebody help me with a nooby tutorial, please?
If you want I am willing to write the step by step document myself if someone can provide me with the right info
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 11:44
by walberg
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 11:46
by walberg
And here the fourth file (log file) i could not post it in the last file).
- log file
- Schermafbeelding 2017-10-09 om 11.36.40.jpg (26.51 KiB) Viewed 3317 times
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 11:49
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?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 14:48
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
- Schermafbeelding 2017-10-09 om 14.45.13.jpg (94.44 KiB) Viewed 3297 times
And here Toon Thermostat (there's little to edit)
- Toon setpoint
- Schermafbeelding 2017-10-09 om 14.46.10.jpg (27.57 KiB) Viewed 3297 times
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 17:24
by Maes
Yo,
Look at your screenshot and my screenshot
You are using @ instead of &
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 18:04
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.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 18:06
by Maes
What's going on with ToonThermostaat?
Post screenshots / etc
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 18:26
by walberg
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 18:35
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)
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 09 October 2017 18:41
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
- Schermafbeelding 2017-10-09 om 18.20.09.jpg (26.16 KiB) Viewed 3280 times