Posts: 2
Threads: 1
Joined: Aug 2025
Reputation:
0
Hi!
I have a copuple of temperature and wind speed sensors attached to my Wiser4KNX and i would like to present min and max temp and wind speed for the last 24 hours. Anyone who can point me in the right direction?
Posts: 5263
Threads: 29
Joined: Aug 2017
Reputation:
236
You can try this way, log your object for a day and then use this script, change logaddress and pastTime as needed.
Code:
logaddress = '32/1/3'
pastTime = 60*60*1 --in seconds
addr = grp.find(logaddress)
time= os.time() - pastTime
objects = db:getall('SELECT dataraw, logtime, datahex FROM objectlog WHERE address =' .. addr.id .. ' AND logtime >'.. time )
local result, value = 0,0
for _, objvalue in ipairs(objects) do
value = busdatatype.decode(objvalue.datahex, addr.datatype)
result = math.max(result, value)
end
log(result) --max
for _, objvalue in ipairs(objects) do
value = busdatatype.decode(objvalue.datahex, addr.datatype)
result = math.min(result, value)
end
log(result) --min
------------------------------
Ctrl+F5
Posts: 2
Threads: 1
Joined: Aug 2025
Reputation:
0
Thank you, seems to work fine!
I tried to change to mat.min too, but i didnt get a negative value, just 0,0, even though it has been colder during the last couple of nights. Any ideas?
Posts: 5263
Threads: 29
Joined: Aug 2017
Reputation:
236
Check the logs and see if your sensor actually logged negative value. It works for me with negative.
------------------------------
Ctrl+F5