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.
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.
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'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)?
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.
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)
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
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:
-- 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
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:
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?
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?
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
-= HP server GEN8 Xeon(R) E3-1220L_V2 -=- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.12b on Tab8" =-
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:
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?
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
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.