Page 1 of 2
need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 11:27
by Wiers
Hi,
I am running the latest Domoticz on a Pi.
Connected to my P1 meter via usb and working great.
Also got the readings from my Rooted Toon thermostat.
I have solar panels from APSystems.
The problem is:
P1 energy production are from the phase where my solar panels are connected, but that phase also uses power so I don't get a clean "solar production" readout.
In my toon I have a clean readout of my Apsystems.
I found out that if I use this:
http://toonIp/solar.html in my browser I get:
{"result":"ok","solar": {"current":3589, "total":11401431, "today":24715, "production":4010, "usage_net":246, "usage_own":-175}}
I also made a virtual device : "solar power"
My question to you smart guy's is, can you help me whit a script that runs every minute that gets a readout of these figures from my toon that i can use for my solarpower device?
Thanks
Eric
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 13:49
by waltervl
According this topic the rooted Toon python plugin should show the P1 meter data including solar:
viewtopic.php?p=311034
use this plugin:
https://github.com/MadPatrick/domoticz_toon
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 14:44
by Wiers
Hi Walterv,
I have the thermostat data from Toon in Domoticz working.
I have the P1 data in Domoticz working.
But I need the data from my solarpower which Toon gets via an app from oepi loepi toe Domoticz.
At the moment I am trying to get a dzevents HTTP request working but getting stuck on to manny errors.
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 16:01
by waltervl
Can you give an explanation what from this json you want to use for your virtual solar panel device in Domoticz?
Code: Select all
{"result":"ok","solar": {"current":3589, "total":11401431, "today":24715, "production":4010, "usage_net":246, "usage_own":-175}}
current is current production in W?
total is total production Wh?
production, usage_net, usage_own is what? Do these values need to be used?
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 16:16
by Wiers
The most important is "current"
and today would be nice.
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 16:18
by Wiers
this is what i am working whit but no result:
Code: Select all
return {
on = {
timer = { 'every 1 minutes' },
httpResponses = { 'solar' }
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://192.168.1.56/solar.html',
method = 'GET',
callback = 'solar'
})
elseif (item.isHTTPResponse) then
if (item.ok) then -- statusCode == 2xx
local current = item.json.consumption
domoticz.devices('production').energy(current)
end
end
end
}
Edit waltervl: added code brackets for better readability
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 16:21
by Wiers
and it is all in W
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 16:30
by waltervl
But what is it? You have to map it to values in the Domoticz device.
And all in W is strange....
Can you post a screenshot of your Toon user interface where it shows the Solar data?
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 16:44
by Wiers

- Schermafbeelding 2025-05-28 om 16.41.26.png (176.86 KiB) Viewed 252 times
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 16:48
by Wiers

- 20250528_164533_resized.jpg (313.79 KiB) Viewed 249 times
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 17:13
by waltervl
So what are the json values from? Seems to be the one with 811W
Those values cannot be put as is in a Domoticz device. That is a function of the Energy dashboard.
Also the second screenshot seems strange for me.
Solar now 2315 W
Total 15.0 Kwh (so not all values are W

)
But what is:
Delivered 4514 W
Usage 323 W
I cannot map these values to solar panels. What do they mean?
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 17:50
by Wiers
"Stroom nu" is the same as "zon nu" and is the "current" value in the json.
They are different because there are clouds passing by.
this is the actual solar production of my panels in W.
the other values are not important.
I just want this number refreshed in a virtual counter if possible.
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 23:43
by waltervl
Then change line
Code: Select all
local current = item.json.consumption
Into
Code: Select all
local current = item.json.solar.current
domoticz.log(' current = ' .. current, domoticz.LOG_INFO )
Also name the device correctly. You write you created a device called "solar power" but in your script you send data to device called 'production'......
Report back the errors and the complete script if it does not work.
It could be that line
Code: Select all
local current = item.json.solar.current
Should be
Code: Select all
local current = item.json.solar[0].current
Re: need help dzevets script solar Toon
Posted: Wednesday 28 May 2025 23:48
by Wiers
thanks for the info,
I will try this tomorrow.
I tried different devices and names to get a reaction but i will change them to one name.
Re: need help dzevets script solar Toon
Posted: Thursday 29 May 2025 11:16
by Wiers
One step further and without error but unfortunately without data.
I now have this script called "SolarPanels"
return {
on = {
timer = { 'every 1 minutes' },
httpResponses = { 'solar' }
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = '
http://192.168.1.56/solar.html',
method = 'GET',
callback = 'solar'
})
elseif (item.isHTTPResponse) then
if (item.ok) then -- statusCode == 2xx
local current = item.json.solar.current
domoticz.log(' current = ' .. current, domoticz.LOG_INFO )
end
end
end
}
It runs without errors but I also think without data.

- Schermafbeelding 2025-05-29 om 10.55.20.png (38.87 KiB) Viewed 182 times
And what kind of device do I have to make to receive the data?
I now have this.

- Schermafbeelding 2025-05-29 om 11.05.48.png (77.97 KiB) Viewed 182 times
Re: need help dzevets script solar Toon
Posted: Thursday 29 May 2025 13:56
by Wiers

- Schermafbeelding 2025-05-29 om 13.52.43.png (29.22 KiB) Viewed 158 times
Progress, I got a value "current = 676" which was the output of my panels at that moment.
Now I have to get that in a device/counter.
Re: need help dzevets script solar Toon
Posted: Thursday 29 May 2025 15:37
by waltervl
What do you expect to see? Because you now selected a counter that needs the total kWh data field and not the usage data in Watt.
You can also create an Electric (instant and Counter) device. That needs 2 values. The current in W and the total counter in Wh. (But what is the correct values from the JSON, value total?)
You can also create a Electric Usage device that only needs the Watt values. No historical report on this device.
Be aware every type of device needs a specific update command. See the dzvents wiki.
Re: need help dzevets script solar Toon
Posted: Thursday 29 May 2025 23:40
by Wiers
If I have only a Electric usage device which shows me the actual Watt that would be fine.
But I do not know how toe send the value of "current" to that device.
Re: need help dzevets script solar Toon
Posted: Friday 30 May 2025 0:15
by waltervl
It is time you start better reading the dzvents wiki, it is all there:
https://wiki.domoticz.com/DzVents:_next ... _scripting
Use
Code: Select all
domoticz.devices('your_device_name').updateEnergy(current)
Re: need help dzevets script solar Toon
Posted: Friday 30 May 2025 11:17
by Wiers
I am reading in the wiki but as a non programmer it is a lot "Chinese" for me.
It is easy to make a mistake by typing one digit wrong.
You are steering me in the right direction and together with the wiki and internet I think I will figure it out.