diff --git a/platypush/backend/adafruit/io.py b/platypush/backend/adafruit/io.py index 38f278d17..0a791350f 100644 --- a/platypush/backend/adafruit/io.py +++ b/platypush/backend/adafruit/io.py @@ -61,6 +61,8 @@ class AdafruitIoBackend(Backend): def on_message(self): def _handler(client, feed, data): + try: data = float(data) + except: pass self.bus.post(FeedUpdateEvent(feed=feed, data=data)) return _handler diff --git a/platypush/plugins/adafruit/io.py b/platypush/plugins/adafruit/io.py index 9d6a36a66..27e8b2a03 100644 --- a/platypush/plugins/adafruit/io.py +++ b/platypush/plugins/adafruit/io.py @@ -182,7 +182,8 @@ class AdafruitIoPlugin(Plugin): return [ { - attr: self._cast_value(value) if attr == 'value' else getattr(i, attr) + attr: self._cast_value(getattr(i, attr)) + if attr == 'value' else getattr(i, attr) for attr in DATA_FIELDS if getattr(i, attr) is not None } for i in data ]