diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 321c091..82ae046 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1,3 +1,3 @@ -__version__ = "4.1.6.b4" +__version__ = "4.1.6.b5" __codename__ = "Groundhog Day" diff --git a/cbpi/extension/timer/__init__.py b/cbpi/extension/timer/__init__.py index 69f66ed..ed16e34 100644 --- a/cbpi/extension/timer/__init__.py +++ b/cbpi/extension/timer/__init__.py @@ -27,9 +27,10 @@ class AlarmTimer(CBPiSensor): self.stopped=False self.time = float(time) self.value=self.calculate_time(self.time) - if self.timer is None: + if self.timer is not None: await self.timer.stop() self.timer = Timer(int(self.time * 60), on_update=self.on_timer_update, on_done=self.on_timer_done) + await self.timer.stop() self.timer.is_running = False logging.info("Set Timer") @@ -55,10 +56,11 @@ class AlarmTimer(CBPiSensor): @action(key="Reset Timer", parameters=[]) async def Reset(self , **kwargs): self.stopped=False - if self.timer is None: + if self.timer is not None: await self.timer.stop() self.value=self.calculate_time(self.time) self.timer = Timer(int(self.time * 60), on_update=self.on_timer_update, on_done=self.on_timer_done) + await self.timer.stop() self.timer.is_running = False logging.info("Reset Timer")