Open o0zonko0o opened 6 months ago
I have same error but for floar thermostat heater warmtec SRT20W. Added with tuya cloud. When adding a climate with localtuya, I get same error:
Diagnostics from the device:
{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2024.7.3",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.12.4",
"docker": true,
"arch": "aarch64",
"timezone": "Europe/Warsaw",
"os_name": "Linux",
"os_version": "6.6.31-haos-raspi",
"supervisor": "2024.08.0",
"host_os": "Home Assistant OS 12.4",
"docker_version": "26.1.4",
"chassis": "embedded",
"run_as_root": true
},
"custom_components": {
"hacs": {
"documentation": "https://hacs.xyz/docs/configuration/start",
"version": "1.34.0",
"requirements": [
"aiogithubapi>=22.10.1"
]
},
"localtuya": {
"documentation": "https://github.com/rospogrigio/localtuya/",
"version": "5.2.1",
"requirements": []
}
},
"integration_manifest": {
"domain": "localtuya",
"name": "LocalTuya integration",
"codeowners": [
"rospogrigio",
"postlund"
],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/rospogrigio/localtuya/",
"iot_class": "local_push",
"issue_tracker": "https://github.com/rospogrigio/localtuya/issues",
"requirements": [],
"version": "5.2.1",
"is_built_in": false
},
"setup_times": {
"null": {
"setup": 0.019094240000413265
},
"01J5R36GMPKXXSKXAYK1VZ401B": {
"config_entry_setup": 0.3709622850001324,
"config_entry_platform_setup": 0.004661858001782093
}
},
"data": {
"device_config": {
"friendly_name": "Warmtec_SRT20W",
"host": "192.168.1.15",
"local_key": "My_key",
"protocol_version": "3.3",
"enable_debug": true,
"entities": [
{
"friendly_name": "Korytarz_termostat",
"target_temperature_dp": 2,
"current_temperature_dp": 3,
"temperature_step": 1,
"precision": 1,
"hvac_action_set": "heating/no_heating",
"preset_set": "Manual/Holiday/Program",
"temperature_unit": "celsius",
"target_precision": 1,
"heuristic_action": true,
"max_temperature_dp": 15,
"min_temperature_dp": 11,
"hvac_action_dp": 5,
"hvac_mode_dp": 4,
"id": 1,
"platform": "climate"
}
],
"add_entities": false,
"model": "Temp-2",
"device_id": "bf46ebde29ead08ed5fala",
"dps_strings": [
"1 (value: True)",
"2 (value: 310)",
"3 (value: 279)",
"4 (value: home)",
"5 (value: 1)",
"9 (value: False)",
"11 (value: 0)",
"15 (value: 60)",
"19 (value: -10)",
"101 (value: 10)",
"102 (value: 35)",
"103 (value: False)",
"104 (value: False)",
"106 (value: 3)",
"107 (value: 1)",
"108 (value: False)",
"109 (value: True)",
"110 (value: 2)"
]
},
"device_cloud_info": {
"active_time": 1723747977,
"biz_type": 0,
"category": "wk",
"create_time": 1723745309,
"icon": "smart/icon/bay1671175132655mOtP/3dd0295d5c847440b399a898f9f70fba.png",
"id": "bf46ebde29ead08ed5fala",
"ip": "212.106.163.76",
"lat": "50.81",
"local_key": "#4<hf[<}K`c.VH6!",
"lon": "17.77",
"model": "",
"name": "Temp-2",
"online": true,
"owner_id": "201506309",
"product_id": "jaovfquhkmbydxyp",
"product_name": "Temp-2",
"status": [
{
"code": "switch",
"value": false
},
{
"code": "temp_set",
"value": 265
},
{
"code": "temp_current",
"value": 294
},
{
"code": "mode",
"value": "home"
},
{
"code": "child_lock",
"value": false
},
{
"code": "fault",
"value": 0
},
{
"code": "upper_temp",
"value": 60
},
{
"code": "temp_correction",
"value": -10
},
{
"code": "frost",
"value": false
},
{
"code": "sound",
"value": true
}
],
"sub": false,
"time_zone": "+02:00",
"uid": "some_my_uid",
"update_time": 1724174490,
"uuid": "ac465ba1da1656b9"
}
}
}
And the error:
2024-08-20 21:53:28.026 ERROR (SyncWorker_21) [homeassistant.util.logging] Exception in _new_entity_handler when dispatching 'localtuya_entity_bf46ebde29ead08ed5fala': ('climate.korytarz_termostat',)
Traceback (most recent call last):
File "/config/custom_components/localtuya/common.py", line 261, in _new_entity_handler
self._dispatch_status()
File "/config/custom_components/localtuya/common.py", line 349, in _dispatch_status
async_dispatcher_send(self._hass, signal, self._status)
File "/usr/src/homeassistant/homeassistant/helpers/dispatcher.py", line 214, in async_dispatcher_send
hass.verify_event_loop_thread("async_dispatcher_send")
File "/usr/src/homeassistant/homeassistant/core.py", line 463, in verify_event_loop_thread
frame.report_non_thread_safe_operation(what)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 225, in report_non_thread_safe_operation
report(
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report
_report_integration(what, integration_frame, level, error_if_integration)
File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration
raise RuntimeError(
RuntimeError: Detected that custom integration 'localtuya' calls async_dispatcher_send from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_dispatcher_send at custom_components/localtuya/common.py, line 349: async_dispatcher_send(self._hass, signal, self._status). Please report it to the author of the 'localtuya' custom integration.
2024-08-20 21:53:28.104 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback Entity._async_write_ha_state_from_call_soon_threadsafe() (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _async_write_ha_state_from_call_soon_threadsafe
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1070, in __async_calculate_state
if state_attributes := self.state_attributes:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 540, in state_attributes
hass, self.target_temperature_high, temperature_unit, precision
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/functools.py", line 995, in __get__
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 625, in target_temperature_high
return self._attr_target_temperature_high
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LocaltuyaClimate' object has no attribute '__attr_target_temperature_high'. Did you mean: '_attr_target_temperature_high'?
2024-08-20 21:53:35.996 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback Entity._async_write_ha_state_from_call_soon_threadsafe() (None)
Traceback (most recent call last):
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _async_write_ha_state_from_call_soon_threadsafe
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1070, in __async_calculate_state
if state_attributes := self.state_attributes:
^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 540, in state_attributes
hass, self.target_temperature_high, temperature_unit, precision
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/functools.py", line 995, in __get__
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 625, in target_temperature_high
return self._attr_target_temperature_high
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 318, in __getattribute__
return super().__getattribute__(__name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LocaltuyaClimate' object has no attribute '__attr_target_temperature_high'. Did you mean: '_attr_target_temperature_high'?
The problem
I was trying to add Avatto EM81H thermostat to localtuya. This thermostat is designed for electric floor heating.
I have added the Thermostat Avatto ME81H with localtuya. For the configuration of the first DP, I chose climate and set it up accordingly with the extract of dp in tuya cloud.
When all conf done, I am looking at localtuya entities, and it says, climate. Thermostat unavailable.
Environment
Steps to reproduce
DP dump
DP dump from tuya cloud: { "result": { "properties": [ { "code": "switch", "custom_name": "", "dp_id": 1, "time": 1710591350778, "value": true }, { "code": "mode", "custom_name": "", "dp_id": 2, "time": 1710605743095, "value": "manual" }, { "code": "frost", "custom_name": "", "dp_id": 10, "time": 1710591538214, "value": true }, { "code": "temp_set", "custom_name": "", "dp_id": 16, "time": 1710609346547, "value": 21 }, { "code": "upper_temp", "custom_name": "", "dp_id": 19, "time": 1710591422867, "value": 30 }, { "code": "temp_current", "custom_name": "", "dp_id": 24, "time": 1710611806261, "value": 210 }, { "code": "lower_temp", "custom_name": "", "dp_id": 26, "time": 1710591418096, "value": 8 }, { "code": "temp_correction", "custom_name": "", "dp_id": 27, "time": 1710591320651, "value": -2 }, { "code": "valve_state", "custom_name": "", "dp_id": 36, "time": 1710605785285, "value": "open" }, { "code": "week_program1", "custom_name": "", "dp_id": 38, "time": 1710591321146, "value": "BgAUCAAPCx4PDB4PEQAWFgAPCAAWFwAP" }, { "code": "factory_reset", "custom_name": "", "dp_id": 39, "time": 1710591319212, "value": false }, { "code": "child_lock", "custom_name": "", "dp_id": 40, "time": 1710591363523, "value": false }, { "code": "sensor_choose", "custom_name": "", "dp_id": 43, "time": 1710609331419, "value": "in" }, { "code": "fault", "custom_name": "", "dp_id": 45, "time": 1710591320901, "value": 0 }, { "code": "Temp_dif", "custom_name": "", "dp_id": 101, "time": 1710591435377, "value": 1 }, { "code": "program_mode", "custom_name": "", "dp_id": 102, "time": 1710591499327, "value": "52" } ] }, "success": true, "t": 17106126XXXX, "tid": "9bf03835e3c011eXXXX" }
Provide Home Assistant traceback/logs
Additional information