home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.7k stars 28.86k forks source link

MATRIX integration blocking Home Assistant from wrapping up the start up phase / task pending #118693

Open jsapede opened 4 weeks ago

jsapede commented 4 weeks ago

The problem

Since days got warning message at HA restart issued from matrix integration, despite integration seems to work Made update of matrix server yesterday but no effect except generating new warnings (see https://github.com/home-assistant/core/issues/111921)

`Enregistreur: homeassistant.core Source: core.py:533 S'est produit pour la première fois: 09:29:13 (1 occurrences) Dernier enregistrement: 09:29:13

Something is blocking Home Assistant from wrapping up the start up phase. We're going to continue anyway. Please report the following info at https://github.com/home-assistant/core/issues: tapo_control.button, adguard.sensor, esphome.binary_sensor, energy, mqtt.device_tracker, sun, shelly.binary_sensor, versatile_thermostat.climate, mobile_app, template, zeroconf, bluetooth, tapo_control.switch, mqtt.sensor, meteo_france.sensor, spook.event, esphome.button, select, presence_simulation.switch, mqtt, logger, versatile_thermostat, frigate.image, threshold.binary_sensor, http, hassio.binary_sensor, pirateweather, input_text, xiaomi_miot, awtrix, esphome, awtrix.notify, proxmoxve.binary_sensor, xiaomi_miio.alarm_control_panel, xiaomi_miot.climate, xiaomi_miio.switch, zwave_js.binary_sensor, mobile_app.notify, remote, zone, usb, local_calendar, binary_sensor, system_log, mqtt.number, co2signal, tapo_control.camera, logbook, esphome.sensor, xiaomi_miot.cover, energy.sensor, zwave_js.number, telegram_bot, versatile_thermostat.select, dhcp, ipp.sensor, template.cover, diagnostics, scheduler, tapo_control.select, moon.sensor, forecast_solar, homeassistant.scene, scheduler.switch, frigate, mobile_app.binary_sensor, xiaomi_miot.text, spook, api, group, command_line.switch, alarmo.alarm_control_panel, stt, my, shelly.climate, search, spook.select, mqtt.switch, websocket_api, threshold, wyoming.stt, shelly, spook.switch, zwave_js.switch, shelly.event, media_player, cover, input_button, proxmoxve, frigate.switch, device_tracker, ssdp, mqtt.text, config, mqtt.binary_sensor, sun.sensor, tts, zwave_js.cover, blueprint, calendar, homeassistant, meross_lan.update, utility_meter, shelly.valve, auth, backup, ffmpeg, frigate.binary_sensor, time, hacs.sensor, versatile_thermostat.number, xiaomi_miot.vacuum, xiaomi_miot.camera, cast, command_line, xiaomi_miot.fan, forecast_solar.sensor, switch_as_x.light, proxmoxve.sensor, zwave_js.button, lock, group.cover, notify, homeassistant_alerts, xiaomi_miot.button, frigate.update, xiaomi_miot.device_tracker, fan, zwave_js.sensor, number, shelly.light, wyoming.tts, workday, input_datetime, versatile_thermostat.sensor, hacs, input_number, sensor, xiaomi_miio.sensor, light, device_automation, shelly.sensor, co2signal.sensor, panel_custom, trace, counter, filter.sensor, cast.media_player, shelly.button, humidifier, synology_dsm.sensor, synology_dsm.button, conversation, scene, frontend, webhook, xiaomi_miot.switch, frigate.camera, xiaomi_miot.number, mobile_app.sensor, adguard.switch, spook.number, tapo_control.number, xiaomi_miot.water_heater, xiaomi_miot.remote, google_assistant, hacs.update, google_translate, zwave_js, mqtt.lock, timer, frigate.sensor, cloud, tapo_control, meross_lan, weather, workday.binary_sensor, climate, mqtt.select, mqtt.button, media_source, tapo_control.update, hardware, spook.button, wyoming, xiaomi_miot.media_player, spook.sensor, moon, mqtt.light, hassio, wake_word, xiaomi_miot.sensor, zwave_js.light, matrix.notify, onvif, google_translate.tts, script, picotts.tts, input_select, xiaomi_miio, tapo_control.light, meross_lan.light, switch, alarmo, synology_dsm.update, network, adguard, update, schedule, xiaomi_miot.light, person, season, mobile_app.device_tracker, synology_dsm.switch, meteo_france.weather, map, synology_dsm.camera, mqtt.update, synology_dsm, vacuum, valve, google_assistant.button, camera, frigate.number, file_upload, xiaomi_miot.alarm_control_panel, zwave_js.update, utility_meter.sensor, spook.time, xiaomi_miot.select, spook.binary_sensor, matrix, meross_lan.sensor, analytics, shelly.cover, local_calendar.calendar, tapo_control.sensor, automation, synology_dsm.binary_sensor, onboarding, intent, text, system_health, webrtc, python_script, derivative.sensor, repairs, application_credentials, hassio.update, pirateweather.sensor, telegram.notify, zwave_js.select, assist_pipeline, event, derivative, persistent_notification, presence_simulation, shelly.switch, siren, tapo_control.siren, switch_as_x, versatile_thermostat.binary_sensor, statistics.sensor, tag, xiaomi_miot.humidifier, hassio.sensor, history, button, meteo_france, default_config, meross_lan.switch, alarm_control_panel, lovelace, water_heater, shelly.update, xiaomi_miio.light, image_upload, template.sensor, season.sensor, image, tapo_control.binary_sensor, group.switch, ipp, input_boolean, cloud.tts, xiaomi_miot.binary_sensor, proxmoxve.button, recorder, stream The system is waiting for tasks: {<Task pending name='Task-2473' coro=<MatrixBot.init..handle_startup() running at /usr/src/homeassistant/homeassistant/components/matrix/init.py:217> wait_for= cb=[set.remove()]>}`

What version of Home Assistant Core has the issue?

core-2024.5.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Matrix

Link to integration documentation on our website

https://www.home-assistant.io/integrations/matrix/

Diagnostics information

No response

Example YAML snippet

##########
# Matrix #
##########
matrix:
  homeserver: https://synapse.xxxxx
  username: "@xxxx:synapse.xxxxx"
  password: xxxxxx
  rooms:
    - "#notifications:synapse.xxxxx"

notify:
    # Matrix
  - name: synapse
    platform: matrix
    default_room: "#notifications:synapse.xxxxx"

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 4 weeks ago

Hey there @paarthshah, mind taking a look at this issue as it has been labeled with an integration (matrix) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `matrix` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign matrix` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


matrix documentation matrix source (message by IssueLinks)

PaarthShah commented 4 weeks ago

When you say that it seems to work, can you confirm that events are fired based off of word commands/regex commands?

Or that you're able to send messages as the bot user using the notify service?

jsapede commented 4 weeks ago

hello

i'm able to use the notify service, will have a try tonight or tomorrow to fire events

jsapede commented 3 weeks ago

OK tried the following commands :

'matrix: homeserver: https://synapse.xxxx username: "@soucieu:synapse.xxxx" password: xxxxx rooms:

and automation :

`alias: Nouvelle automatisation description: "" trigger:

but nothing happens. No execution traces, and no system journal specific message

[EDIT] it started to work after 2 reboots and a wait time, say 5 minutes or so ... but still got the message at HA start

rwjack commented 2 weeks ago

I'm also getting this. Everything seems to be working, although I'm thinking this might be related to another warning:

Detected blocking call to open inside the event loop by integration 'matrix' at homeassistant/components/matrix/__init__.py, line 345: return load_json_object(self._session_filepath) (offender: /usr/src/homeassistant/homeassistant/util/json.py, line 78: with open(filename, mode="rb") as fdesc:), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+matrix%22 Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once handle._run() 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/runner.py", line 166, in setup_and_run_hass return await hass.async_run() File "/usr/src/homeassistant/homeassistant/core.py", line 515, in async_run await self.async_start() File "/usr/src/homeassistant/homeassistant/core.py", line 534, in async_start self.bus.async_fire_internal(EVENT_HOMEASSISTANT_START) File "/usr/src/homeassistant/homeassistant/core.py", line 1554, in async_fire_internal self._hass.async_run_hass_job(job, event) File "/usr/src/homeassistant/homeassistant/core.py", line 936, in async_run_hass_job hassjob.target(*args) File "/usr/src/homeassistant/homeassistant/core.py", line 1418, in __call__ self.hass.async_run_hass_job(self.listener_job, event) File "/usr/src/homeassistant/homeassistant/core.py", line 939, in async_run_hass_job return self._async_add_hass_job(hassjob, *args, background=background) File "/usr/src/homeassistant/homeassistant/core.py", line 748, in _async_add_hass_job task = create_eager_task( File "/usr/src/homeassistant/homeassistant/util/async_.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 207, in handle_startup self._access_tokens = await self._get_auth_tokens() File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 345, in _get_auth_tokens return load_json_object(self._session_filepath) 

@PaarthShah I use another custom extension that seems to have fixed this warning, more info here: https://github.com/Athozs/hass-additional-ca/issues/7

PaarthShah commented 2 weeks ago

Ooh interesting; this should hopefully be an easy fix, I'll check it out