need help dzevets script solar Toon

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

Moderator: leecollings

Wiers
Posts: 20
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 have got it working!
Now I have one device with the most recent solarpower output and a device with the total today.
Tomorrow I am gonna try to get this in the Energy dashboard.

Thanks for putting me in the right direction Walter.
User avatar
waltervl
Posts: 5775
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 »

Probably not working like this but you never know...
You probably need the Electric (Instant and counter) for connecting Solar to the Energy Dashboard.
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: 20
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 »

You are right.
But I made this from another piece of coding and adapted that to my needs.
Scherm­afbeelding 2025-05-31 om 14.15.56.png
Scherm­afbeelding 2025-05-31 om 14.15.56.png (53.86 KiB) Viewed 99 times
So the solarpower plus a zero device is now totalpower which shows up in the energy dashboard.

And I have total today also.

But I have 2 same scripts now, one with "current and one with "today"
I think this coud be running in one script but I have to figure that out.
Attachments
Scherm­afbeelding 2025-05-31 om 14.16.15.png
Scherm­afbeelding 2025-05-31 om 14.16.15.png (40.55 KiB) Viewed 99 times
User avatar
madpatrick
Posts: 664
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: need help dzevets script solar Toon

Post by madpatrick »

if you post your scripts we can have a look for you.

Post it as CODE (text in brackets) and not as a picture
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2025.1 -=- Dashticz v3.14b on Tab8" =-
User avatar
waltervl
Posts: 5775
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 »

If you are filling the right data to the general kWh device totalPower you can delete the other 2.
It will also calculate the daily production for you but it needs a running total counter and not a daily (resetting to 0) counter.
You probably have to add JSON value "total". Please check if that total counter is increasing the same as the "today" value. It will help you a lot if you do this.
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: 20
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 the "solar" script.

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.devices('solar').updateEnergy(current)
domoticz.log(' current = ' .. current, domoticz.LOG_INFO )
end
end
end
}

And this is the "today" script.

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 today = item.json.solar.today
domoticz.devices('PanelsToday').updateEnergy(today)
domoticz.log(' today = ' .. today, domoticz.LOG_INFO )
end
end
end
}
Wiers
Posts: 20
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 do not really need a total counter because I already have that on my Apsystems app.
Same as the lifetime calculator.
Most important for me is the "current" value to be used in the Energy Dashboard.
User avatar
waltervl
Posts: 5775
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 »

The totalPower device can be used in the energy dashboard as it is now so what is the problem?
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: 20
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 »

There is no problem anymore.
You helped me in the right direction.
Only madpatrick asked me to show my 2 scripts so maybe we can combine them.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest