Get return power value from P1 meter

Moderator: leecollings

Post Reply
banne
Posts: 5
Joined: Wednesday 14 July 2021 16:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Get return power value from P1 meter

Post 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 1831 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
} 
User avatar
waltervl
Posts: 5361
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Get return power value from P1 meter

Post 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
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
banne
Posts: 5
Joined: Wednesday 14 July 2021 16:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Get return power value from P1 meter

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests