From 4ddc9690efbd2bd8cf57d1043f2dac68a325ab1b Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Fri, 20 Jan 2023 21:26:40 +0100 Subject: [PATCH] added timeout parameter to notificartion controller for potential later usage in UI --- cbpi/controller/notification_controller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cbpi/controller/notification_controller.py b/cbpi/controller/notification_controller.py index eb105d6..49b1ac5 100644 --- a/cbpi/controller/notification_controller.py +++ b/cbpi/controller/notification_controller.py @@ -49,7 +49,7 @@ class NotificationController: asyncio.create_task(method(self.cbpi, title, message, type, action )) - def notify(self, title, message: str, type: NotificationType = NotificationType.INFO, action=[]) -> None: + def notify(self, title, message: str, type: NotificationType = NotificationType.INFO, action=[], timeout: int=5000) -> None: ''' This is a convinience method to send notification to the client @@ -66,8 +66,8 @@ class NotificationController: actions = list(map(lambda item: prepare_action(item), action)) self.callback_cache[notifcation_id] = action - self.cbpi.ws.send(dict(id=notifcation_id, topic="notifiaction", type=type.value, title=title, message=message, action=actions)) - data = dict(type=type.value, title=title, message=message, action=actions) + self.cbpi.ws.send(dict(id=notifcation_id, topic="notifiaction", type=type.value, title=title, message=message, action=actions, timeout=timeout)) + data = dict(type=type.value, title=title, message=message, action=actions, timeout=timeout) self.cbpi.push_update(topic="cbpi/notification", data=data) asyncio.create_task(self._call_listener(title, message, type, action))