I measure both my power usage & production. After the usage meter there is no production it has been completely split.
There are 5 solar generators and 1 usage meters in total. They are all connected to DomoticZ and date is nicely being processed there.
I wanted to add a virtual meter to determine the power movement at the meter level. This can be calculated as usage minus production.
I made script for this but its not calculating. I'm ashamed to say I had it working before but now it's no longer working after adding the 5th solar array.
I'm running the latest stable domoticZ version.
Code: Select all
return {
on = {
timer = { 'every minute' }
},
execute = function(domoticz, item)
local pcmPower = domoticz.devices(9) -- Internal power consumption meter
local pvzPower = domoticz.devices(3) -- solar zuid
local pvoPower = domoticz.devices(4) -- solar oost
local pvwPower = domoticz.devices(5) -- solar west
local pvvPower = domoticz.devices(2) -- solar front
local pvz2Power = domoticz.devices(1) -- solar zuid APS 2
local totalPower = domoticz.devices(6) -- total (power consumtion - solar) power meter for movement of MAIN grid
totalPower.updateElectricity(
pcmPower.WhActual - pvzPower.WhActual - pvoPower.WhActual - pvwPower.WhActual - pvz2Power.WhActual - pvvPower.WhActual,
pcmPower.WhTotal - pvzPower.WhTotal - pvoPower.WhTotal - pvwPower.WhTotal - pvz2Power.WhTotal - pvvPower.WhTotal
)
end
}