Jelajahi Sumber

HA 2024.5 workaround attempt 2

Revert previous ineffective workaround, instead opt out of importing
on executor.

The original issue seems to have been caused by changes in HA 2024.4
to initialise integrations on an executor thread instead of in the
event loop.  So when the receive thread is created, it is not being
created from the event loop, and later gets killed along with the
startup cleanup (which we previously carefully avoided).

Opt out of this change for now until it is clearer how to adapt to
the new HA architecture changes.

Issue #1871, #1872
Jason Rumney 1 tahun lalu
induk
melakukan
81e00715e5

+ 1 - 1
custom_components/tuya_local/device.py

@@ -215,7 +215,7 @@ class TuyaLocalDevice(object):
                             for dp in entity._config.dps():
                             for dp in entity._config.dps():
                                 if not dp.persist and dp.id not in poll:
                                 if not dp.persist and dp.id not in poll:
                                     self._cached_state.pop(dp.id, None)
                                     self._cached_state.pop(dp.id, None)
-                        entity.schedule_update_ha_state()
+                        entity.async_write_ha_state()
                 else:
                 else:
                     _LOGGER.debug(
                     _LOGGER.debug(
                         "%s received non data %s",
                         "%s received non data %s",

+ 2 - 1
custom_components/tuya_local/manifest.json

@@ -9,5 +9,6 @@
     "iot_class": "local_push",
     "iot_class": "local_push",
     "issue_tracker": "https://github.com/make-all/tuya-local/issues",
     "issue_tracker": "https://github.com/make-all/tuya-local/issues",
     "requirements": ["tinytuya==1.13.2"],
     "requirements": ["tinytuya==1.13.2"],
-    "version": "2024.5.0"
+    "version": "2024.5.1",
+    "import_executor": false
 }
 }