localtuya
localtuya copied to clipboard
Cannot set a manual id
The problem
I'm unable to set a manual id, therefore, if I choose one of the options in the list bellow the id will not be unique and it would create a mess when updating the entity.
I may missunderstand the purpose of the id but for me the fact that it's not unique can't be right :)
Environment
- Localtuya version: master
- Last working localtuya version (if known and relevant):
- Home Assistant Core version: 2022.9.6
- [] Are you using the Home Assistant Tuya Cloud component ? []
- [] Are you using the Tuya App in parallel ? [x]
Steps to reproduce
- Add a new device,
- select device
- save the new tuya device
- select the category of your device
- The list of possible id are there
Configuration configuration.yaml
or config_flow
DP dump
{
"home_assistant": {
"installation_type": "Unknown",
"version": "2022.9.6",
"dev": false,
"hassio": false,
"virtualenv": false,
"python_version": "3.10.5",
"docker": false,
"arch": "aarch64",
"timezone": "Europe/Paris",
"os_name": "Linux",
"os_version": "5.15.0-48-generic",
"run_as_root": true
},
"custom_components": {
"localtuya": {
"version": "4.1.0",
"requirements": []
},
"hacs": {
"version": "1.27.2",
"requirements": [
"aiogithubapi>=22.2.4"
]
}
},
"integration_manifest": {
"domain": "localtuya",
"name": "LocalTuya integration",
"version": "4.1.0",
"documentation": "https://github.com/rospogrigio/localtuya/",
"dependencies": [],
"codeowners": [
"@rospogrigio",
"@postlund"
],
"issue_tracker": "https://github.com/rospogrigio/localtuya/issues",
"requirements": [],
"config_flow": true,
"iot_class": "local_push",
"is_built_in": false
},
"data": {
"device_config": {
"friendly_name": "Radiateur salle de bain",
"local_key": "<redacted>",
"host": "192.168.0.49",
"device_id": "<redacted>",
"protocol_version": "3.3",
"model": "EverWarm",
"dps_strings": [
"1 (value: True)",
"2 (value: 18)",
"3 (value: 19)",
"4 (value: low)",
"12 (value: 0)"
],
"entities": [
{
"id": 1,
"friendly_name": "Radiateur sale de bain",
"target_temperature_dp": 2,
"current_temperature_dp": 3,
"temperature_step": 1,
"precision": 1,
"hvac_mode_dp": 1,
"hvac_mode_set": "True/False",
"hvac_action_dp": 1,
"hvac_action_set": "True/False",
"preset_dp": 4,
"preset_set": "low/high/anti-frost",
"platform": "climate"
}
],
"product_key": "<redacted>"
},
"device_cloud_info": {
"active_time": 1661617510,
"biz_type": 18,
"category": "qn",
"create_time": 1661617510,
"icon": "smart/icon/ay1564458733639x1LBu/d99c56ecd09b917be37dce839e919cf0.png",
"id": "<redacted>",
"ip": "<redacted>",
"lat": "48.8166",
"local_key": "<redacted>",
"lon": "1.9687",
"model": "EverWarm",
"name": "Radiateur salle de bain",
"online": true,
"owner_id": "<redacted>",
"product_id": "<redacted>",
"product_name": "EverWarm",
"status": [
{
"code": "switch",
"value": true
},
{
"code": "temp_set",
"value": 18
},
{
"code": "temp_current",
"value": 19
},
{
"code": "mode",
"value": "low"
}
],
"sub": false,
"time_zone": "+01:00",
"uid": "<redacted>",
"update_time": 1661617557,
"uuid": "<redacted>"
}
}
}
Provide Home Assistant taceback/logs
When I try to update a device some are becoming unavailable and I get a bunch of errors.
If I update it from the tuya app, it's coming back
After update from home assistant
After update from tuya app
2022-10-03 12:53:37.990 ERROR (SyncWorker_7) [homeassistant.util.logging] Exception in _update_handler when dispatching 'localtuya_106340162cf432744588': ({'1': True},)
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 399, in _update_handler
self.status_updated()
File "/config/custom_components/localtuya/climate.py", line 363, in status_updated
self.dps_conf(CONF_TARGET_TEMPERATURE_DP) * self._target_precision
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
2022-10-03 12:59:55.324 ERROR (MainThread) [custom_components.localtuya.common] [106...588] Connect to 192.168.0.49 failed
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/locks.py", line 390, in acquire
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 202, in _make_connection
status = await self._interface.status()
File "/config/custom_components/localtuya/pytuya/__init__.py", line 507, in status
status = await self.exchange(STATUS)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 486, in exchange
msg = await self.dispatcher.wait_for(seqno)
File "/config/custom_components/localtuya/pytuya/__init__.py", line 259, in wait_for
await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 216, in _make_connection
await self._interface.reset(self._default_reset_dpids)
AttributeError: 'NoneType' object has no attribute 'reset'
2022-10-03 13:00:07.988 ERROR (MainThread) [custom_components.localtuya.common] [106...588] Not connected to device Radiateur salle de bain
Additional information
I did add some preset in the climate.py like mentionned in this PR : https://github.com/rospogrigio/localtuya/pull/906/files
The error I had was resolved by restarting the device.
However I still don't understand why all my entities are working even tho they all have id : 1