Small code styling tweaks for Tuya (#57102)

This commit is contained in:
Franck Nijhof 2021-10-05 12:59:51 +02:00 committed by GitHub
parent 5b218d7e1c
commit 80a04124a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 20 deletions

View file

@ -24,10 +24,9 @@ class TuyaHaEntity(Entity):
@staticmethod
def remap(old_value, old_min, old_max, new_min, new_max):
"""Remap old_value to new_value."""
new_value = ((old_value - old_min) / (old_max - old_min)) * (
return ((old_value - old_min) / (old_max - old_min)) * (
new_max - new_min
) + new_min
return new_value
@property
def should_poll(self) -> bool:
@ -47,13 +46,12 @@ class TuyaHaEntity(Entity):
@property
def device_info(self):
"""Return a device description for device registry."""
_device_info = {
return {
"identifiers": {(DOMAIN, f"{self.tuya_device.id}")},
"manufacturer": "Tuya",
"name": self.tuya_device.name,
"model": self.tuya_device.product_name,
}
return _device_info
@property
def available(self) -> bool: