I am looking for a script that i can use to send a value every xx minutes.
Found this that could work. But this is once, and i need it to resend for example every 30 minutes to pulse an output.
Could anyone help me with such a script.
Code:
12345678910111213141516
-- group address or nameaddr = '1/1/1'-- find required objectobj = grp.find(addr)
-- object exists and current state is "on"ifobjandobj.datathen-- delta is in secondsdelta = os.time() - obj.updatetime-- switch off when timer expiresifdelta >= 50 * 60thengrp.write(addr, false)
endend
--Set temperatureTc = '11/0/5'-- 09.001 Temperature (2Bytes)--Reference TemperatureTRef = '11/0/20'-- 09.001 Temperature (2Bytes)--Output object that enables resident scriptaddr = '11/0/32'--01. 1 bit (boolean)--Countdown in daysRstDays = '11/0/31'--1 Bytes unsigned integer--Countdown in hoursRstHours = '11/0/30'--1 Bytes unsigned integer----------------------------------------------------------------------obj = grp.find(addr)
ifobjandobj.datathendelta = os.time() - obj.updatetimetimeout = (grp.getvalue(RstDays) * 24 + grp.getvalue(RstHours)) * 60 * 60remaining = math.max(0, timeout - delta)
days = math.floor(remaining / 86400)
hours = math.floor((remaining % 86400) / 3600)
minutes = math.floor((remaining % 3600) / 60)
txtremaining = days .. 'd ' .. hours .. 'h ' .. minutes .. 'm 'grp.checkupdate('11/0/33', txtremaining)
-- switch off when timer expiresifremaining == 0thengrp.write(addr, false)
grp.write(Tc, grp.getvalue(TRef))
endend
Ok thanks, that's how it works. I want to get the counter reset to 0 when 'Tc' == 'TRef'. What can I add to the script?
This script runs every 1 second to be immediate, but the timer status sends it every second, I changed it to check.uptade to correct that. My question is if it is better like this or run it every 60 seconds ....?
To take advantage of this script to other functions, can I add seconds? I have tried but without positive result.
27.01.2021, 08:47 (This post was last modified: 27.01.2021, 08:50 by davidchispas.)
Hello, a very strange thing happens to me and I cannot find an explanation.
With this script I send the time status of the countdown (I had to change the data type to '14 bytes ASCII string 'to be able to view it on a KNX screen.
The rest of the objects work perfectly and are displayed on the KNX bus, but the 14-byte object, when updated (it is perfectly green) in LM, is not sent to the bus and is not reflected on my screen. But if I send the value manually from the LM configuration panel, it is sent, also if I make a status request.