core: Matrix Hub: Hotword no longer working minutes after hass restart
Home Assistant release with the issue: 0.91.1
Last working Home Assistant release (if known): unknown, just started using matrix component
Operating environment (Hass.io/Docker/Windows/etc.): virtualenv
Component/platform: matrix hub
Description of problem: I’m using matrix as chatbot and as notifier. Notifier works reliable but the chatbot (hub component) only works a few minutes and later on does not respond any longer to any predefined keywords.
Problem-relevant configuration.yaml
entries:
matrix:
homeserver: !secret matrix_server
username: !secret matrix_hassbot_user
password: !secret matrix_hassbot_password
rooms:
- "!secret matrix_room"
commands:
- word: Mond
name: Mondphase
rooms:
- "!secret matrix_room"
This is an example hotword I’ve configured. It works as expected, when hass is restarted.
Additional information:
I have set logger to homeassistant.components.matrix: debug
but there is no sign of an error. Component quietly stops working.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 28
I have created a patched version of the Matrix component which fixes my issue. I’ve done this by removing the call to the matrix client to fetch a list of joined rooms and replaced it with a locally maintained list of rooms. This allows the component to correctly avoid re-joining a room in my testing today. There is an obvious weakness in this patch because it will not gracefully handle the case where the bot user gets kicked or removed from a room. In a private setup for control/status of homeassistant like mine this won’t be an issue, but I don’t think this is a good enough long term fix for all. Having said that if anyone else would like to try my patch for their own setup it can be found here. You will need to add these files to a folder within your “custom_components” directory. The matrix section of your configuration.yaml can stay the same.
This is still a issue. When using a automation which answers to a command, every following command will be ignored.
Home Assistant 2020.12.0
I’ve seen this same behavior for 10 or more versions now, and I had less issues than most early on. This very likely won’t or can’t be fixed with the current integration and the current (mostly unmaintained) client library being used. Everytime it has been opened it doesn’t get any activity and is closed again.
The integration probably needs to be re-written with matrix-nio as a client library. There was just a version bump in the matrix-client library being used #53508 , and while the maintainer did bump the client version to keep the integration working, they also state it is unmaintained (https://github.com/matrix-org/matrix-python-sdk/pull/321#pullrequestreview-711682483) and recommended rewrite w/ nio. The PR did to resolve the integration not loading at all when using newer instance versions of Synapse.