-
Notifications
You must be signed in to change notification settings - Fork 11
Raw payload not working #7
Copy link
Copy link
Open
Description
If you have a raw payload the json_load throw an exception and the val is not loaded.
here is a patch that check the payload_text before
@@ -58,13 +60,14 @@ class MQTT_SENSOR(SensorActive):
try:
print "payload " + msg.payload
- json_data = json.loads(msg.payload)
- #print json_data
- val = json_data
+ val = msg.payload
if self.payload_text is not None:
+ json_data = json.loads(msg.payload)
+ #print json_data
+ val = json_data
for key in self.payload_text:
val = val.get(key, None)
#print val
if isinstance(val, (int, float, basestring)):
q.put({"id": on_message.sensorid, "value": val})
except Exception as e:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels