removed some notifications from alarmtimer

This commit is contained in:
avollkopf 2023-03-08 06:50:18 +01:00
parent f7c0c7b2fa
commit 4d1c24e2c1
2 changed files with 2 additions and 14 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.1.6.b2" __version__ = "4.1.6.b3"
__codename__ = "Groundhog Day" __codename__ = "Groundhog Day"

View file

@ -1,19 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
from aiohttp import web from aiohttp import web
import logging import logging
import asyncio import asyncio
from cbpi.api import * from cbpi.api import *
from cbpi.api import base from cbpi.api import base
from time import strftime, gmtime from time import strftime, gmtime
import datetime
from cbpi.api.timer import Timer from cbpi.api.timer import Timer
from cbpi.api.dataclasses import DataType from cbpi.api.dataclasses import DataType
from cbpi.api.dataclasses import NotificationAction, NotificationType from cbpi.api.dataclasses import NotificationAction, NotificationType
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@parameters([]) @parameters([])
class AlarmTimer(CBPiSensor): class AlarmTimer(CBPiSensor):
@ -44,7 +40,6 @@ class AlarmTimer(CBPiSensor):
self.timer = Timer(int(self.time * 60), on_update=self.on_timer_update, on_done=self.on_timer_done) self.timer = Timer(int(self.time * 60), on_update=self.on_timer_update, on_done=self.on_timer_done)
if self.timer.is_running is not True: if self.timer.is_running is not True:
self.cbpi.notify(self.sensor.name,'Timer started', NotificationType.INFO)
self.timer.start() self.timer.start()
self.stopped=False self.stopped=False
self.timer.is_running = True self.timer.is_running = True
@ -56,7 +51,6 @@ class AlarmTimer(CBPiSensor):
self.stopped=False self.stopped=False
await self.timer.stop() await self.timer.stop()
self.timer.is_running = False self.timer.is_running = False
self.cbpi.notify(self.sensor.name,'Timer stopped', NotificationType.INFO)
logging.info("Stop Timer") logging.info("Stop Timer")
@action(key="Reset Timer", parameters=[]) @action(key="Reset Timer", parameters=[])
@ -73,7 +67,7 @@ class AlarmTimer(CBPiSensor):
async def on_timer_done(self, timer): async def on_timer_done(self, timer):
#self.value = "Stopped" #self.value = "Stopped"
if self.stopped is True: if self.stopped is True:
self.cbpi.notify(self.sensor.name,'Timer done', NotificationType.INFO) self.cbpi.notify(self.sensor.name,'Timer done', NotificationType.SUCCESS)
self.timer.is_running = False self.timer.is_running = False
pass pass
@ -81,11 +75,6 @@ class AlarmTimer(CBPiSensor):
async def on_timer_update(self, timer, seconds): async def on_timer_update(self, timer, seconds):
self.stopped=True self.stopped=True
self.value = Timer.format_time(seconds) self.value = Timer.format_time(seconds)
#await self.push_update()
async def NextStep(self):
self.next = True
pass
async def run(self): async def run(self):
while self.running is True: while self.running is True:
@ -99,7 +88,6 @@ class AlarmTimer(CBPiSensor):
def calculate_time(self, time): def calculate_time(self, time):
return strftime("%H:%M:%S", gmtime(time*60)) return strftime("%H:%M:%S", gmtime(time*60))
def setup(cbpi): def setup(cbpi):
cbpi.plugin.register("AlarmTimer", AlarmTimer) cbpi.plugin.register("AlarmTimer", AlarmTimer)
pass pass