Fix missing attributes bug

This commit is contained in:
Pierre Ståhl
2020-09-21 09:30:54 +02:00
committed by rospogrigio
parent caaf884a7a
commit e673340229
2 changed files with 8 additions and 3 deletions

View File

@@ -184,6 +184,11 @@ class LocalTuyaEntity(Entity):
"""Return unique device identifier."""
return f"local_{self._device.unique_id}_{self._dps_id}"
def has_config(self, attr):
"""Return if a config parameter has a valid value."""
value = self._config.get(attr, "-1")
return value is not None and value != "-1"
@property
def available(self):
"""Return if device is available or not."""