mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Fixes Fitbit sensor to report battery level with the expected device (#8647)
Add an optional extended description…
This commit is contained in:
parent
e83816c055
commit
7c120748ce
@ -433,9 +433,8 @@ class FitbitSensor(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data from the Fitbit API and update the states."""
|
"""Get the latest data from the Fitbit API and update the states."""
|
||||||
if self.resource_type == 'devices/battery':
|
if self.resource_type == 'devices/battery' and self.extra:
|
||||||
response = self.client.get_devices()
|
self._state = self.extra.get('battery')
|
||||||
self._state = response[0].get('battery')
|
|
||||||
else:
|
else:
|
||||||
container = self.resource_type.replace("/", "-")
|
container = self.resource_type.replace("/", "-")
|
||||||
response = self.client.time_series(self.resource_type, period='7d')
|
response = self.client.time_series(self.resource_type, period='7d')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user