Timer on LogicMachine
Example: Timer on LogicMachine
Task
The following script is creating a timer for switching off specific KNX group address after specific time period. For example, there is Air Conditioner sitting on group address 1/1/1 (On/Off). You want to switch it off automatically after 50 minutes from the moment when it is switched on.
Scheduled script
Create a scheduled script which runs every minute:
- -- group address or name
- addr = '1/1/1'
-
- -- find required object
- obj = grp.find(addr)
-
- -- object exists and current state is "on"
- if obj and obj.data then
- -- delta is in seconds
- delta = os.time() - obj.updatetime
-
- -- switch off when timer expires
- if delta >= 50 * 60 then
- grp.write(addr, false)
- end
- end