need help dzevets script solar Toon

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

need help dzevets script solar Toon

Post 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
User avatar
waltervl
Posts: 5768
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need help dzevets script solar Toon

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post 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.
User avatar
waltervl
Posts: 5768
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need help dzevets script solar Toon

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post by Wiers »

The most important is "current"
and today would be nice.
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post 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
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post by Wiers »

and it is all in W
User avatar
waltervl
Posts: 5768
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need help dzevets script solar Toon

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post by Wiers »

Scherm­afbeelding 2025-05-28 om 16.41.26.png
Scherm­afbeelding 2025-05-28 om 16.41.26.png (176.86 KiB) Viewed 184 times
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post by Wiers »

20250528_164533_resized.jpg
20250528_164533_resized.jpg (313.79 KiB) Viewed 181 times
User avatar
waltervl
Posts: 5768
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need help dzevets script solar Toon

Post 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?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post 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.
User avatar
waltervl
Posts: 5768
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need help dzevets script solar Toon

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post 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.
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post 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.
Scherm­afbeelding 2025-05-29 om 10.55.20.png
Scherm­afbeelding 2025-05-29 om 10.55.20.png (38.87 KiB) Viewed 114 times
And what kind of device do I have to make to receive the data?
I now have this.
Scherm­afbeelding 2025-05-29 om 11.05.48.png
Scherm­afbeelding 2025-05-29 om 11.05.48.png (77.97 KiB) Viewed 114 times
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post by Wiers »

Scherm­afbeelding 2025-05-29 om 13.52.43.png
Scherm­afbeelding 2025-05-29 om 13.52.43.png (29.22 KiB) Viewed 90 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.
User avatar
waltervl
Posts: 5768
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need help dzevets script solar Toon

Post 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.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post 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.
User avatar
waltervl
Posts: 5768
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need help dzevets script solar Toon

Post 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)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Wiers
Posts: 16
Joined: Tuesday 29 October 2024 12:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: need help dzevets script solar Toon

Post 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.
Post Reply

Who is online

Users browsing this forum: Wiers and 1 guest