Page 1 of 1

Calculate other energy usage using dzVents

Posted: Sunday 12 January 2020 14:18
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

Re: Calculate other energy usage using dzVents

Posted: Monday 13 January 2020 1:26
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
}


Re: Calculate other energy usage using dzVents  [Solved]

Posted: Tuesday 14 January 2020 14:13
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)

Re: Calculate other energy usage using dzVents

Posted: Tuesday 14 January 2020 16:36
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
}