From 2e6040362e8d92406cf2d74bf5ed1c5efa09bcaf Mon Sep 17 00:00:00 2001 From: Onkel Andy Date: Fri, 20 Oct 2023 21:22:08 +0200 Subject: [PATCH] knx plugin: replace sh.scheduler.add by smartplugin scheduler_add; add plugin shortname as caller in scheduler --- knx/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/knx/__init__.py b/knx/__init__.py index 1913b6497..3d7f9cf7a 100755 --- a/knx/__init__.py +++ b/knx/__init__.py @@ -249,8 +249,10 @@ def _poll(self, **kwargs): ga = kwargs['ga'] interval = int(kwargs['interval']) next = self.shtime.now() + timedelta(seconds=interval) - self._sh.scheduler.add(f'KNX poll {item}', self._poll, - value={'instance': self.get_instance_name(), ITEM: item, 'ga': ga, 'interval': interval}, + self.scheduler_add(f'KNX poll {item}', self._poll, + value={'caller': self.get_shortname(), + 'instance': self.get_instance_name(), + ITEM: item, 'ga': ga, 'interval': interval}, next=next) except Exception as ex: self.logger.error(f"_poll function got an error {ex}") @@ -542,7 +544,7 @@ def run(self): self._poll(**{ITEM: item, 'ga':_ga, 'interval':_interval}) if self._send_time_do: - self._sh.scheduler.add('KNX[{0}] time'.format(self.get_instance_name()), self._send_time, prio=5, cycle=int(self._send_time_do)) + self.scheduler_add('KNX[{0}] time'.format(self.get_instance_name()), self._send_time, prio=5, cycle=int(self._send_time_do)) def stop(self): """