Removed unneeded friendly_name fields

This commit is contained in:
rospogrigio
2020-09-15 23:31:33 +02:00
parent 400ad57e01
commit c99cc1f077
8 changed files with 25 additions and 18 deletions

View File

@@ -84,7 +84,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
dps[device_config[CONF_ID]] = None
covers.append(
LocaltuyaCover(
TuyaCache(device),
TuyaCache(device, config_entry.data[CONF_FRIENDLY_NAME]),
device_config[CONF_FRIENDLY_NAME],
device_config[CONF_ID],
device_config.get(CONF_OPEN_CMD),
@@ -107,11 +107,12 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class TuyaCache:
"""Cache wrapper for pytuya.TuyaDevice"""
def __init__(self, device):
def __init__(self, device, friendly_name):
"""Initialize the cache."""
self._cached_status = ""
self._cached_status_time = 0
self._device = device
self._friendly_name = friendly_name
self._lock = Lock()
@property
@@ -202,7 +203,7 @@ class LocaltuyaCover(CoverEntity):
# Serial numbers are unique identifiers within a specific domain
("LocalTuya", f"local_{self._device.unique_id}")
},
"name": self._device._device.friendly_name,
"name": self._device._friendly_name,
"manufacturer": "Tuya generic",
"model": "SmartCover",
"sw_version": "3.3",