Introduce mqttMessage object

This commit is contained in:
zewelor
2017-11-23 22:16:29 +01:00
parent 7b8e1dad12
commit 939d1e66c6
4 changed files with 36 additions and 19 deletions
+3 -4
View File
@@ -1,5 +1,7 @@
import time
from mqtt import MqttMessage
REQUIREMENTS = ['bluepy', 'interruptingcow']
# Bluepy might need special settings
@@ -10,10 +12,7 @@ class MiscaleWorker():
self._mac = mac
def status_update(self):
return [{
'topic': 'weight/kg',
'payload': self._get_weight(),
}]
return [MqttMessage(topic='weight/kg', payload= self._get_weight())]
def _get_weight(self):
from bluepy import btle