Fix Tuya vacuum display battery level (#61643)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
pull/63231/head
dougiteixeira 2022-01-02 16:46:18 -03:00 committed by GitHub
parent 9248865443
commit 66c2259f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -112,9 +112,9 @@ class TuyaVacuumEntity(TuyaEntity, StateVacuumEntity):
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: