WhToday error
Posted: Saturday 17 July 2021 14:00
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 !