Page 1 of 1

Get return power value from P1 meter

Posted: Wednesday 14 July 2021 16:57
by banne
I'm a starter related to Domoticz and lua/DzVents... But with some help from the board and some Googling I did manage to make everything work like I wanted. I have 67 solarpanels at home which totally generates 21.000wp. Because I have 4 different brands of inverters I wanted to use Domoticz to monitor and provide an overview for my entire houshold (and company together) energy consumption and delivery. With this code you also can use it to calculate your actual household use at this very moment when you also use my other code for the solarpanels power generation added up.

For this I wanted to share some codes with you. Are they 100% fault free? No way! As i'm only a starter and trial and errored my way trough the code... But it works and thats whats most important. At first I wanted to share with you my return value for the P1 meter code. I found it nowhere on the internet, probably nobody cares about the power returned to the grid in a separate overview... But I do :lol: Also made monthly return code which I will share later on.

The device will look like this:
Schermafbeelding 2021-07-14 om 17.24.20.png
Schermafbeelding 2021-07-14 om 17.24.20.png (21.62 KiB) Viewed 3133 times

Code: Select all

return {
      on = { 
        timer = {
           'every 1 minutes'            
        },
    }, 
    execute = function(domoticz, device, timer)

    local yhPower = domoticz.devices(1).usageDelivered -- Change the 1 for your own P1 meter idx

    local zzhPower = domoticz.devices(62) --Create a customsensor with "watt" as variable and change 62 into that idx
        
     local totalPowerupdate1 = (yhPower)
	    
	   zzhPower.updateCustomSensor(totalPowerupdate1)
    end
} 

Re: Get return power value from P1 meter

Posted: Wednesday 14 July 2021 22:32
by waltervl
The return power per day/week/month/year can be seen in the log - report section of your P1 device so perhaps that is why nobody needed the script yet :-)

Also to be seen in the device widget if you have only 1 P1 meter on your location.
https://www.domoticz.com/wiki/Dutch_DSM ... th_P1_port

Re: Get return power value from P1 meter

Posted: Wednesday 14 July 2021 22:45
by banne
waltervl wrote: Wednesday 14 July 2021 22:32 The return power per day/week/month/year can be seen in the log - report section of your P1 device so perhaps that is why nobody needed the script yet :-)

Also to be seen in the device widget if you have only 1 P1 meter on your location.
https://www.domoticz.com/wiki/Dutch_DSM ... th_P1_port
But needed separately if you want to calculate the current power consumption at home :D