Fix Tuya vacuum display battery level (#61643)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
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

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: