dzVents kWH Power Device returns wrong day-total information

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

Moderator: leecollings

Post Reply
Filip
Posts: 110
Joined: Thursday 03 November 2016 10:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

dzVents kWH Power Device returns wrong day-total information

Post by Filip »

I am running Domoticz Version: 2024.7, Build Hash: b317cfab1, Compile Date: 2024-07-13 16:59:31, dzVents Version: 3.1.8, Python Version: 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110].

I have a dzVents script asking every day at 23:59 the day totals of the following power device:
Image

This information is obtained in DzVents through the following statement

Code: Select all

domoticz.devices('ZenCharger - Power').WhToday
.
However when the day-total is zero, it returns the power information from the day before. This statement is based on the following observations/tests

The DzVents script ran on Sun 08/12/2024 23:59 and returned 6780 KWh.
But as indicated in the logging below, there was no consumption on Sunday 08/12/2024, while on Saterday 07/12/2024 there was 6780 kWH consumption, exactly the value returned by the DzVents script.

Extract logging on Mon 09/12/2024 12:30.
Image

Any help would be welcome to clarify/solve.

For information, find the relevant part of the dzVents script is:

Code: Select all

 -- Generate End Of Day Report
        if domoticz.time.matchesRule('at 23:59 on 1/10-,-1/4') then
            -- Generate temporary table
            EoDPowerInfo = {}
            MyPowerDevices.forEach( function(MyPowerDevice)
                -- Create table
                table.insert(EoDPowerInfo, {name=MyPowerDevice.name, power=MyPowerDevice.WhToday})
            end )
            -- Sort the table
            table.sort(EoDPowerInfo, function(a,b) return (a.power>b.power) end)
            -- Create report
            EndOfDayReport = 'ENERGY REPORT ' .. os.date('%a %d/%m/%Y %H:%M') .. '<br>'
            TotalHeating = 0
            for i, v in pairs(EoDPowerInfo) do
                EndOfDayReport = EndOfDayReport .. string.format('<tr><td>%-30s</td> <td align=right> %6.0f KWh</td></tr>', v.name, v.power)
                TotalHeating = TotalHeating + v.power
            end 
            EndOfDayReport = EndOfDayReport .. string.format('<tr><td>%-30s</td> <td align=right> %6.0f KWh</td></tr>', 'Total Heating', TotalHeating) 
            EndOfDayReport = EndOfDayReport .. string.format('<tr><td>%-30s</td> <td align=right> -%6.0f KWh</td></tr>', 'SolarEdge - Total Energy', domoticz.devices('SolarEdge - Total Energy').WhToday) 
            EndOfDayReport = EndOfDayReport .. string.format('<tr><td>%-30s</td> <td align=right> %6.0f KWh</td></tr>', 'ZenCharger - Power', domoticz.devices('ZenCharger - Power').WhToday) 
            EndOfDayReport = EndOfDayReport .. '<tr><td></td> <td></td></tr>' 
            EndOfDayReport = EndOfDayReport .. string.format('<tr><td>%-30s</td> <td align=right> %6.0f KWh</td></tr>', 'Net Energy Consumption', domoticz.devices('Net Energy Consumption').WhToday)
            -- Send report 
            domoticz.email('ENERGY REPORT ' .. os.date('%a %d/%m/%Y %H:%M'), '<table>' .. EndOfDayReport .. '</table>', '****@gmail.com')
        end
willemd
Posts: 642
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: dzVents kWH Power Device returns wrong day-total information

Post by willemd »

I think that is a known issue. Any today total is only updated once there is a new value. So if there is no new value, it is not updated and it will continue to show the old value.

How is your device updated? Only when there is an increase?
What if you update it with the existing same value?
Filip
Posts: 110
Joined: Thursday 03 November 2016 10:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents kWH Power Device returns wrong day-total information

Post by Filip »

Hi thanks for the feedback. I didn't expect it was a (probably) known issue...
Yes indeed, I only update the device when there is a change, which is in my opinion a good behaviour.
I will need to see then how I can force an update one a day even if the value did not change (to avoid to do it systematically at every polling interval).
Normally it should be not so complex, just trying to find a nice way...

Better of course would be to solve the root cause of the problem...

Thanks again!
F
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest