Skip to content

Commit

Permalink
Fix Tuya vacuum display battery level (home-assistant#61643)
Browse files Browse the repository at this point in the history
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
  • Loading branch information
2 people authored and balloob committed Jan 4, 2022
1 parent eb91941 commit 69b1a93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/tuya/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def __init__(self, device: TuyaDevice, device_manager: TuyaDeviceManager) -> Non
self._supported_features |= SUPPORT_FAN_SPEED
self._fan_speed_type = EnumTypeData.from_json(function.values)

if function := device.function.get(DPCode.ELECTRICITY_LEFT):
if status_range := device.status_range.get(DPCode.ELECTRICITY_LEFT):
self._supported_features |= SUPPORT_BATTERY
self._battery_level_type = IntegerTypeData.from_json(function.values)
self._battery_level_type = IntegerTypeData.from_json(status_range.values)

@property
def battery_level(self) -> int | None:
Expand Down

0 comments on commit 69b1a93

Please sign in to comment.