From 6f14df2d74c2309e78b5bdb154d1bbeb113f8f21 Mon Sep 17 00:00:00 2001 From: rospogrigio Date: Fri, 18 Sep 2020 14:00:36 +0200 Subject: [PATCH] Replaced some hardcoded strings with constants and config_entries --- custom_components/localtuya/__init__.py | 6 +++--- custom_components/localtuya/cover.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/custom_components/localtuya/__init__.py b/custom_components/localtuya/__init__.py index bb05bfb..ee0da21 100644 --- a/custom_components/localtuya/__init__.py +++ b/custom_components/localtuya/__init__.py @@ -117,12 +117,12 @@ class LocalTuyaEntity(Entity): return { "identifiers": { # Serial numbers are unique identifiers within a specific domain - ("LocalTuya", f"local_{self._device.unique_id}") + (DOMAIN, f"local_{self._device.unique_id}") }, - "name": self._device._friendly_name, + "name": self._config_entry.data[CONF_FRIENDLY_NAME], "manufacturer": "Unknown", "model": "Tuya generic", - "sw_version": "3.3", + "sw_version": self._config_entry.data[CONF_PROTOCOL_VERSION], } @property diff --git a/custom_components/localtuya/cover.py b/custom_components/localtuya/cover.py index 9302221..2e13040 100644 --- a/custom_components/localtuya/cover.py +++ b/custom_components/localtuya/cover.py @@ -275,17 +275,17 @@ class LocaltuyaCover(LocalTuyaEntity, CoverEntity): def open_cover(self, **kwargs): """Open the cover.""" - _LOGGER.info("Launching command %s to cover ", self._config[CONF_OPEN_CMD]) + _LOGGER.debug("Launching command %s to cover ", self._config[CONF_OPEN_CMD]) self._device.set_dps(self._config[CONF_OPEN_CMD], self._dps_id) def close_cover(self, **kwargs): """Close cover.""" - _LOGGER.info("Launching command %s to cover ", self._config[CONF_CLOSE_CMD]) + _LOGGER.debug("Launching command %s to cover ", self._config[CONF_CLOSE_CMD]) self._device.set_dps(self._config[CONF_CLOSE_CMD], self._dps_id) def stop_cover(self, **kwargs): """Stop the cover.""" - _LOGGER.info("Launching command %s to cover ", self._config[CONF_STOP_CMD]) + _LOGGER.debug("Laudebugching command %s to cover ", self._config[CONF_STOP_CMD]) self._device.set_dps(self._config[CONF_STOP_CMD], self._dps_id) def status_updated(self):