Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by Knibor »

Hi,

I have a Smart Meter P1 that measures the actual usage of Fase1, Fase2 and Fase3 in watts
How can I convert it to Daily total KW used of each Fase?

Thanks.
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by krizzz »

Knibor wrote:Hi,

I have a Smart Meter P1 that measures the actual usage of Fase1, Fase2 and Fase3 in watts
How can I convert it to Daily total KW used of each Fase?

Thanks.
Do you have the Smart Meter connected with the P1-Cable? If so I have the same, one device per Phase/Fase and they display the usage in watts.
But check your (unused) devices, you should also have three devices displaying the volts and one device showing the combiner usage in kWh. Trust me, its there.

If not, I would suggest to remove all P1 devices, remove the P1 hardware and re-add again.




Verzonden vanaf mijn iPhone met Tapatalk
gordonb3
Posts: 111
Joined: Saturday 31 March 2018 22:24
Target OS: Linux
Domoticz version: Custom
Location: Delft, NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by gordonb3 »

You can't. The data is simply not there.
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by krizzz »

gordonb3 wrote:You can't. The data is simply not there.
What do you mean? I presume the the usage per Fase/Phase shows up as a device per Fase/Phase within your domoticz currently?


Verzonden vanaf mijn iPhone met Tapatalk
gordonb3
Posts: 111
Joined: Saturday 31 March 2018 22:24
Target OS: Linux
Domoticz version: Custom
Location: Delft, NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by gordonb3 »

krizzz wrote: Wednesday 08 January 2020 22:42
gordonb3 wrote:You can't. The data is simply not there.
What do you mean? I presume the the usage per Fase/Phase shows up as a device per Fase/Phase within your domoticz currently?
No. The only per phase data that the P1 telegram will show you is current/instantaneous use, voltage and ampere, all as integer values and thus the ampere value happens to be pretty useless. If you assume that the meter displays Ws as the Watt value, you might be able to calculate the overall usage per phase by keeping track of every meter update if it at least conforms to ESMR 5.0 and you did not limit the update rate. If you have an older meter: no chance.
krizzz
Posts: 200
Joined: Wednesday 20 November 2013 20:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by krizzz »

I don’t agree fully. At least I have the one device with the total kWh consumption. You should have it to after adding P1 hardware.

And you are right about the three devices per Fase. These only show the usage at that moment and not for that day/week.

Image

Verzonden vanaf mijn iPhone met Tapatalk
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by FireWizard »

Hi,

Knibor wrote:
I have a Smart Meter P1 that measures the actual usage of Fase1, Fase2 and Fase3 in watts
How can I convert it to Daily total KW used of each Fase?
I assume that you mean daily kWh instead of kW of each phase.

It is possible, but I wonder what to goal is, that you want to know these values.

If the goal is, that you want to charge other persons for the power consumption on a specific phase, I recommend to use a separate kWh meter, as these are more accurate and are calibrated.
If it is just for fun or curiosity you can create a virtual "Electricity" sensor for each phase. (Electric (Instant + Counter)).

Keep in mind the following:

krizzz wrote:
Do you have the Smart Meter connected with the P1-Cable? If so I have the same, one device per Phase/Fase and they display the usage in watts.
But check your (unused) devices, you should also have three devices displaying the volts and one device showing the combiner usage in kWh. Trust me, its there.
Smart meters with the protocol DSMR 4. 2 (See: https://www.netbeheernederland.nl/_uplo ... e3cc38.pdf) and
ESMR 5.0 (See: https://www.netbeheernederland.nl/_uplo ... fce1f1.pdf) do provide the following sensors in Domoticz:

- Total Electricity Usage (Current usage (W), Daily usage (kWh) and Total usage (kWh), idem Return values)
- Gas usage (Daily usage and Total usage (m3)).
- Line Voltages for L1, L2 and L3, if you have a 3-phase kWh meter; in case you have a 1-phase kWh meter, you have only L1)
- Power Consumption for L1, L2 and L3, if you have a 3-phase kWh meter. (In case you have a 1-phase kWh meter, you have only L1)
- If you have solar panels, then also Power Delivery for L1, L2 and L3, if you have a 3-phase kWh meter.
(In case you have a 1-phase kWh meter, you have only L1)

If you have a Smart meter, with the protocol DSMR 4.0 or earlier (See: http://files.domoticaforum.eu/uploads/S ... l%20P1.pdf), you do not have any information about each phase (L1,L2 and L3).

As gordonb3 said:
You can't. The data is simply not there.
The only per phase data that the P1 telegram will show you is current/instantaneous use, voltage and ampere, all as integer values and thus the ampere value happens to be pretty useless. If you assume that the meter displays Ws as the Watt value, you might be able to calculate the overall usage per phase by keeping track of every meter update if it at least conforms to ESMR 5.0 and you did not limit the update rate. If you have an older meter: no chance.
As gordonb3 said:

- All values are integer values, and as the current consumption is relative low ( < 25A ) per phase the inaccuracy is too big, and that is the reason that Domoticz does not use the Current as a sensor. It is a useless value. If you need that, you have to calculate it yourself, by dividing the power by the voltage. This assumes, that you have a resistive load. (cos phi = 1)

If you have limit the meter update and therefore have reduced the sampling frequency it will reduce in theory the accuracy further. However over the long term it will not make that much difference.

As said, you can create a virtual "Electricity" sensor for each phase. (Electric (Instant + Counter)).
Create the device and in the "Utility" tab you can edit this device as below:

Screenshot_Test Consumption L1.png
Screenshot_Test Consumption L1.png (18.25 KiB) Viewed 5215 times
Click the "Radio" button for Energy read as "Computed".

It will give you a sensor as:

Screenshot_Sensor Consumption L1.png
Screenshot_Sensor Consumption L1.png (30.29 KiB) Viewed 5215 times
The next step is to create a script (e.g. dzVents) that pushes the Current Watts per phase to the newly created sensor.
The daily usage is calculated (See after: Today:) and you can replace the "old" Usage sensor with this one.

Regards
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by waaren »

Knibor wrote: Wednesday 08 January 2020 16:33 I have a Smart Meter P1 that measures the actual usage of Fase1, Fase2 and Fase3 in watts
How can I convert it to Daily total KW used of each Fase?
Hi, can you test this one. Please read the comments in the script before you start and report your findings here. Thx

have Fun !

Code: Select all

--[[ script to estimate energy usage per phase for a 3 phase P1 meter   

    Before activating the script do:
    
    Create receiving devices as virtual device Type counter and on the utilities tab change them to 
    Type: Counter
    Counter Divider: 1000
    Value Quantity: Count
    Value Units: kWh
    
    The offset must NOT be set in this screen but if required must be entered in the settings below. Again only possible 
    before the first execution of the script
    
    tested with my 1 phase P1 meter for some hours and there the delta compared to real measurement is less then 1%
    but still: This is not a real measurement but an estimate !! and as always YMMV.
  
    In my situation the script fires every 10 seconds. You can change this by changing the scriptTrigger to be time
    based but it might have consequences for the delta between real values and estimated calculated values.
    The script writes to the kwH devices max. ones per minute and this frequency can be changed by changing the.  
    local writeDelay variable ( higher is less frequent and v.v.
    
--]]

 
 return
{
    on = 
    { 
        devices = 
        {
            1168,  -- change to id or 'name' of your L1 device. Only one device or the script will explode ! 
        },
    },

    logging =   
    {
        level = domoticz.LOG_ERROR, -- set to LOG_ERROR when tested and OK
        marker = 'kWh estimated values', 
    },

    data = 
    {
        usage =
        { 
            initial = 
            { 
                {},
            },
        },
    },
     
    execute = function(dz, item)
        
        local L1 = dz.devices('Usage L1') -- change to name / ID of your L1 usage device  
        local L2 = dz.devices('Usage L2') -- L2 watt
        local L3 = dz.devices('Usage L3') -- L3 watt 
        
        local L1C  = dz.devices('L1C') -- Change to name of your virtual device for L1 kWh used. (type counter, subtype counter, X-as kWh)
        local L2C  = dz.devices('L2C') -- L2
        local L3C  = dz.devices('L3C') -- L3
        
        local writeDelay = 60 
        
        local L1Offset = 15609      -- change to 
        local L2Offset = 0
        local L3Offset = 0
        
        -------
        -- No changes required below this line
        -------
        
        local function setPersistent(deltaSeconds)
            dz.log('setPersistent',dz.LOG_DEBUG)
            dz.data.usage.L1Wh = dz.data.usage.L1Wh + ( L1.actualWatt * deltaSeconds / 3600 )
            dz.data.usage.L2Wh = dz.data.usage.L2Wh + ( L2.actualWatt * deltaSeconds / 3600 )
            dz.data.usage.L3Wh = dz.data.usage.L3Wh + ( L3.actualWatt * deltaSeconds / 3600 )
            dz.data.usage.dDate = dz.time.dDate
        end

        local function resetPersistent()
            dz.log('resetPersistent',dz.LOG_DEBUG)
            dz.data.usage.L1Wh = 0
            dz.data.usage.L2Wh = 0
            dz.data.usage.L3Wh = 0
            dz.data.usage.dDate = dz.time.dDate
            dz.data.usage.reset = dz.time.dDate
        end

        local function update_kWhDevices()
            dz.log('updateCounter ' .. L1C.counter .. '  with ' .. dz.utils.round(dz.data.usage.L1Wh,3) ,dz.LOG_FORCE)
            
            L1C.updateCounter(L1C.counter + dz.data.usage.L1Wh / 1000 )
            L2C.updateCounter(L2C.counter + dz.data.usage.L2Wh / 1000 )
            L3C.updateCounter(L3C.counter + dz.data.usage.L3Wh / 1000 )
        end
        
        local function setOffset()
            if L1C.counter == 0 and L1Offset and L1Offset > 0 then L1C.setValues(0,L1Offset) end
            if L2C.counter == 0 and L2Offset and L2Offset > 0 then L2C.setValues(0,L2Offset) end
            if L3C.counter == 0 and L3Offset and L3Offset > 0 then L3C.setValues(0,L3Offset) end
        end
        
        
        -- initialize dz.data.usage data 
        if dz.data.usage.dDate == nil then
            setOffset()               -- Only once 
            resetPersistent()         -- Once initially and every time the datafile ihas been removed manually
        else    
           setPersistent(dz.time.dDate - dz.data.usage.dDate) -- every cycle
        end
        
        if dz.data.usage.reset < ( dz.time.dDate - writeDelay ) then 
            update_kWhDevices() 
            resetPersistent()
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by Knibor »

Hi, thanks all for the info.

Thanks for the dzVents script.
What should I fill in at devices

devices =
{
1168, -- change to id or 'name' of your L1 device. Only one device or the script will explode !

Is this the P1 Smartmeter Device with IDX 3 ? or IDX 4 (P1) Power
Attachments
Schermafbeelding 2020-01-10 om 19.12.25.png
Schermafbeelding 2020-01-10 om 19.12.25.png (38.73 KiB) Viewed 5194 times
Schermafbeelding 2020-01-10 om 19.11.47.png
Schermafbeelding 2020-01-10 om 19.11.47.png (116.08 KiB) Viewed 5194 times
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by Knibor »

Hi, tried to run this script, no succes. What do you mean with "id or 'name of your L1 device" . I suppose that this is P1. But P1 has 3 readings L1,L2 and L3. When i use the idx = usage L1. in Watts" than I get an error log.

2020-01-12 10:27:27.507 Status: dzVents: Error (2.4.19): kWh estimated values: An error occured when calling event handler Daily use Fase1
2020-01-12 10:27:27.507 Status: dzVents: Error (2.4.19): kWh estimated values: ...cz/scripts/dzVents/generated_scripts/Daily use Fase1.lua:74: attempt to perform arithmetic on field 'actualWatt' (a nil value)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by waaren »

Knibor wrote: Sunday 12 January 2020 10:28 Hi, tried to run this script, no succes. What do you mean with "id or 'name of your L1 device" . I suppose that this is P1. But P1 has 3 readings L1,L2 and L3. When i use the idx = usage L1. in Watts" than I get an error log.

2020-01-12 10:27:27.507 Status: dzVents: Error (2.4.19): kWh estimated values: An error occured when calling event handler Daily use Fase1
2020-01-12 10:27:27.507 Status: dzVents: Error (2.4.19): kWh estimated values: ...cz/scripts/dzVents/generated_scripts/Daily use Fase1.lua:74: attempt to perform arithmetic on field 'actualWatt' (a nil value)
Replace actualWatt with WhActual. They show the same but the method actualWatt was introduced in a later version of dzVents then the one you use.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by Knibor »

Hi Waaren,

I've been testing this script for a few days.
Device L1C, L2C and L3C works excellent.
I can't set the devices to zero in between.
I only use the script L1Offset which I change because I want to monitor the usage per day.

Is it also possible to create a "daily use in Kwh" of L1,L2 and L3 script?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by waaren »

Knibor wrote: Tuesday 14 January 2020 8:21 Device L1C, L2C and L3C works excellent. I can't set the devices to zero in between.
Stop the script for a moment, delete the device and recreate it. Adjust the offset value in the script and start the script again. After a day or so you will also see a calculated day usage.
I only use the script L1 Offset which I change because I want to monitor the usage per day.
I don't understand this remark. Can you please explain?
Is it also possible to create a "daily use in Kwh" of L1,L2 and L3 script?
I think so using what @FireWizard described. When combined with the original script it could look like

Code: Select all

--[[ script to estimate energy usage per phase for a 3 phase P1 meter   

    Before activating the script do:
    
    Create receiving L1C devices as virtual device Type counter and on the utilities tab change them to 
    Type: Counter
    Counter Divider: 1000
    Value Quantity: Count
    Value Units: kWh
    
    An offset must not be set in this screen but if required must be entered in the settings below. Again only possible 
    before the first execution of the script
            
    as explained by @FireWizard in post https://www.domoticz.com/forum/viewtopic.php?f=59&t=30823#p233241
    
    Create receiving L1U devices as virtual device Type (Electric (Instant + Counter)) and on the utilities tab change them to 
    use the 'Counted' method for Energy read
    
    tested with my 1 phase P1 meter for some hours and there the delta compared to real measurement is less then 1%
    but still: This is not a real measurement but an estimate !! and as always YMMV.
  
    In my situation the script fires every 10 seconds. You can change this by changing the scriptTrigger to be time
    based but it might have consequences for the delta between real values and estimated calculated values.
    
    The script writes to the daily usage devices every cycle and to the kwH devices max. ones per minute and this frequency can be changed by 
    changing the.  
    local writeDelay variable ( higher is less frequent and v.v.
    
--]]

 
 return
{
    on = 
    { 
        devices = 
        {
            1168,  -- change to id or 'name' of your L1 device. Only one device or the script will explode ! 
        },
    },

    logging =   
    {
        level = domoticz.LOG_ERROR, -- set to LOG_ERROR when tested and OK
        marker = 'kWh estimated values', 
    },

    data = 
    {
        usage =
        { 
            initial = 
            { 
                {},
            },
        },
    },
     
    execute = function(dz, item)
        
        local L1 = dz.devices('Usage L1') -- change to name / ID of your L1 usage device  
        local L2 = dz.devices('Usage L2') -- L2 watt
        local L3 = dz.devices('Usage L3') -- L3 watt 
        
        local L1C  = dz.devices('L1C') -- Change to name of your virtual device for L1 kWh used. (type counter, subtype counter, X-as kWh)
        local L2C  = dz.devices('L2C') -- L2
        local L3C  = dz.devices('L3C') -- L3
        
        local L1U = dz.devices('L1 daily use') -- change to name / ID of your L1 daily usage device  
        local L2U = dz.devices('L2 daily use') -- L2 
        local L3U = dz.devices('L3 daily use') -- L3 
                
        local writeDelay = 60 
        
        local L1Offset = 15609
        local L2Offset = 0
        local L3Offset = 5609
        
        -------
        -- No changes required below this line
        -------
        
        local function setPersistent(deltaSeconds)
            dz.log('setPersistent',dz.LOG_DEBUG)
            dz.data.usage.L1Wh = dz.data.usage.L1Wh + ( L1.WhActual * deltaSeconds / 3600 )
            dz.data.usage.L2Wh = dz.data.usage.L2Wh + ( L2.WhActual * deltaSeconds / 3600 )
            dz.data.usage.L3Wh = dz.data.usage.L3Wh + ( L3.WhActual * deltaSeconds / 3600 )
            dz.data.usage.dDate = dz.time.dDate
        end

        local function resetPersistent()
            dz.log('resetPersistent',dz.LOG_DEBUG)
            dz.data.usage.L1Wh = 0
            dz.data.usage.L2Wh = 0
            dz.data.usage.L3Wh = 0
            dz.data.usage.dDate = dz.time.dDate
            dz.data.usage.reset = dz.time.dDate
        end

        local function update_UsageDevices()
            if L1U then 
                dz.log('updateUsage' ,dz.LOG_DEBUG)
                L1U.updateElectricity(L1.WhActual)
            end
            if L2U then L2U.updateElectricity(L2.WhActual) end
            if L3U then L3U.updateElectricity(L3.WhActual) end
            
        end


        local function update_kWhDevices()
            
            if L1C then 
                dz.log('updateCounter ' .. L1C.counter .. '  with ' .. dz.utils.round(dz.data.usage.L1Wh,3) ,dz.LOG_FORCE)
                L1C.updateCounter(L1C.counter + dz.data.usage.L1Wh / 1000 ) 
            end
            if L2C then L2C.updateCounter(L2C.counter + dz.data.usage.L2Wh / 1000 ) end
            if L3C then L3C.updateCounter(L3C.counter + dz.data.usage.L3Wh / 1000 ) end
        end
        
        local function setOffset()
            if L1C.counter == 0 and L1Offset and L1Offset > 0 then L1C.setValues(0,L1Offset) end
            if L2C.counter == 0 and L2Offset and L2Offset > 0 then L2C.setValues(0,L2Offset) end
            if L3C.counter == 0 and L3Offset and L3Offset > 0 then L3C.setValues(0,L3Offset) end
        end
        
        
        -- initialize dz.data.usage data 
        if dz.data.usage.dDate == nil then
            setOffset()
            resetPersistent()
        else    
           setPersistent(dz.time.dDate - dz.data.usage.dDate) 
           update_UsageDevices()
        end
        
        if dz.data.usage.reset < ( dz.time.dDate - writeDelay ) then 
            update_kWhDevices()
            resetPersistent()
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by Knibor »

Thanks for the modified script.

Yesterday I implemented the new script with the daily use.
Actual use in Watts works perfect, but I have no value in used "kWh Today"
Attachments
Schermafbeelding 2020-01-15 om 09.01.43.png
Schermafbeelding 2020-01-15 om 09.01.43.png (126.55 KiB) Viewed 5096 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by waaren »

Knibor wrote: Wednesday 15 January 2020 9:17 Actual use in Watts works perfect, but I have no value in used "kWh Today"
Did you change the Energy read: method as described by @FireWizard ?
Energy read method must be set to Computed
Energy read method must be set to Computed
energy.png (25.17 KiB) Viewed 5090 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by Knibor »

Yes, the radio button is marked as Computed.

I run on stable version Domoticz V4.10717
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by waaren »

Knibor wrote: Wednesday 15 January 2020 15:54 Yes, the radio button is marked as Computed.
I run on stable version Domoticz V4.10717
Not much dzVents can do about that.
I am on a recent Beta
Usage.png
Usage.png (26.59 KiB) Viewed 5079 times
Usage2.png
Usage2.png (11.23 KiB) Viewed 5079 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Knibor
Posts: 112
Joined: Sunday 20 May 2018 12:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by Knibor »

O.k thanks, I'm running on Stable V4.10717, could this be the problem?
fortissimo
Posts: 7
Joined: Tuesday 10 November 2020 20:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by fortissimo »

I'm trying this script, but after a day the values are 0.
I've just changed WhActual to actualWatt and will check the results (still 0).

The L1C (and L2C and L3C) are of the type: 'RFXMeter, RFXMeter counter' is that correct?
fortissimo
Posts: 7
Joined: Tuesday 10 November 2020 20:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Smart Meter P1 actual usage Fase1, Fase2, Fase3 to Daily total KW

Post by fortissimo »

The Raspi wasn't operating anymore.
I rebooted it and Domoticz didn't start.
Tried it manually and got these errors:
2021-09-03 16:59:27.854 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 5
2021-09-03 16:59:27.854 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 6
2021-09-03 16:59:27.854 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 7
2021-09-03 16:59:27.854 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 113
2021-09-03 16:59:27.854 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 114
2021-09-03 16:59:27.855 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 115
2021-09-03 16:59:27.855 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 116
2021-09-03 16:59:27.855 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 117
2021-09-03 16:59:27.855 Error: dzVents: Error: (3.1.7) kWh estimated values: There is no device with that name or id: 118
2021-09-03 16:59:27.855 Error: dzVents: Error: (3.1.7) kWh estimated values: An error occurred when calling event handler Stroomverbruik per fase
2021-09-03 16:59:27.856 Error: dzVents: Error: (3.1.7) kWh estimated values: ...ts/dzVents/generated_scripts/Stroomverbruik per fase.lua:122: attempt to index a nil value (upvalue 'L1C')
Those ID's are corect.

I tried

Code: Select all

local L1 = dz.devices('5') -- change to name / ID of your L1 usage device  
        local L2 = dz.devices('6') -- L2 watt
        local L3 = dz.devices('7') -- L3 watt 
        
        local L1C  = dz.devices('113') -- Change to name of your virtual device for L1 kWh used. (type counter, subtype counter, X-as kWh)
        local L2C  = dz.devices('114') -- L2
        local L3C  = dz.devices('115') -- L3
        
        local L1U = dz.devices('116') -- change to name / ID of your L1 daily usage device  
        local L2U = dz.devices('117') -- L2 
        local L3U = dz.devices('118') -- L3 
and

Code: Select all

local L1 = dz.devices(5) -- change to name / ID of your L1 usage device  
        local L2 = dz.devices(6) -- L2 watt
        local L3 = dz.devices(7) -- L3 watt 
        
        local L1C  = dz.devices(113) -- Change to name of your virtual device for L1 kWh used. (type counter, subtype counter, X-as kWh)
        local L2C  = dz.devices(114) -- L2
        local L3C  = dz.devices(115) -- L3
        
        local L1U = dz.devices(116) -- change to name / ID of your L1 daily usage device  
        local L2U = dz.devices(117) -- L2 
        local L3U = dz.devices(118) -- L3 
and

Code: Select all

local L1 = dz.devices('Verbruik L1 : kookplaat / oven / bg') -- change to name / ID of your L1 usage device  
        local L2 = dz.devices('Verbruik L2 : keuken, 1e, 2e') -- L2 watt
        local L3 = dz.devices('Verbruik L3 : qkr / mk / trap / schr'  ) -- L3 watt 
        
        local L1C  = dz.devices('L1C') -- Change to name of your virtual device for L1 kWh used. (type counter, subtype counter, X-as kWh)
        local L2C  = dz.devices('L2C') -- L2
        local L3C  = dz.devices('L3C') -- L3
        
        local L1U = dz.devices('L1U') -- change to name / ID of your L1 daily usage device  
        local L2U = dz.devices('L2U') -- L2 
        local L3U = dz.devices('L3U') -- L3 
All gave the same error
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests