Hi,
I only see 3 items polled per device.
I've made a script to keep track of queries, assuming that every device counts for one poll.
This is working fine. And as far as I can see: it is correct... or it should be that my restrictions are not applied yet. TADO said that the limitations would be implemented within a certain period of time.
I did test my daily polls with this script/counter.. altering the polling period to 30 seconds, gets me restricted again.
Script:
Just create a virtual counter, name it, adapt the script to reflect that name and alter the violation message to the first device that is mentioned in the log when polling.
Also create a variable to hold the updated queries number.
I do reset at midnight.
I do multiply the counter by 8, since I have 8 devices.
running every minute.. therefore I use a 60 secs polling interval now.
**** begin script ****
myHttpResponse = "getDomoticzErrorLog"
return {
on = { httpResponses = { myHttpResponse },
timer = { "every 1 minutes"},
-- devices = { "getErrorTrigger"} -- Only used for development and testing
},
logging = { level = domoticz.LOG_FORCE,
marker = "status TADO counter" },
data = { lastlogtime = { initial = 0 }},
execute = function(dz, trigger, timer)
local violationMessage = "CV Hall Verbruik" -- Change to reflect the messages you want to catch
local function askDomoticzForLogLines()
local lastLogTime = dz.data.lastlogtime -- get time last logrequest
local logLevel = 268435455 -- loglevel (1=normal,2=Status,4=error,268435455=all
local jsonString = "/json.htm?type=command" ..
"¶m=getlog" ..
"&lastlogtime=" .. tostring(lastLogTime) ..
"&loglevel=" .. tostring(logLevel)
local logURL = "
http://10.10.3.2:9080" .. jsonString
dz.openURL ({ url = logURL,
method = "GET",
callback = myHttpResponse
})
dz.data.lastlogtime = os.time(os.date('*t')) -- store current Time as seconds from epoch
dz.log(logURL,dz.LOG_DEBUG)
end
local function findViolation()
local violation = ""
if trigger.json.result ~= nil then -- Only when there are errormessages in the log
local resultTable = trigger.json.result
for i = #resultTable,1,-1 do -- traverse backwards to get latest violation first
if string.find(resultTable
.message,violationMessage) and
not(string.find(resultTable.message,"dzVents")) then -- We don't want debug messages to interfere
violation = violation .. "\n".. resultTable.message
end
end
end
return violation
end
if trigger.isDevice or trigger.isTimer then
askDomoticzForLogLines() -- get the relevant loglines
elseif trigger.ok then
local violation = findViolation()
if violation == "" then
dz.log("No (new) violations found",dz.LOG_FORCE)
if (dz.time.matchesRule('between 00:00 and 00:01')) then
dz.devices('TadoCounter').updateCustomSensor(0)
dz.variables('TadoCounter').set(0)
end
else
local tadocount = dz.variables('TadoCounter').value
if (tadocount >= 20000) then
dz.notify("TADO Counter: " .. tadocount .. "queries!!" ,violation, dz.PRIORITY_HIGH,nil,nil,dz.NSS_PUSHOVER)
end
local count = tadocount +8
if (dz.time.matchesRule('between 00:00 and 00:01')) then
dz.devices('TadoCounter').updateCustomSensor(0)
dz.variables('TadoCounter').set(0)
elseif (dz.time.matchesRule('between 00:01 and 00:02')) then
dz.devices('TadoCounter').updateCustomSensor(16) -- set 0 at Midnight maar moet corrigeren
dz.variables('TadoCounter').set(16)
else
dz.devices('TadoCounter').updateCustomSensor(count)
dz.variables('TadoCounter').set(count)
end
end
else
dz.log("Access problem to log",dz.LOG_ERROR)
end
end
}
**** end script ****
Result: