The things below under attachments haven't worked since minutes after the update.
I've already tried everything, including updating and upgrading the operating system on my Pi (bullseye).
I'm getting this error message in the log.
Code: Select all
2025-08-24 15:13:00.815 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=graph&sensor=counter&range=month&idx=305
2025-08-24 15:13:00.948 Error: dzVents: HTTP/1.1 response: 404 ==>> Not Found
2025-08-24 15:13:00.959 Error: dzVents: Could not get (good) data from domoticz. Error (404)
2025-08-24 15:13:00.959 Error: dzVents: An error occurred when calling event handler YoulessMaand
2025-08-24 15:13:00.959 Error: dzVents: /home/pi/domoticz/scripts/dzVents/scripts/YoulessMaand.lua:53: attempt to index a nil value (global 'domoticz')
Version: 2025.1
Build Hash: 89d5c900d
Compile Date: 2025-05-05 09:02:49
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Mar 20 2025, 02:07:39) [GCC 10.2.1 20210110]
Regarding the daily and monthly COP, the first log line says it all. The rest is a processing error. If a basic metric cannot be retrieved, dzVents obviously can't calculate it. idx 305 (heat pump power consumption from a Youless) is updated normally.
As soon as I restore a system backup from a few minutes before the update, it works normally again. But I simply want to update whenever a new stable version is released.
Below is the script for the monthly total, which I didn't write myself, by the way.
Code: Select all
local httpResponses = "monthTotal"
return {
on = {
timer = { "every 1 minutes" },
httpResponses = { httpResponses .. "*" }
},
logging = {
level = domoticz.LOG_DEBUG, -- set to LOG_ERROR when script works as expected
marker = httpResponse
},
execute = function(dz, item)
-- ****************************** Your settings below this line ***************************************************
usageDevice = dz.devices(305) -- Replace xxxx with ID of energyDevice you want to track
monthTotal = dz.devices(834) -- Create as virtual managed counter (energy) and change yyyy to the ID of the new device idx was 320
-- ****************************** No changes required below this line *********************************************
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local function triggerJSON(id, period, delay)
local delay = delay or 0
local URLString = dz.settings['Domoticz url'] .. "/json.htm?type=graph&sensor=counter&range=" ..
period .. "&idx=" .. id
dz.openURL({ url = URLString,
method = "GET",
callback = httpResponses .. "_" .. period}).afterSec(delay)
end
local function calculateMonthTotal(rt)
local monthTotal = 0
local currentMonth = dz.time.rawDate:sub(1,7)
for id, result in ipairs(rt) do
if rt[id].d:sub(1,7) == currentMonth then
logWrite(rt[id].d .. " ==>> " .. rt[id].v)
monthTotal = monthTotal + rt[id].v
end
end
return monthTotal --* 1000 oorspronkelijk script
end
if not item.isHTTPResponse then
triggerJSON(usageDevice.id, "month")
elseif item.ok then -- statusCode == 2xx
monthTotal.update(0,calculateMonthTotal(item.json.result))
else
logWrite("Could not get (good) data from domoticz. Error (" .. (item.statusCode or 999) .. ")" ,dz.LOG_ERROR)
logWrite(item.data)
domoticz.log('montTotal: '..monthTotal)
domoticz.log('currentMonth: '..currentMonth)
end
end
}