mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-22 06:58:17 +01:00
minor changes to timer code
This commit is contained in:
parent
4d1c24e2c1
commit
bffa3c36e3
2 changed files with 5 additions and 7 deletions
|
@ -1,3 +1,3 @@
|
|||
__version__ = "4.1.6.b3"
|
||||
__version__ = "4.1.6.b4"
|
||||
__codename__ = "Groundhog Day"
|
||||
|
||||
|
|
|
@ -27,10 +27,9 @@ class AlarmTimer(CBPiSensor):
|
|||
self.stopped=False
|
||||
self.time = float(time)
|
||||
self.value=self.calculate_time(self.time)
|
||||
if self.timer is None:
|
||||
await self.timer.stop()
|
||||
self.timer = Timer(int(self.time * 60), on_update=self.on_timer_update, on_done=self.on_timer_done)
|
||||
self.timer.start()
|
||||
await self.timer.stop()
|
||||
self.timer.is_running = False
|
||||
logging.info("Set Timer")
|
||||
|
||||
|
@ -56,11 +55,10 @@ class AlarmTimer(CBPiSensor):
|
|||
@action(key="Reset Timer", parameters=[])
|
||||
async def Reset(self , **kwargs):
|
||||
self.stopped=False
|
||||
if self.timer is 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)
|
||||
self.timer.start()
|
||||
await self.timer.stop()
|
||||
self.timer.is_running = False
|
||||
logging.info("Reset Timer")
|
||||
|
||||
|
|
Loading…
Reference in a new issue