fix mqtt topic
This commit is contained in:
parent
ea4b765e85
commit
887b4f4abf
@ -34,7 +34,12 @@ class RePublisher(threading.Thread):
|
||||
del dataBlock['decodedTelegram']
|
||||
if 'telegram' in dataBlock:
|
||||
del dataBlock['telegram']
|
||||
client.publish("IoT/ParsedData", json.dumps(msg, cls=MyEncoder))
|
||||
metadataBlock = msg['metadata']
|
||||
if 'Slave' in metadataBlock:
|
||||
if metadataBlock['Slave'] == 'Thermometer' and metadataBlock['device'] == 'ModbusHub':
|
||||
metadataBlock['name'] = 'FridgeThermometer'
|
||||
topic = "IoT/ParsedData/%s" % metadataBlock['name']
|
||||
client.publish(topic, json.dumps(msg, cls=MyEncoder))
|
||||
Logger.log("RePublisher has sent data")
|
||||
except Exception, e:
|
||||
Logger.log("Unexcepted exception %s in RePublisher: %s" % (e.__class__.__name__, str(e)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user