craftbeerpi4-pione/cbpi/controller/notification_controller.py

22 lines
435 B
Python
Raw Normal View History

2019-01-05 20:43:48 +01:00
from cbpi.api import *
2018-11-16 20:35:59 +01:00
2019-01-02 21:20:44 +01:00
class NotificationController(object):
2018-11-16 20:35:59 +01:00
'''
This the notification controller
'''
def __init__(self, cbpi):
'''
Initializer
:param cbpi: the cbpi server object
'''
self.cbpi = cbpi
self.cbpi.register(self)
2021-02-12 00:03:18 +01:00
async def notify(self, message, type=None):
2021-02-10 22:11:35 +01:00
self.cbpi.ws.send(dict(topic="notifiaction", type=type, message=message))
2019-01-04 09:29:09 +01:00