Page 12 of 22
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 03 May 2018 15:10
by gielie
I have a strange problem with my Toon P1 script.
The return amount is way too high, about 1.8.10^16.
When i look at the script, it gives nothing, which is right.
Code: Select all
pi@raspberrypi:~/domoticz/scripts/php $ ./p1_meter_data_json.php
Request for FROM date: 03-05-2018
Now: 2018-05-03 15:06:46
Electricity Usage Counter Domoticz = 7941058 Wh
Electricity Production Counter Domoticz = 8110649752 Wh
Electricity Usage Toon = 470 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 4045973 Wh
Electricity NT counter from Toon = 3895103 Wh
Electricity Counter Toon Total = 7941076 Wh
Electricity production counter LT from Toon = Wh
Electricity production counter NT from Toon = Wh
Write new value
{
"status" : "OK",
"title" : "Update Device"
the usage is right, how can i solve this
Re: Controlling Toon [HACKED] from Domoticz
Posted: Friday 04 May 2018 21:03
by FunFair
I
gielie wrote: ↑Thursday 03 May 2018 15:10
I have a strange problem with my Toon P1 script.
The return amount is way too high, about 1.8.10^16.
When i look at the script, it gives nothing, which is right.
Code: Select all
pi@raspberrypi:~/domoticz/scripts/php $ ./p1_meter_data_json.php
Request for FROM date: 03-05-2018
Now: 2018-05-03 15:06:46
Electricity Usage Counter Domoticz = 7941058 Wh
Electricity Production Counter Domoticz = 8110649752 Wh
Electricity Usage Toon = 470 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 4045973 Wh
Electricity NT counter from Toon = 3895103 Wh
Electricity Counter Toon Total = 7941076 Wh
Electricity production counter LT from Toon = Wh
Electricity production counter NT from Toon = Wh
Write new value
{
"status" : "OK",
"title" : "Update Device"
the usage is right, how can i solve this
I sometimes get strang values when the meteradapter has been disconnected. Domoticz needs a day to adjust the values for some reason.
According to the debug echos the script is reading correct values now.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 07 May 2018 12:23
by ArieKanarie
I'm about to purchase a second hand toon to play with it en connect it to Domoticz.
Maybe a N00b question, but can I control more from domoticz than only the temperature?
As I learned Toon has a Zwave controller, so can I start buying Zwave devices to control them via Domoticz (through Toon)?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 07 May 2018 14:44
by gielie
FunFair wrote: ↑Friday 04 May 2018 21:03
I
gielie wrote: ↑Thursday 03 May 2018 15:10
I have a strange problem with my Toon P1 script.
The return amount is way too high, about 1.8.10^16.
When i look at the script, it gives nothing, which is right.
Code: Select all
pi@raspberrypi:~/domoticz/scripts/php $ ./p1_meter_data_json.php
Request for FROM date: 03-05-2018
Now: 2018-05-03 15:06:46
Electricity Usage Counter Domoticz = 7941058 Wh
Electricity Production Counter Domoticz = 8110649752 Wh
Electricity Usage Toon = 470 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 4045973 Wh
Electricity NT counter from Toon = 3895103 Wh
Electricity Counter Toon Total = 7941076 Wh
Electricity production counter LT from Toon = Wh
Electricity production counter NT from Toon = Wh
Write new value
{
"status" : "OK",
"title" : "Update Device"
the usage is right, how can i solve this
I sometimes get strang values when the meteradapter has been disconnected. Domoticz needs a day to adjust the values for some reason.
According to the debug echos the script is reading correct values now.
I get this high value for a couple of days now and it is increasing while the production is 0 (no solar collectors connected)
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 09 May 2018 16:44
by Stimpy68
Hi, I've been running the lua script for some time now and it works great, but today I upgraded from the stable to the beta and now I have this error in the logs:
Code: Select all
Error: EventSystem: UpdateDevice IDX 0 not found!
When I disabled the Toon lua script, the error was gone. So what's the problem here?
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
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
ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
ToonIP = uservariables['UV_ToonIP']
DomoticzIP = uservariables['UV_DomoticzIP']
json = assert(loadfile "/domoticz/scripts/lua/JSON.lua")() -- For Windows
local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
local ThermostatInfo = handle:read('*all')
handle:close()
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
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
--
return commandArray
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 10 May 2018 0:08
by ArieKanarie
When I try to access a url directly, I get a 403 - Forbidden page:
http://192.168.6.20/happ_thermstat?acti ... ureState=2
I have access to the Zwave webpage and ssh, so I assume the firewall is not the problem?
And additionally: wouldn't it be possible to replace the ugle pink TOON splash screen for something more fancy?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 10 May 2018 12:12
by ArieKanarie
THe 403 error is resolved.
Now The temperature won't get updated and i get this error in the log:
Code: Select all
2018-05-10 12:08:00.710 Error: dzVents: Error: ...moticz/scripts/dzVents/generated_scripts/ToonGetInfo.lua:52: attempt to index a nil value
2018-05-10 12:08:00.710 dzVents: Info: ------ Finished ToonGetInfo
2018-05-10 12:08:00.710 EventSystem: Fetching url...
2018-05-10 12:08:00.710 EventSystem: Script event triggered: /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua
2018-05-10 12:08:00.953 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command¶m=setsetpoint&idx=583&setpoint=15
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 14 May 2018 12:08
by ArieKanarie
again answering myself:
Solved
Code: Select all
2018-05-10 12:08:00.953 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command¶m=setsetpoint&idx=583&setpoint=15
Problem was to add 127.0.0.* in the local networks (allow access without password)
The other error
Code: Select all
2018-05-10 12:08:00.710 Error: dzVents: Error: ...moticz/scripts/dzVents/generated_scripts/ToonGetInfo.lua:52: attempt to index a nil value
seems to resolved bu itself, it was still there but haven't seen it since the last 10 minutes.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 31 May 2018 12:25
by Stimpy68
Stimpy68 wrote: ↑Wednesday 09 May 2018 16:44
Hi, I've been running the lua script for some time now and it works great, but today I upgraded from the stable to the beta and now I have this error in the logs:
Code: Select all
Error: EventSystem: UpdateDevice IDX 0 not found!
When I disabled the Toon lua script, the error was gone. So what's the problem here?
Anybody a clue?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Tuesday 26 June 2018 22:32
by michel30
After upgrading Domoticz Version 4.9700 (June 23th 2018) two Toon icons does not work anymore.
1: Toon Scenes
- 1.jpg (32.63 KiB) Viewed 3740 times
2: Toon Autoprogram
The attachment 2.jpg is no longer available
The two icons shows text in it:
I don't now how to fix it or where the issue is, this happend after the update of Domototicz 4.9700 before it works super.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 27 June 2018 8:24
by gizmocuz
Try editing your switch and label them correctly. (i assume you cleared the browser cache and appcache)
Re: Controlling Toon [HACKED] from Domoticz
Posted: Wednesday 27 June 2018 21:17
by michel30
OMG
Thanks for your help now it works..
Re: Controlling Toon [HACKED] from Domoticz
Posted: Monday 16 July 2018 9:50
by terrorsource
The LUA script is triggered when there's a temperature change of 0.01 degrees, which causes a lot of logging in Domoticz.
How can i set that to 0.1 so it it decreases the logs?
Re: Controlling Toon [HACKED] from Domoticz
Posted: Thursday 26 July 2018 23:43
by Templar
Darn, I am getting this error and my values aren't updated.
Code: Select all
Error: EventSystem: in Toon: [string "-- Version 1:..."]:61: attempt to perform arithmetic on field '?' (a nil value)
This is line 61 of the
Toon script:
Code: Select all
if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
Does anybody know what the problem is?
EDIT: Never mind: solved it. Didn't execute de command "
http://192.168.x.x:8080/json.htm?type=c ... 92.168.y.y" properly.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Saturday 28 July 2018 2:37
by madpatrick
terrorsource wrote: ↑Monday 16 July 2018 9:50
The LUA script is triggered when there's a temperature change of 0.01 degrees, which causes a lot of logging in Domoticz.
How can i set that to 0.1 so it it decreases the logs?
I've changed to this
Code: Select all
local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
currentTemperature = tonumber(string.format("%.1f", currentTemperature)) -- 1 decimaal is voldoende
Re: Controlling Toon [HACKED] from Domoticz
Posted: Saturday 28 July 2018 5:06
by madpatrick
FunFair wrote: ↑Monday 05 March 2018 19:04
glsf91 wrote: ↑Tuesday 06 February 2018 21:14
I have changed/made a PHP script which reads now the analog gas counter from RRD instead of CurrentGasQuantity from getDevices.json. This last one is reset to zero after reboot of Toon (and I think also after restarting the meter adapter).
The counter in RDD is alway increasing, so no strange high measurements in Domoticz after rebooting Toon. Only the first day is showing a high value now when you start using this, because of the current high value in RRD. That cannot be avoided as far as I know (unless resetting Toon).
I'am not a php developer so probably things can be done smarter. But it looks like it is working.
It is derived from analog_electricity_data_json.php, earlier in this thread.
Wow thanks! This is a much better solution than the previous one!!!!
It doesn't matter anymore if you have an analog or smart meter, as Toon writes the values in the same database.
I've used your code to clean up my versions and removed the comparisment incase Toon reported 'zero' values.
Tested these scripts with Toon version 4.9 and they work with:
- P1 Smart meter (including solar return)
- Analog/Digital Electricity meter
- Analog/Digital Gas meter
See file attached for who's interested.
Hi,
I've setup the scripts and i get the read outs, but i just want to be sure i've setup the dummy sensors correct.
Which one do i need to use, because there a several options for electricity.
For example for "electricity_data_json.php"
- Elektra (Aktueel+Teller)
- Verbruik (elektra)
(sorry, my setup is in Dutch)
I've read the whole post, but could not find it
Re: Controlling Toon [HACKED] from Domoticz
Posted: Saturday 28 July 2018 13:58
by Clinthighway
Stimpy68 wrote: ↑Thursday 31 May 2018 12:25
Stimpy68 wrote: ↑Wednesday 09 May 2018 16:44
Hi, I've been running the lua script for some time now and it works great, but today I upgraded from the stable to the beta and now I have this error in the logs:
Code: Select all
Error: EventSystem: UpdateDevice IDX 0 not found!
When I disabled the Toon lua script, the error was gone. So what's the problem here?
Anybody a clue?
I have the same problem,
Code: Select all
EventSystem: UpdateDevice IDX 0 not found!
Using Domoticz on Synology with v4.9700
The "ToonThermostat" also not working
Re: Controlling Toon [HACKED] from Domoticz
Posted: Sunday 29 July 2018 22:21
by terrorsource
madpatrick wrote: ↑Saturday 28 July 2018 2:37
terrorsource wrote: ↑Monday 16 July 2018 9:50
The LUA script is triggered when there's a temperature change of 0.01 degrees, which causes a lot of logging in Domoticz.
How can i set that to 0.1 so it it decreases the logs?
I've changed to this
Code: Select all
local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
currentTemperature = tonumber(string.format("%.1f", currentTemperature)) -- 1 decimaal is voldoende
I'm using this script.
Can i change
string.format('%s|0|%s'
to
string.format('%.1f'
or is that not going to work?
Code: Select all
if currentTemperature ~= nil then
-- 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
end
Re: Controlling Toon [HACKED] from Domoticz
Posted: Sunday 23 September 2018 11:04
by Itelemarc
after the last domoticz update, i got the error:
scripts/dzVents/generated_scripts/600D Toon Setpoint.lua:8: attempt to concatenate field 'SetPoint' (a nil value)
ToonSetPoint
Code: Select all
return {
on = {
devices = {
'Toon Thermostat'
}
},
execute = function(domoticz, device)
domoticz.openURL(string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', domoticz.variables('UV_ToonIP').value, device.SetPoint*100))
domoticz.log('Setting Toon setpoint to '.. device.SetPoint)
end
}
After changing SetPoint to setPoint, it worked again.
This error is still so in the sample. So please correct.
Re: Controlling Toon [HACKED] from Domoticz
Posted: Sunday 23 September 2018 12:09
by EdwinK
Templar wrote: ↑Thursday 26 July 2018 23:43
Darn, I am getting this error and my values aren't updated.
Code: Select all
Error: EventSystem: in Toon: [string "-- Version 1:..."]:61: attempt to perform arithmetic on field '?' (a nil value)
This is line 61 of the
Toon script:
Code: Select all
if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
Does anybody know what the problem is?
EDIT: Never mind: solved it. Didn't execute de command "
http://192.168.x.x:8080/json.htm?type=c ... 92.168.y.y" properly.
For me, this error is on line 81
Code: Select all
if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
I tried the above command, changing it to my settings, to look like
Code: Select all
http://192.168.0.11:8080/json.htm?type=command¶m=udevice&idx=1&nvalue=0&svalue=192.168.0.4
and got the 'device updated' message.
Not sure what IDX to use.