Helle @Spaceman_Spiff,
I added a couple of python modules that dynamically create objexcts for each HW found in the network.
I can successfully set/read/change/… items and things in openHAB. That works like a charm.
But when I try to use the scheduler to create a cyclic (self.run.every) task it does not work. The call properly returns an instance of ScheduledCallbackBase (e.g. ReoccurringJob next_run: 2022-12-08T22:12:24.226000). But the function never gets scheduled.
if device['type'] == "BrickletIo16V2":
new_device = BrickletIo16V2(ipcon, device, log)
elif device['type'] == "BrickletIo16V2Switch":
new_device = BrickletIo16V2Switch(ipcon, device, log)
elif device['type'] == "BrickletIo16V2Window":
new_device = BrickletIo16V2Window(ipcon, device, log)
elif device['type'] == "BrickletOut4":
new_device = BrickletOut4(ipcon, device, log)
else:
log.error("unknown type: %s", device["type"])
class BrickletOut4(TinkerforgeBase, OhBase):
"""abstracts the handling of BrickletOut4 bricklets of tinkerforge"""
def __init__(self, ipconnection, deviceconfig, logger):
"""initialize the output bricklet"""
TinkerforgeBase.__init__(self, ipconnection, logger)
OhBase.__init__(self, logger)
I derive my class from HABApp.Rule.
I initialize the super class
class OhBase(HABApp.Rule):
"""abstracts the handling of openHAB interaction"""
def __init__(self, logger):
"""initialize the base class"""
super().__init__()
# lagger passed via constructor
self.logger = logger
.
.
.
.
def run_every(self, startTime, intervalTime):
"""support cyclic tasks"""
ret = self.run.every(
start_time=datetime.timedelta(seconds=startTime),
interval=intervalTime,
callback=self.test
)
self.logger.info(
f"{startTime} : {intervalTime} : {callbackFunction} :: {ret}")
def test(self):
"""test function
just log something to see if the function was called"""
self.logger.info("Hallo")
What am I missing?