Replaced some hardcoded strings with constants and config_entries
This commit is contained in:
@@ -117,12 +117,12 @@ class LocalTuyaEntity(Entity):
|
|||||||
return {
|
return {
|
||||||
"identifiers": {
|
"identifiers": {
|
||||||
# Serial numbers are unique identifiers within a specific domain
|
# 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",
|
"manufacturer": "Unknown",
|
||||||
"model": "Tuya generic",
|
"model": "Tuya generic",
|
||||||
"sw_version": "3.3",
|
"sw_version": self._config_entry.data[CONF_PROTOCOL_VERSION],
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@@ -275,17 +275,17 @@ class LocaltuyaCover(LocalTuyaEntity, CoverEntity):
|
|||||||
|
|
||||||
def open_cover(self, **kwargs):
|
def open_cover(self, **kwargs):
|
||||||
"""Open the cover."""
|
"""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)
|
self._device.set_dps(self._config[CONF_OPEN_CMD], self._dps_id)
|
||||||
|
|
||||||
def close_cover(self, **kwargs):
|
def close_cover(self, **kwargs):
|
||||||
"""Close cover."""
|
"""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)
|
self._device.set_dps(self._config[CONF_CLOSE_CMD], self._dps_id)
|
||||||
|
|
||||||
def stop_cover(self, **kwargs):
|
def stop_cover(self, **kwargs):
|
||||||
"""Stop the cover."""
|
"""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)
|
self._device.set_dps(self._config[CONF_STOP_CMD], self._dps_id)
|
||||||
|
|
||||||
def status_updated(self):
|
def status_updated(self):
|
||||||
|
Reference in New Issue
Block a user