Fixed device diagnostic corrupting config entry

This commit is contained in:
rospogrigio
2022-05-23 14:38:03 +02:00
parent d42901bae1
commit f85e579a68
4 changed files with 5 additions and 4 deletions

View File

@@ -70,7 +70,7 @@ async def async_setup(hass: HomeAssistant, config: dict):
async def _handle_reload(service): async def _handle_reload(service):
"""Handle reload service call.""" """Handle reload service call."""
_LOGGER.debug("Service %s.reload called: reloading integration", DOMAIN) _LOGGER.info("Service %s.reload called: reloading integration", DOMAIN)
current_entries = hass.config_entries.async_entries(DOMAIN) current_entries = hass.config_entries.async_entries(DOMAIN)

View File

@@ -43,7 +43,7 @@ async def async_get_device_diagnostics(
"""Return diagnostics for a device entry.""" """Return diagnostics for a device entry."""
data = {} data = {}
dev_id = list(device.identifiers)[0][1].split("_")[-1] dev_id = list(device.identifiers)[0][1].split("_")[-1]
data[DEVICE_CONFIG] = entry.data[CONF_DEVICES][dev_id] data[DEVICE_CONFIG] = entry.data[CONF_DEVICES][dev_id].copy()
local_key = data[DEVICE_CONFIG][CONF_LOCAL_KEY] local_key = data[DEVICE_CONFIG][CONF_LOCAL_KEY]
data[DEVICE_CONFIG][CONF_LOCAL_KEY] = f"{local_key[0:3]}...{local_key[-3:]}" data[DEVICE_CONFIG][CONF_LOCAL_KEY] = f"{local_key[0:3]}...{local_key[-3:]}"

View File

@@ -6,4 +6,5 @@ pydocstyle==6.1.1
cryptography==3.3.2 cryptography==3.3.2
pylint==2.8.2 pylint==2.8.2
pylint-strict-informational==0.1 pylint-strict-informational==0.1
homeassistant==2021.7.1 homeassistant==2022.5.1
tox==3.25.0

View File

@@ -15,7 +15,7 @@ whitelist_externals =
true true
setenv = setenv =
LANG=en_US.UTF-8 LANG=en_US.UTF-8
PYTHONPATH = {toxinidir}/localtuya-homeassistant PYTHONPATH = {toxinidir}/localtuya
deps = deps =
-r{toxinidir}/requirements_test.txt -r{toxinidir}/requirements_test.txt
commands = commands =