diff --git a/platypush/backend/adafruit/io.py b/platypush/backend/adafruit/io.py index 10eb2a9af0..38f278d175 100644 --- a/platypush/backend/adafruit/io.py +++ b/platypush/backend/adafruit/io.py @@ -49,6 +49,8 @@ class AdafruitIoBackend(Backend): def on_connect(self): def _handler(client): + for feed in self.feeds: + client.subscribe(feed) self.bus.post(ConnectedEvent()) return _handler diff --git a/platypush/plugins/adafruit/io.py b/platypush/plugins/adafruit/io.py index c54d61a378..4c83afb973 100644 --- a/platypush/plugins/adafruit/io.py +++ b/platypush/plugins/adafruit/io.py @@ -191,10 +191,17 @@ class AdafruitIoPlugin(Plugin): except ValueError: pass return value - values = [i.value for i in self.aio.data(feed)] - if limit: - return values[-limit:] - return values + from Adafruit_IO.model import DATA_FIELDS + + values = [ + { + attr: float(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 self.aio.data(feed) + ] + + return values[:limit] if limit else values @action def delete(self, feed, data_id):