mrk-its / homeassistant-blitzortung

Custom Component for fetching lightning data from blitzortung.org
MIT License
186 stars 38 forks source link

'blitzortung' calls async_write_ha_state from a thread #93

Closed Mariusthvdb closed 2 months ago

Mariusthvdb commented 3 months ago

please see following logging;

2024-04-25 08:03:44.788 ERROR (SyncWorker_21) [homeassistant.util.logging] Exception in _on_connection_change when dispatching 'blitzortung_mqtt_connected': ()
Traceback (most recent call last):
  File "/config/custom_components/blitzortung/__init__.py", line 222, in _on_connection_change
    sensor.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1008, in async_write_ha_state
    self.hass.verify_event_loop_thread("async_write_ha_state")
  File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread
    frame.report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'blitzortung' calls async_write_ha_state from a thread at custom_components/blitzortung/__init__.py, line 222: sensor.async_write_ha_state(). Please report it to the author of the 'blitzortung' custom integration.

I am aware there is another issue open for non-safe calls, but this is new, and happening after the last 'fix'

HA 2024.5 beta Blitzortung 1.3.2

Pipo31416 commented 2 months ago

Same here with HA 2024.5 (non beta).

mrk-its commented 2 months ago

Let's check on 1.3.3

Mariusthvdb commented 2 months ago

currently running the 1.3.3, and debug: true with asyncio in debug mode:

No more mentioning of the logged issue for me.

mrk-its commented 2 months ago

Great, so let's close it, thanks for help!