feat(web): mqtt for stats

This commit is contained in:
Paul Armstrong
2021-02-15 20:10:20 -08:00
committed by Blake Blackshear
parent 20c65b9a31
commit e399790442
6 changed files with 260 additions and 72 deletions

View File

@@ -43,7 +43,7 @@ class MqttBackend():
json_message = json.loads(message)
json_message = {
'topic': f"{self.topic_prefix}/{json_message['topic']}",
'payload': json_message.get['payload'],
'payload': json_message['payload'],
'retain': json_message.get('retain', False)
}
except:
@@ -73,7 +73,7 @@ class MqttBackend():
except:
logger.debug("Removing websocket client due to a closed connection.")
self.clients.remove(client)
self.mqtt_client.message_callback_add(f"{self.topic_prefix}/#", send)
def start(self):