Power meter shows negative value

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Power meter shows negative value

Post by Xavier82 »

Hi all,

Since today I own solar panels.
Yesterday the power meter (P1) showed positive values (usage), today since the solar panels it shows a negative value.
The negative value of the power meter (usage) shows the same value as the Solar meter (production) but with a positive value.
This while the minimum consumption is about 310 Watts.

As example:
Solar production is 500Watts
Power meter consumption was previous +310
Now it shows -500Watts
I would expect -310 (usage) + 500 (production) = +190 Watts (so a positive value on the power meter)

Or am I miscalculating? how should I read, interpret these values?
willemd
Posts: 740
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Power meter shows negative value

Post by willemd »

Are you sure these are all actual values and all measured at exactly the same moment?

Your calculation is correct, but if there is a time difference between the measurement (i.e. import into domoticz) of the solar production and the data you get from the power meter (grid consumption or return) then the numbers could still be correct.
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Power meter shows negative value

Post by Xavier82 »

willemd wrote: Thursday 02 February 2023 15:05 Are you sure these are all actual values and all measured at exactly the same moment?

Your calculation is correct, but if there is a time difference between the measurement (i.e. import into domoticz) of the solar production and the data you get from the power meter (grid consumption or return) then the numbers could still be correct.
I get these readings:
meters.png
meters.png (76.07 KiB) Viewed 2511 times
Without anything done to power meter...
Power meter is standaard P1 reading (cable connected from Smart Meter to Rpi with Domoticz.
"Teruglevering" is a dummy I use a script to extract info from Smart Meter T1/T2.

Code: Select all

local fetchIntervalMins = 1    -- (Geheel) Minutenfrequentie van deze scriptuitvoering 1 = elke minuut, 10 = elke 10 minuten, enz.) Moet een van (1,2,3,4,5,6,10,12,15,20,30) zijn.
local ScriptVersion = '1.11' -- domoticz > V2022.2 / dzVents >= 3.1.7
 
return {

    on =      {
                        timer = { 'every ' .. fetchIntervalMins .. ' minutes' }
              },
             
    logging = {
                         level = domoticz.LOG_DEBUG,    -- Maak commentaar op deze regel om de instelling van dzVents global logging te overschrijven
                         marker = 'Afzonderlijke Meterstanden '.. ScriptVersion
              },

    data = { lastP1 = { initial = {} }},

    execute = function(dz, item)

        -- Voeg apparaatnamen toe tussen aanhalingstekens of apparaat-idx zonder aanhalingstekens
        local P1  = dz.devices(17) -- Electra, P1 Smart Meter device (idx or "name") (required)

--[[ Voer namen / idx in voor apparaten die je wilt onder deze commentaarregels
     Deze apparaten moeten worden gemaakt als nieuwe incrementele tellers. Script kan verkeerde waarden opleveren
     bij gebruik met bestaande die al waarden bevatten
     De resterende regels kunnen worden verwijderd of becommentarieerd 
]]--
        local usageLow = dz.devices('Verbruik Laag') -- Metergebruik laag, virtueel apparaat, teller incrementeel
        local usageHigh = dz.devices('Verbruik Hoog') -- Metergebruik Hoog, Virtueel apparaat, teller incrementeel
        local returnLow  = dz.devices('Teruglevering Laag')  -- Meter Return Laag, Virtueel apparaat, teller incrementeel
        local returnHigh = dz.devices('Teruglevering Hoog')  -- Meter Return Hoog, Virtueel apparaat, teller incrementeel
        local produced = dz.devices('Teruglevering')   -- Meter Actuele Productie, Virtueel apparaat, teller incrementeel

        -- Deze apparaten moeten worden gemaakt als nieuwe "electric Usage"
        local usageDelivered = dz.devices('Teruglevering_actueel')  -- Actuele Productie

        -- Onder deze regel zijn geen wijzigingen vereist ---
               lastP1 = dz.data.lastP1

        local function updateCounter(dv, value, previousValue )
            if not(dv) then return end
            if not(previousValue) then
                dz.log("Geen eerdere gegevens voor " .. dv.name .. " nog; deze run overslaan",dz.LOG_DEBUG)
                return
            end
            if (dv.counter ~=0 or dv.counter ~= nil) then
            value = value - previousValue
            end
            dv.updateCounter(value)
            dz.log("Increment " .. dv.name .. " with: " .. value,dz.LOG_DEBUG)
        end
        
        local function updateEnergy(dv, value )
           if not(dv) then return end
           dv.updateEnergy(value)
           dz.log("Set " .. dv.name .. " to: " .. value,dz.LOG_DEBUG)
        end

        -- Update the device
        updateCounter(usageLow, P1.usage1, lastP1.usage1)
        updateCounter(usageHigh, P1.usage2, lastP1.usage2)
        updateCounter(returnLow, P1.return1, lastP1.return1)
        updateCounter(returnHigh, P1.return2, lastP1.return2)
        updateCounter(produced, P1.usageDelivered, lastP1.usageDelivered)
        updateEnergy(usageDelivered, P1.usageDelivered)

        lastP1.usage1 = P1.usage1
        lastP1.usage2 = P1.usage2
        lastP1.return1 = P1.return1
        lastP1.return2 = P1.return2
        lastP1.usageDelivered = P1.usageDelivered
     end
}
But I can't imagine that this has impact on the data from P1 meter.

At this moment a washmachine is on, I would expect the value of P1 meter usage would we a positive value....
willemd
Posts: 740
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Power meter shows negative value

Post by willemd »

Are you measuring the solar production with a separate meter that is imported onto a domoticz device? I don't see it in your overview but I got the impression from your initial post that you do.

In that case you should be able to take:
1) the usage/production from your pvpanel device
2) the usageDelivered from your P1 meter
3) the usage from your P1 meter

and then your real electricity use of that moment would be item1-item2+item3

Note these are all actual values of that moment, no cumulative values or cumulative day values (that would be an alternative approach).

Your current script calculates the difference between two return values at two different moments, so that is the surplus of your solar panel production, not the total production. A part of your production is used internally without going through the P1 meter.
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Power meter shows negative value

Post by Xavier82 »

mmmzzz

I use P1 from smart meter for:
Usage: (devicename = Power), this shows the current energy usage at this moment
Production Solarpanels (Teruglevering) I use the script.
The script uses the data from the P1 meter, or ,based on the script, am I interpreter this wrong?
When looking at the data of P1 I see 6 values seperated by ",".
Is this:
Value 1: Total Usage of T1 (Night)
Value 2: Total Usage of T2 (Day)
Value 3: Totale Delivery/Production (Solarpanels) T1 (Night)
Value 4: Totale Delivery/Production (Solarpanels) T2 (Day)
Value 5: Current usage
Value 6: Current production

Is this correct?

When then sun is shining I see at the power device the use of value 6, when there is no sun I see the use of value 5

I don't use any sperate meter for production.
When I disable all scripts, then still the "power" device gives a negative value.
I presume that the P1 hardware device is able to read the smart meter values?
willemd
Posts: 740
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Power meter shows negative value

Post by willemd »

The power device only shows the nett usage from the grid or the return to the grid. Without a separate meter you will never know the real total production of your solar panels, since the power meter only shows the production that is returned to the grid because you are not using it internally in your house at that moment.

Any solar panel production that is used internally is not measured by the P1 power meter. It is consumed and will not be returned to the grid therefore it is not measured.

I have a separate kWh meter with wifi attached to my solar panels, between the converter and the P1 meter. https://www.homewizard.com/nl/shop/wi-f ... er-1-fase/
Best to ask your supplier for suitable solutions for your installation.
Fredom
Posts: 160
Joined: Saturday 19 September 2020 21:02
Target OS: Raspberry Pi / ODroid
Domoticz version: 2025.1
Location: Krimpen aan den IJssel
Contact:

Re: Power meter shows negative value

Post by Fredom »

Xavier82 wrote: Thursday 02 February 2023 16:31 mmmzzz

I use P1 from smart meter for:
Usage: (devicename = Power), this shows the current energy usage at this moment
Production Solarpanels (Teruglevering) I use the script.
The script uses the data from the P1 meter, or ,based on the script, am I interpreter this wrong?
When looking at the data of P1 I see 6 values seperated by ",".
Is this:
Value 1: Total Usage of T1 (Night)
Value 2: Total Usage of T2 (Day)
Value 3: Totale Delivery/Production (Solarpanels) T1 (Night)
Value 4: Totale Delivery/Production (Solarpanels) T2 (Day)
Value 5: Current usage
Value 6: Current production

Is this correct?

When then sun is shining I see at the power device the use of value 6, when there is no sun I see the use of value 5

I don't use any sperate meter for production.
When I disable all scripts, then still the "power" device gives a negative value.
I presume that the P1 hardware device is able to read the smart meter values?
See this link
This script shows the wattage per solar panel.
viewtopic.php?t=29516&hilit=enphase
Yours sincerely,
Fred

Rasberry Pi 3B+ - Debian Trixie - Domoticz 2025.2
RFLink - RFXCom - Zigbee (CC2531)
P1 Smart Meter - KaKu
willemd
Posts: 740
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Power meter shows negative value

Post by willemd »

Xavier82 wrote: Thursday 02 February 2023 16:31
When looking at the data of P1 I see 6 values seperated by ",".
Is this:
Value 1: Total Usage of T1 (Night)
Value 2: Total Usage of T2 (Day)
Value 3: Totale Delivery/Production (Solarpanels) T1 (Night)
Value 4: Totale Delivery/Production (Solarpanels) T2 (Day)
Value 5: Current usage
Value 6: Current production

Is this correct?
No, not correct, but:
Value1: total usage low tariff
Value2: total usage normal tariff
Value3: total return low tariff
value4: total return normal tariff
value5: actual current usage
value6: actual current return

The P1 device shows indeed the smart meter values, but, as explained, not the total production of the solarpanels. Just try on a sunny day (with stable production) to switch on a heavy consumer (dishwasher, water cooker) and you will see your P1 values change even if your solar production would be stable.

To illustrate with my numbers of today:
P1 usage: 3.335 kWh
P1 return: 0.748
PV production 1.862
so 1.862-0.748=1.114 of the PV production used internally.
total electricity usage is 3.335+1.114=4.449 (= 3.335-0.748+1.862)
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Power meter shows negative value

Post by Xavier82 »

willemd wrote: Thursday 02 February 2023 17:00
Xavier82 wrote: Thursday 02 February 2023 16:31
When looking at the data of P1 I see 6 values seperated by ",".
Is this:
Value 1: Total Usage of T1 (Night)
Value 2: Total Usage of T2 (Day)
Value 3: Totale Delivery/Production (Solarpanels) T1 (Night)
Value 4: Totale Delivery/Production (Solarpanels) T2 (Day)
Value 5: Current usage
Value 6: Current production

Is this correct?
No, not correct, but:
Value1: total usage low tariff
Value2: total usage normal tariff
Value3: total return low tariff
value4: total return normal tariff
value5: actual current usage
value6: actual current return

The P1 device shows indeed the smart meter values, but, as explained, not the total production of the solarpanels. Just try on a sunny day (with stable production) to switch on a heavy consumer (dishwasher, water cooker) and you will see your P1 values change even if your solar production would be stable.

To illustrate with my numbers of today:
P1 usage: 3.335 kWh
P1 return: 0.748
PV production 1.862
so 1.862-0.748=1.114 of the PV production used internally.
total electricity usage is 3.335+1.114=4.449 (= 3.335-0.748+1.862)
So let me try to understand this.
The default Power device shows OR usage OR return WHEN the value of Usage is greater then the return it shows usage and when the value of Return is greater then usage it shows return?

Clear about the values 1 to 6 thanks, we meant the same :)

So what to do to solve this issue?
I was thinking about creating a dummy device "Power Grid" and "Power Solar".
These dummy devices are type energy with incremental counter. They count the usage (=Power Grid) and the production (=Power Solar).
The current Power device shows current setup and shows (depending on value) OR usage OR production/return based on actual readings.
I create a 3third dummy device which shows de difference between usage and production.
Ofcourse the dummy switches are updated based on a script.

Could this work?

I would just expect based on P1 Smart Meter data I could see the current usage and current production AND de difference (used on internal powergrid in the house).

I have an Enphase PV Solarsystem with 14 panels, with a Enphase Envoy Metered-S.
So I would be able with the hardware addition in Domticz to read the production of the solarpanels.
Perhaps thats a better solution the using the P1 Smart Meter interface.
willemd
Posts: 740
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Power meter shows negative value

Post by willemd »

I see various references to envoy on this forum and how to read the production, even of individual PV panels. I don't know about that and cannot help you on that. I have a system that is already 10 years old and I can only measure total production coming out of the central converter.

The principle remains the same. You will need the PV production data and the P1 data to get a complete picture.

Please note again your definition from value3 and value 4 is different from mine. I say it is the electricity returned/delivered to the grid. You say delivery/production. But delivery is not equal to production as explained.

You are correct that the actual P1 will either show an actual usage or an actual return, not both at the same time, depending on whether you have a surplus or shortage at that moment. Of course the daily and overall total values can both show usage and return values, because one hour/minute you can have return and a few moments later you can have usage.

In terms of devices I have:
1) a 1 phase P1 meter device showing the 6 values you mentioned (updated via a lua script that reads the values from the API).
2) a 1 phase kWh meter device showing solar production (update via a lua script that reads the values from the API).
3) a dummy kwh device showing the real usage (updated with a dzvents script making the calculation shown before).
4) several costs tracking devices and user variables with electricity prices and costs
5) several devices to calculate theoretical solar production based on weather and sun position and compare this to actual production
etc.
etc.
etc.

I think you will need to first 3 as well in one way or the other. If you get production data from each panel you will need more devices and then consolidate it to a total number. And if you have 3-fase you will need more and again consolidate (or does the P1 still deliver the consolidated totals in case of 3 fase? I will switch to 3 fase later this month)

Then you can do graphs like this is dashticz for example.
The top/positive values show source of power (either grid or solar panels), the bottom/negative values show destination of power (either grid or own usage)

Note you can see very small yellow parts (grid usage) below some orange parts (solar production) where there is also blue (grid return). This depends on the measurement interval. A switch from usage to return can occur within the measurement./display interval
Screenshot 2023-02-02 195211.jpg
Screenshot 2023-02-02 195211.jpg (100.88 KiB) Viewed 2449 times
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Power meter shows negative value

Post by Xavier82 »

Thanks for all the info.
I get the issue and the behavior how this works.

So I installed the Enphase app in Domoticz via hardware.
I now get readings of each solarpanel and the total of all panels and also see what happens when energy is produced by the solarpanels.

When the solarpanels are producing more energy then is consumed within the house then I get a negative value on the power meter and the "Teruglevering" device shows a positive value of power which returns to the grid.
Because I can see the total production of all panels I can read the production to.
When the solarpanels are producing less energy then is consumed within the house then I get a positive value on the power meter.

Since the power meter (P1) can't measure the consumption in the house it shows values of the energy used from the grid OR it shows values of the energy returning to the grid. Energy produced by the solar panels is directly used within the house.
Infact, today I was for about 5 minutes energy neutral (used the same amount of energy as the solarpanels were producing), so no energy was taken from the grid nor returned to the grid.
willemd
Posts: 740
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: Power meter shows negative value

Post by willemd »

Perfect
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest