In OH4.3 i had some HABApp rules using countdown timers. Currently I’m migrating my rules to OH5.0 and HABApp 25.07.0. Those rules using Contdown timers won’t work anymore, they throw an exception, when I try to retrigger the countdown:
AttributeError: 'CountdownJobControl' object has no attribute 'countdown'. Did you mean: 'set_countdown'?
Here is a small rule to demonstrate:
#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
import logging
import HABApp
from HABApp.core.items import Item
from HABApp.core.events import ValueUpdateEvent, ValueUpdateEventFilter
Log = logging.getLogger('MyRule')
class MyCountdownRule(HABApp.Rule):
def __init__(self):
super().__init__()
self._Light = 1
self._TimerHandle = self.run.countdown(2, self._SwitchRockerOff)
self._TimerHandle.reset()
Log.debug('Timer: {}'.format('started'))
def _SwitchRockerOff(self):
Log.debug('Timer: {}'.format('triggered'))
if self._Light:
Log.debug('Timer: {}'.format('re-triggered'))
self._TimerHandle.countdown(2) # <-- throws exception
self._TimerHandle.reset()
self._Light = 0
else:
Log.debug('Timer: {}'.format('triggered0'))
self._Light = 0
MyCountdownRule = MyCountdownRule()
So my question is, how to use countdown timer correctly in HABApp 25+ especially, how to retrigger it?