From 7c120748ce9605d0fb3d8cad0ea40032e116c205 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Wed, 26 Jul 2017 05:05:48 -0400 Subject: [PATCH] Fixes Fitbit sensor to report battery level with the expected device (#8647) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an optional extended description… --- homeassistant/components/sensor/fitbit.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/fitbit.py b/homeassistant/components/sensor/fitbit.py index 0c10d2159ea..c0256e3a88b 100644 --- a/homeassistant/components/sensor/fitbit.py +++ b/homeassistant/components/sensor/fitbit.py @@ -433,9 +433,8 @@ class FitbitSensor(Entity): def update(self): """Get the latest data from the Fitbit API and update the states.""" - if self.resource_type == 'devices/battery': - response = self.client.get_devices() - self._state = response[0].get('battery') + if self.resource_type == 'devices/battery' and self.extra: + self._state = self.extra.get('battery') else: container = self.resource_type.replace("/", "-") response = self.client.time_series(self.resource_type, period='7d')