From 203a6fd3490a9a1dffa75692454706a21e66b828 Mon Sep 17 00:00:00 2001 From: Rudolf Offereins Date: Sun, 10 Feb 2019 21:49:45 +0100 Subject: [PATCH] Fixed Thethingsnetwork sensor issue so that it takes the most recent (last) item from the TTN data storage query result instead of the first. (#20790) * Fixed Thethingsnetwork sensor issue so that it takes the most recent (last) item from the TTN data storage query result instead of the first. * Update sensor.py More pythonic way to get the last item of the sensor value list. --- homeassistant/components/thethingsnetwork/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/thethingsnetwork/sensor.py b/homeassistant/components/thethingsnetwork/sensor.py index 0f1220f9b07..13b51d505c3 100644 --- a/homeassistant/components/thethingsnetwork/sensor.py +++ b/homeassistant/components/thethingsnetwork/sensor.py @@ -153,7 +153,7 @@ class TtnDataStorage: return False data = await req.json() - self.data = data[0] + self.data = data[-1] for value in self._values.items(): if value[0] not in self.data.keys():