#5 Fix mqtt message so the json isn't double escaped
Merged 5 years ago by arrfab. Opened 5 years ago by jcpunk.
jcpunk/centos-git-common mqtt-tools  into  master

file modified
+1 -1
@@ -165,7 +165,7 @@ 

      logging.debug('Message received topic:%s payload:%s', message.topic, message.payload.decode("utf-8"))

  

      # Or you can customize this to fit your needs

-     signal = {message.topic: message.payload.decode("utf-8")}

+     signal = {message.topic: json.loads(message.payload.decode("utf-8"))}

      userdata['emit'].message(json.dumps((signal)))

  

      logging.debug('Sending signal: %s', json.dumps(signal))

This is a minor fix the avoids having the json double escaped in the message.

rebased onto dc7af13

5 years ago

Pull-Request has been merged by arrfab

5 years ago
Metadata