Sort Adafruit IO received data by timestamp

This commit is contained in:
Fabio Manganiello 2019-01-12 02:06:38 +01:00
parent 78d44364cf
commit 2739dda266

View file

@ -180,13 +180,13 @@ class AdafruitIoPlugin(Plugin):
def _convert_data_to_dict(self, *data):
from Adafruit_IO.model import DATA_FIELDS
return [
return sorted([
{
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
]
], key=lambda i: i.get('created_epoch'))
@action