mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-09 18:52:40 +02:00
Merge pull request #47 from jalim/hotfix/message-event-bus-patch
Change to notification to use message event bus
This commit is contained in:
@@ -224,9 +224,7 @@ class CraftBeerPi(ActorAPI, SensorAPI):
|
||||
def notify(self, headline, message, type="success", timeout=5000):
|
||||
self.beep()
|
||||
msg = {"id": str(uuid.uuid1()), "type": type, "headline": headline, "message": message, "timeout": timeout}
|
||||
if timeout is None:
|
||||
self.cache["messages"].append(msg)
|
||||
self.emit("NOTIFY", msg)
|
||||
self.emit_message(msg)
|
||||
|
||||
def beep(self):
|
||||
if self.buzzer is not None:
|
||||
|
||||
@@ -32,10 +32,9 @@ def messageEvent(message, **kwargs):
|
||||
:param kwargs: other parameter
|
||||
:return: None
|
||||
"""
|
||||
|
||||
msg = {"id": len(cbpi.cache["messages"]), "type": "info", "message": message, "read": False}
|
||||
cbpi.cache["messages"].append(msg)
|
||||
cbpi.emit('MESSAGE', msg,)
|
||||
if message["timeout"] is None:
|
||||
cbpi.cache["messages"].append(message)
|
||||
cbpi.emit("NOTIFY", message)
|
||||
|
||||
@cbpi.initalizer(order=2)
|
||||
def init(cbpi):
|
||||
|
||||
Reference in New Issue
Block a user