After upgrade from 2022.2 to 2023.2 updateCounter stooped working on managed counter
Posted: Thursday 30 November 2023 16:41
I have a few managed counters to calculate my GAS and Energy.
But they stopped updating the counters when I updated from 2022.2 to 2023.2.
This is logged btw:
2023-11-30 16:40:00.625 Status: dzVents: Info: ------ Start external script: ytd.lua:, trigger: "every 5 minutes"
2023-11-30 16:40:00.627 Status: dzVents: Info: Gas verbruik is: 942 m3
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra verbruik laag is: 1895 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra verbruik hoog is: 1981 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra opwek hoog is: 2638 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra opwek laag is: 1193 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra gebruik hoog is: -0.785 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra gebruik laag is: 0.593 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: ------ Finished ytd.lua
But they stopped updating the counters when I updated from 2022.2 to 2023.2.
Code: Select all
return {
on = {
-- timer = { 'every hour' }
timer = { 'every 5 minutes' }
-- timer = { 'every minute' }
},
--[[logging = {
level = domoticz.LOG_DEBUG,
marker = "ytd"
},]]--
execute = function(dz, item)
-- # Items uit de user variabelen
local YTD_Gas_start = dz.variables("YTD-Gas-start").value
local YTD_Laag_start = dz.variables("YTD-Laag-start").value
local YTD_Laag_T_start = dz.variables("YTD-Laag-T-start").value
local YTD_Hoog_start = dz.variables("YTD-Hoog-start").value
local YTD_Hoog_T_start = dz.variables("YTD-Hoog-T-start").value
-- # Uit de P1_meter
local PowerT = dz.devices(1) -- Power
local GasT = dz.devices(11) -- Gas
local ElektraL = dz.devices(26)
local ElektraH = dz.devices(25)
local ElektraGL = dz.devices(28)
local ElektraGH = dz.devices(29)
local ElektraTL = dz.devices(31)
local ElektraTH = dz.devices(30)
local Gas_current = dz.utils.round(tonumber(GasT.rawData[1]/1000))
local YTD_Laag_current = dz.utils.round(tonumber(PowerT.rawData[1]/1000))
local YTD_Laag_T_current = dz.utils.round(tonumber(PowerT.rawData[3]/1000))
local YTD_Hoog_current = dz.utils.round(tonumber(PowerT.rawData[2]/1000))
local YTD_Hoog_T_current = dz.utils.round(tonumber(PowerT.rawData[4]/1000))
-- calculatie
-- from updateCounter to updateCustomSensor
dz.devices(27).updateCounter( (Gas_current - YTD_Gas_start)*100) -- YTD_Gas
ElektraGL.updateCounter( (YTD_Laag_current - YTD_Laag_start)*1000) -- YTD_Laag
ElektraGH.updateCounter( (YTD_Hoog_current - YTD_Hoog_start)*1000) -- YTD_Hoog
ElektraTH.updateCounter( (YTD_Hoog_T_current - YTD_Hoog_T_start)*1000) -- YTD_Hoog_T
ElektraTL.updateCounter( (YTD_Laag_T_current - YTD_Laag_T_start)*1000) -- YTD_Laag_T
ElektraH.updateCounter( ElektraGH.sValue - ElektraTH.sValue )
ElektraL.updateCounter( ElektraGL.sValue - ElektraTL.sValue )
-- logging
--[[ dz.log("YTD_Gas_start = " .. YTD_Gas_start)
dz.log("YTD_Laag_start = " .. YTD_Laag_start)
dz.log("YTD_Laag_T_start = " .. YTD_Laag_T_start)
dz.log("YTD_Hoog_start = " .. YTD_Hoog_start)
dz.log("YTD_Hoog_T_start = " .. YTD_Hoog_T_start)
dz.log("Gas_current = " .. Gas_current)
dz.log("YTD_Laag_current = " .. YTD_Laag_current)
dz.log("YTD_Laag_T_current = " .. YTD_Laag_T_current)
dz.log("YTD_Hoog_current = " .. YTD_Hoog_current)
dz.log("YTD_Hoog_T_current = " .. YTD_Hoog_T_current) ]]--
dz.log("Gas verbruik is: " .. Gas_current - YTD_Gas_start .. " m3")
dz.log("Elektra verbruik laag is: " .. YTD_Laag_current - YTD_Laag_start .. " kWh")
dz.log("Elektra verbruik hoog is: " .. YTD_Hoog_current - YTD_Hoog_start .. " kWh")
dz.log("Elektra opwek hoog is: " .. YTD_Hoog_T_current - YTD_Hoog_T_start .. " kWh")
dz.log("Elektra opwek laag is: " .. YTD_Laag_T_current - YTD_Laag_T_start .. " kWh")
dz.log("Elektra gebruik hoog is: " .. ElektraH.counter/1000 .. " kWh" )
dz.log("Elektra gebruik laag is: " .. ElektraL.counter/1000 .. " kWh" )
end
}
2023-11-30 16:40:00.625 Status: dzVents: Info: ------ Start external script: ytd.lua:, trigger: "every 5 minutes"
2023-11-30 16:40:00.627 Status: dzVents: Info: Gas verbruik is: 942 m3
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra verbruik laag is: 1895 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra verbruik hoog is: 1981 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra opwek hoog is: 2638 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra opwek laag is: 1193 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra gebruik hoog is: -0.785 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: Elektra gebruik laag is: 0.593 kWh
2023-11-30 16:40:00.627 Status: dzVents: Info: ------ Finished ytd.lua