Calculate other energy usage using dzVents  [Solved]

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

Moderator: leecollings

Post Reply
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Calculate other energy usage using dzVents

Post by RduPre »

Hi,

I measure the energy usage of many devices using zwave devices.
I also know the total usage collected from my P1 energy meter.

What I would like to calculate is how much energy I consume from devices I don't measure. So basically this would be the the P1 usage minus al usage of measured devices?

Can someone of you give me a quick start to get this doen ?

Many thanks in advance,
Rien
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Calculate other energy usage using dzVents

Post by waaren »

RduPre wrote: Sunday 12 January 2020 14:18 What I would like to calculate is how much energy I consume from devices I don't measure. So basically this would be the the P1 usage minus al usage of measured devices?
Something like this ?

Code: Select all

return 
{
    on = 
    {
        devices = 
        {
            'Power',   --  'name' or id of your P1 device
        },
    },
    
    execute = function(dz, item)
        local usage = item.usage -- P1 usage
        local allMeasured = { 679, 915, 2326 } -- id's of all measured devices
       
        local delta = usage
        
        for _, id in ipairs(allMeasured) do
            delta = delta - ( dz.devices(id).actualWatt or dz.devices(id).WhActual ) -- depending on the version
        end
        
        dz.log('Usage by none measured power consumers  = ' .. delta )
        
    end
}

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RduPre
Posts: 53
Joined: Thursday 11 August 2016 18:41
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Calculate other energy usage using dzVents  [Solved]

Post by RduPre »

Hi,

I got it working, but due to the the realtime measurements are not at the same time of al devices, it's not accurate (sometimes even a negative value)

Is it possible to use the daily usage instead (see image below)
Attachments
Schermafbeelding 2020-01-14 om 13.24.32.png
Schermafbeelding 2020-01-14 om 13.24.32.png (214.27 KiB) Viewed 1434 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Calculate other energy usage using dzVents

Post by waaren »

RduPre wrote: Tuesday 14 January 2020 14:13 I got it working, but due to the the realtime measurements are not at the same time of al devices, it's not accurate (sometimes even a negative value)
Is it possible to use the daily usage instead ?
I guess this should do that (not tested)

Code: Select all

return 
{
    on = 
    {
        devices = 
        {
            'Power',   --  'name' or id of your P1 device
        },
    },
    
    execute = function(dz, item)
        local usage = item.counterToday -- P1 used Today
        local allMeasured = { 679, 915, 2326 } -- id's of all measured devices
       
        local delta = usage
        
        for _, id in ipairs(allMeasured) do
            delta = delta - ( dz.devices(id).counterToday ) 
        end
        
        dz.log('Usage by none measured power consumers  = ' .. delta )
        
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest