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

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.

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