Matrix.org integration not working after upgrade to 0.104.3

My matrix.org notify integration is not working since upgrade from 0.103.x to 0.104.3

Before the upgrade, It work just fine, haven’t changed anything in my config file. But since the upgrade matrix is not working anymore.

In the update log is says: (Could it have anything to do with this?)

See error in the logfile:

2020-01-22 14:19:52 ERROR (MainThread) [homeassistant.setup] Error during setup of component matrix
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 88, in setup
    config[CONF_COMMANDS],
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 161, in __init__
    self._client = self._login()
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 291, in _login
    client = self._login_by_token()
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 324, in _login_by_token
    valid_cert_check=self._verify_tls,
  File "/usr/local/lib/python3.7/site-packages/matrix_client/client.py", line 152, in __init__
    self._sync()
  File "/usr/local/lib/python3.7/site-packages/matrix_client/client.py", line 581, in _sync
    room._process_state_event(event)
  File "/usr/local/lib/python3.7/site-packages/matrix_client/room.py", line 640, in _process_state_event
    self.guest_access = econtent["guest_access"] == "can_join"
KeyError: 'guest_access'

My config:

matrix:
  homeserver: "https://mydomain.com"
  username: !secret matrix_username
  password: !secret matrix_password
  rooms:
    - !secret matrix_room_hass

Is this enough information to help me? Any information or help is appreciated.

After a lot of trail and error figured out that sins upgrade #30027 for me, this integration only works wit the matrix.org server and not my home server (synapse v 1.10.0).

I loaded the old config files form before the upgrade in the /custom_components/ folder and [matrix] integration works again for me. Files I loaded: Github [#29392]

Hi,
I’ve got the same error with a matrix.org account I try to set up:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 174, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 88, in setup
    config[CONF_COMMANDS],
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 161, in __init__
    self._client = self._login()
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 304, in _login
    client = self._login_by_password()
  File "/usr/src/homeassistant/homeassistant/components/matrix/__init__.py", line 333, in _login_by_password
    _client.login_with_password(self._mx_id, self._password)
  File "/usr/local/lib/python3.7/site-packages/matrix_client/client.py", line 249, in login_with_password
    return self.login(username, password, limit, sync=True)
  File "/usr/local/lib/python3.7/site-packages/matrix_client/client.py", line 280, in login
    self._sync()
  File "/usr/local/lib/python3.7/site-packages/matrix_client/client.py", line 581, in _sync
    room._process_state_event(event)
  File "/usr/local/lib/python3.7/site-packages/matrix_client/room.py", line 640, in _process_state_event
    self.guest_access = econtent["guest_access"] == "can_join"
KeyError: 'guest_access'

I would like try your method (use old config files) but I’m not able to correctly write my configuration.yaml.
Will you please show me how to you refer to the custom component in your configuration.yaml ?

your configuration.yaml says exacly the same as normal.

The only thing you do is load this folder in the config\custom_components folder. When you reboot home assistant it will use these to load the matrix component.

folder

good luck!

Thank you !

It seems I can connect now to matrix but I’ve got a new error:

Logger: custom_components.matrix
Source: custom_components/matrix/__init__.py:182
First occurred: 17:34:25 (1 occurrences)
Last logged: 17:34:25
Could not join room   - "!myroomid:matrix.org": 400: {"errcode":"M_UNKNOWN","error":"Â  - \"!myroomid:matrix.org\" was not legal room ID or room alias"}

My configuration is like this:

matrix:
  homeserver: https://matrix.org
  username: "@myusername:matrix.org"
  password: mypassword
  rooms:
     - "!myroomid:matrix.org"
   
notify:
  - name: matrix_notify
    platform: matrix
    default_room: "!myroomid:matrix.org"

And this very strange because I’m now I’m able to send notification !

So the Room Id is ok for the notify configuration but wrong for the first part of the configuration.

I’m completly overhelmed !

When you normally login with this matrix user, does it have access to the room?

Yes, it has access.
I don’t know what happened but now I didn’t have the error message ! :thinking:
So strange !

But the bot seems to not work, I can’t have event from a command written in the room.

I work at the same time with node-red-contrib-matrix and It works well ! I can send and receive message from the room.

Should the command to be written in the room by an other account ?
Because in the node-red-contrib-matrix I had to uncheck “Filter events sent by self” to be able to receive my own messages.

You might want to try again @Mathijs. My integration also wasn’t working and decided to test it again running 2021.4.3 and am able to successfully send messages from HA.