WhToday error
Moderator: leecollings
-
- Posts: 12
- Joined: Tuesday 27 October 2020 9:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
WhToday error
Hi all,
I am new to programming and started with a little script to add the power generation of my 2 SMA inverters. Somehow I see something weird that I cannot explan. Please help.
First I created a 'dummy', sensor type 'electric (instant + counter)'
Then created this script:
return {
on = {
timer = { 'every 1 minutes' }
},
execute = function(domoticz, item)
local SolarPowerE = domoticz.devices(1) -- Power Erker
local SolarPowerG = domoticz.devices(3) -- Power Garage
local SolarPowerT = domoticz.devices(5) -- Total Solar Power
SolarPowerT.updateElectricity(
SolarPowerE.WhActual + SolarPowerG.WhActual,
SolarPowerE.WhToday + SolarPowerG.WhToday
)
end
}
Where SolarPowerT is the sum of my 2 generated powers of the inverters.
What I see is the following: SolarPowerT. WhActual is displaying the right value; SolarPowerT.WhToday starts with the negative value of what has been produced the day before. So if I have generated 35kWh on monday, it starts at tuesday 0.00 hours with -35kWh and then slowly ramps up.
Both the Inverters start the day with 0 so the total should be 0 too.
What am I overlooking here?
Thanks in advance !
I am new to programming and started with a little script to add the power generation of my 2 SMA inverters. Somehow I see something weird that I cannot explan. Please help.
First I created a 'dummy', sensor type 'electric (instant + counter)'
Then created this script:
return {
on = {
timer = { 'every 1 minutes' }
},
execute = function(domoticz, item)
local SolarPowerE = domoticz.devices(1) -- Power Erker
local SolarPowerG = domoticz.devices(3) -- Power Garage
local SolarPowerT = domoticz.devices(5) -- Total Solar Power
SolarPowerT.updateElectricity(
SolarPowerE.WhActual + SolarPowerG.WhActual,
SolarPowerE.WhToday + SolarPowerG.WhToday
)
end
}
Where SolarPowerT is the sum of my 2 generated powers of the inverters.
What I see is the following: SolarPowerT. WhActual is displaying the right value; SolarPowerT.WhToday starts with the negative value of what has been produced the day before. So if I have generated 35kWh on monday, it starts at tuesday 0.00 hours with -35kWh and then slowly ramps up.
Both the Inverters start the day with 0 so the total should be 0 too.
What am I overlooking here?
Thanks in advance !
- waltervl
- Posts: 5737
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: WhToday error
The counter value should be the total counter until now, like what you read on the display of your electricity meter.
So today 35
Tomorrow 35+30.
Etc
So you should combine the .WhTotal values instead of WhToday and put that in your combined dummy device.
Domoticz will do the today calculation for you.
So today 35
Tomorrow 35+30.
Etc
So you should combine the .WhTotal values instead of WhToday and put that in your combined dummy device.
Domoticz will do the today calculation for you.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: WhToday error
Like to have this script also..
I do also have multiple inverters..
I do also have multiple inverters..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 12
- Joined: Tuesday 27 October 2020 9:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: WhToday error
Hi,
That could be an explanation although that would be agains what I read in the manual and that is 100% not what I see;
Every night the counter starts at a negative number This morning the value started at -37.4 kWh or so... During the day the numbers add up nicely,...but it always starts with the wrong number at midnight.
That could be an explanation although that would be agains what I read in the manual and that is 100% not what I see;
Every night the counter starts at a negative number This morning the value started at -37.4 kWh or so... During the day the numbers add up nicely,...but it always starts with the wrong number at midnight.
-
- Posts: 12
- Joined: Tuesday 27 October 2020 9:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: WhToday error
I see what you mean with the counter; I don't see why I start with the negative still. I tried with the WhToday but that is for the moment displaying the wrong value; I need to check what happens after midnight
- waltervl
- Posts: 5737
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: WhToday error
This script should work
Code: Select all
return {
on = {
timer = { 'every 1 minutes' }
},
execute = function(domoticz, item)
local SolarPowerE = domoticz.devices(1) -- Power Erker
local SolarPowerG = domoticz.devices(3) -- Power Garage
local SolarPowerT = domoticz.devices(5) -- Total Solar Power
SolarPowerT.updateElectricity(SolarPowerE.WhActual + SolarPowerG.WhActual, SolarPowerE.WhTotal + SolarPowerG.WhTotal)
end
}
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 12
- Joined: Tuesday 27 October 2020 9:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: WhToday error
Hi,
I have tried that; I see a value but not the value that I want to see. This is displaying the total kWh that has been generated in its lifetime for both inverters.
Lets take 1 stap back to explain what I want to have displayed: I want the actual generated power and the total generated power for that day.
The value should be set to 0 at the beginning of the day.
Each inverter is giving those values individually, but I want to have the sum of both inverters.
I did a little test and created a second dummy sensor SolarPowerTT; Furthermore I set the value for the 2nd variable in the function to 0 instead of the sum of 2 other values.
return {
on = {
timer = { 'every 1 minutes' }
},
execute = function(domoticz, item)
local SolarPowerE = domoticz.devices(1) -- Power Erker
local SolarPowerG = domoticz.devices(3) -- Power Garage
local SolarPowerT = domoticz.devices(5) -- Total Solar Power Actual
local SolarPowerTT = domoticz.devices(6) -- Total Solar Power Today
SolarPowerT.updateElectricity(SolarPowerE.actualWatt + SolarPowerG.actualWatt, 0)
SolarPowerTT.updateElectricity(SolarPowerE.WhToday + SolarPowerG.WhToday, 0)
end
}
This is the output:
So the SolarTotalToday sensor is working as it is displaying the right value.
The 'Today' value in the SolarTotal sensor is constant at minus 37.441 kWh . So by the looks it starts at -37k and then adds 0 everytime the script runs. Hence the steady -37441.
I think the electricity function in not appropriate for what I am looking for; I just need 2 values and no counter.
NB: This is a test setup with nothing else attached to it.
Thanks for your help!
I have tried that; I see a value but not the value that I want to see. This is displaying the total kWh that has been generated in its lifetime for both inverters.
Lets take 1 stap back to explain what I want to have displayed: I want the actual generated power and the total generated power for that day.
The value should be set to 0 at the beginning of the day.
Each inverter is giving those values individually, but I want to have the sum of both inverters.
I did a little test and created a second dummy sensor SolarPowerTT; Furthermore I set the value for the 2nd variable in the function to 0 instead of the sum of 2 other values.
return {
on = {
timer = { 'every 1 minutes' }
},
execute = function(domoticz, item)
local SolarPowerE = domoticz.devices(1) -- Power Erker
local SolarPowerG = domoticz.devices(3) -- Power Garage
local SolarPowerT = domoticz.devices(5) -- Total Solar Power Actual
local SolarPowerTT = domoticz.devices(6) -- Total Solar Power Today
SolarPowerT.updateElectricity(SolarPowerE.actualWatt + SolarPowerG.actualWatt, 0)
SolarPowerTT.updateElectricity(SolarPowerE.WhToday + SolarPowerG.WhToday, 0)
end
}
This is the output:
So the SolarTotalToday sensor is working as it is displaying the right value.
The 'Today' value in the SolarTotal sensor is constant at minus 37.441 kWh . So by the looks it starts at -37k and then adds 0 everytime the script runs. Hence the steady -37441.
I think the electricity function in not appropriate for what I am looking for; I just need 2 values and no counter.
NB: This is a test setup with nothing else attached to it.
Thanks for your help!
- waltervl
- Posts: 5737
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: WhToday error
This is because it is the first time you did the calculation. If you keep on sending the data it will behave exactly the same as your normal 2 single solar panel counters. So you have to be patient...... keep it running for a couple of days.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 12
- Joined: Tuesday 27 October 2020 9:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: WhToday error
Ok, I'll do that ! Thanks !
-
- Posts: 12
- Joined: Tuesday 27 October 2020 9:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: WhToday error
You are right,..it works now.!!
Thanks a lot!
Thanks a lot!
Who is online
Users browsing this forum: No registered users and 1 guest