Luligu / matterbridge

Matterbridge plugin manager for Matter
https://github.com/Luligu/matterbridge/blob/main/README.md
Apache License 2.0
125 stars 13 forks source link

Bug: Cannot connect to Google Home on IOS #61

Closed Ultra-bob closed 3 weeks ago

Ultra-bob commented 3 weeks ago

Originally posted on the home assistant plugin repo, but it's a problem even with no plugins so posting it here https://github.com/t0bst4r/matterbridge-home-assistant/issues/93 I've set up matterbridge and all my HA devices show up, but when trying to add it to Google Home with my iPhone, it fails. Debug logs attached (they didn't fit) matterbridge-logs.txt

Apollon77 commented 3 weeks ago

Hi,

I had a look at the logs:

1.) You have enabled maaaaany network interfaces. ideally try to limit to one. So many network interfaces could have unwanted side effects 2.) The log shows a successful commissioning of the first fabric for Google. So there could be a chance that it works even if google app shows an error message. 3.) Then Google wants to add the second fabric as they usually do and then it strangely calls the csrRequest command 3 times, but also acknowledges that it received the response, so noooo idea what the google hub/device has ... Please reboot hub and also mobile devcie and make sure that the "current" firmwares are on it and not updates outstanding.

Then I propose to try again, else it might be needed to report the issue to google

Ultra-bob commented 3 weeks ago

How do I disable a network interface? These were all enabled by default.

Ultra-bob commented 3 weeks ago

Here's my docker compose

  matterbridge:
    environment:
      HOME_ASSISTANT_URL: 'http://192.168.2.4:8123'
      HOME_ASSISTANT_ACCESS_TOKEN: "**********"
      HOME_ASSISTANT_CLIENT_CONFIG: |
        {
          "includeDomains": ["light"]
        }
    container_name: matterbridge
    image: luligu/matterbridge:latest # Matterbridge image with the latest tag
    network_mode: host # Ensures the Matter mdns works
    restart: always # Ensures the container always restarts automatically
    volumes:
      - "${HOME}/homeassistant/config/matterbridge/plugins:/root/Matterbridge" # Mounts the Matterbridge plugin directory
      - "${HOME}/homeassistant/config/matterbridge/storage:/root/.matterbridge" # Mounts the Matterbridge storage directory
Luligu commented 3 weeks ago

Hi, concerning the pairing issue Apollon is the best expert to answer you.

Concerning Matterbridge: [23:18:54.601] [Matterbridge] Matterbridge is out of date. Current version: 1.2.22, Latest version: 1.3.0 Why you are using a so old version ?

Current version is:

[1.3.4] - 2024-06-23

and

[1.3.2] - 2024-06-22

also updated matter.js to the latest...

Luligu commented 3 weeks ago

How do I disable a network interface? These were all enabled by default.

What machine are you running matterbridge on ?

Ultra-bob commented 3 weeks ago

What machine are you running matterbridge on ?

It's running on my home server (old gaming pc) through docker

Why you are using a so old version ?

These are old logs, I'm on the latest version and same issue

Ultra-bob commented 3 weeks ago

Please reboot hub and also mobile devcie and make sure that the "current" firmwares are on it and not updates outstanding.

I rebooted the hub, my phone, checked that the hub has latest firmware and checked for updates on google home app. Still same issue

EffortlessHome commented 3 weeks ago

I have the same issues as @Ultra-bob. Pairing doesn't work with IOS and Google Home on latest everything. Love the project and watching this thread closely. Let me know if you want my logs too.

Luligu commented 3 weeks ago

Hi, the log would be usefull for sure. Apple Home is my primary controller and I can assure you that it has never ever failed to pair Matterbridge/matter.js device once. So it can can be something specific to your setup. Maybe with the log we will understand.

Apollon77 commented 3 weeks ago

Yes Debug log please ... and make sure that your docket is correctly configured and UDP messages can flow all between the network of the Apple/Google mobile app,s pods and the matterbridge host ... no VLANs in place that could block UDP routing ...

But in fact log should show whats up ... because if you see nothing happening ion the log at all then UDP is blocked somewhere. If you see incoming traffic then we can look deeper with the log

EffortlessHome commented 3 weeks ago

Appreciate the help. I have tried to pair again with IOS and Google Home. Debug logs attached. My environment is Home Assistant running on an HA Green with the Matterbridge Addon. I don't have a HomeKit device, just several different models of Google/Nest speakers/hubs. debug.txt

Apollon77 commented 3 weeks ago

I need a bit more context for this way to short log :-)

It seems that something is connected and was reading data from 192.168.1.231 ... whats that?

Other then that I do not see any incoming traffic. (if I assume that you tried it in the shown log timeframe). What error is iOS/Google showing you? if it can not find any accessory/device then check your UDP traffic routing. The mobile apps and also the hubs need to be able to communicate with UDP with the matterbridge. So in fact "see above" ... it seems somethings blocks the UDP traffic and you also need IPv6 enabled

Ultra-bob commented 3 weeks ago

Appreciate the help. I have tried to pair again with IOS and Google Home. Debug logs attached. My environment is Home Assistant running on an HA Green with the Matterbridge Addon. I don't have a HomeKit device, just several different models of Google/Nest speakers/hubs. debug.txt

When I try to pair it a second time without resetting, nothing shows in logs and there is a connection failed error, whereas on the first try there is a setup failed error and there are lots of logs. Try resetting the commissioning in the settings

Ultra-bob commented 3 weeks ago

Here are my updated logs and error messages image logs.txt

EffortlessHome commented 3 weeks ago

Sorry about that, I reset commissioning and captured the full debug log while pairing to Google Home on IOS. Regarding 192.168.1.231, that is my Alexa Show which paired easily to Matterbridge. I have IPv6 enabled and don't see any issues with UDP traffic. I get the same error as @Ultra-bob. On initial pair after recommissioning it goes through the steps fairly quickly and then fails. On subsequent pairings it hangs and after several minutes shows that error.

logs.txt

Apollon77 commented 3 weeks ago

@Ultra-bob Ok the log shows the following:

For now I can only ask to check and make sure all stuff is properly updated and please provide app and ios versions. Also I only tests with the "Apple home" being migrated to this new architecture ... no idea if there are issues with the old. Do you maybe have a second apple mobile device to try it too?

Apollon77 commented 3 weeks ago

Ok @EffortlessHome you have the same as @Ultra-bob and now I have an idea ...

You do Google on ios ... got it ... DId you added the device to your google developer console? see https://github.com/project-chip/matter.js/blob/main/docs/ECOSYSTEMS.md#google-home-ecosystem ... Please try this! Long time this was only needed for Android ... and iOs pairing worked without it ... But the place where it fails would be reasonable for the case that they decline the "not certified status".

Ultra-bob commented 3 weeks ago

I'm trying to set that up, but I don't know what to add for the product id and whatever else image

Ultra-bob commented 3 weeks ago

IT WORKED!

I looked more carefully at the settings and saw every device has product id 0x800 0x8000 and set that, and then everything worked perfectly. Thanks so much for all your help @Apollon77 and @Luligu

Apollon77 commented 3 weeks ago

For clarity: it is 0x8000 not 0x800 :-))

EffortlessHome commented 3 weeks ago

Thanks @Apollon77, with that value it also works for me. Can you shed any light on why that is the magic value and if this can be patched in Matterbridge to avoid this in the future?

Apollon77 commented 3 weeks ago

Matter has a bid trust basis based on crypto certificates and such. Each device which was officially certified is getting an onw certificate for the Vendor (and the vendor gets a vendor Id) and then has certified devices (productIds). And everything is officially "pinned" with the certification. There are special VendorIds and productids reserved for "devices in development and testing" and because matterbridge is no certified product is uses these test device IDs.

Formally the certificates used here are self signed and so not 100% as secure as the official devices and also not certified and so could behave wrong according to the standard. In fact each ecosysterm/Controller can not decide how to work with such test devices. Some just warn/inform and some (we had that for Aqara) block them ... Google chose a middle way with this "whitelisting in developer console".

This is in the end inconvenient for test devices.

The reality is that most likely matterbridge and other open source implementation s(also e.g. matter,js example scripts, tasmota integration) will never be certified officially and so this topic will stay. The reason is not that noone wants it to do certification, but in fact all this requires

EffortlessHome commented 3 weeks ago

Makes sense, thanks for the detailed explanation and your assistance. Great work on this project, keep it up!

Ultra-bob commented 3 weeks ago

Maybe there should be a note added to the docs so no-one else has to deal with this, but I think it's resolved now.

Luligu commented 3 weeks ago

Hi, thank you so much. I added a note to the readme.

rexhoffman commented 3 weeks ago

Been trying to follow the setup steps and seeing the same error. 0xfff1, 0x8000 and still no love. Left the google config in a Test mode, and logged in to the test console - getting security warnings. Don't you suppose you could write up your steps more clearly @Ultra-bob?

Ultra-bob commented 3 weeks ago
  1. I went to https://console.home.google.com/projects and used my existing project for controlling my nest thermostat (not sure what I did to create that project in GCP)
  2. Created a new matter device in the Develop section with the settings in my above screenshot (except product id set to 0x8000)

Not sure what you mean by test console and test mode, I stopped after the develop part and saving the default images/branding

The difference is probably with how I initially created the google cloud project when setting up my Nest thermostat, so maybe following that guide https://www.home-assistant.io/integrations/nest/#configuration will help?

rexhoffman commented 3 weeks ago

I found that I needed to "Reset Matterbridge Commissioning", to remove HomeKit integration, and then add the bridge to google home first. I could not reconnect to apple HomeKit afterwards.

Apollon77 commented 3 weeks ago

I found that I needed to "Reset Matterbridge Commissioning", to remove HomeKit integration, and then add the bridge to google home first. I could not reconnect to apple HomeKit afterwards.

What do you mean? As soon as you have paired it to one controller you need to use this controller to get a second pairing code to add another ecosystem! You can not use teh same qr code again!

Luligu commented 2 weeks ago

Hi, that's correct. In one of the next release I will change the QR code in the frontend with the FabricInfo when the bridge/plugin is already paired and connected. Now is actually not clear that you can use the QR only once.

Luligu commented 2 weeks ago

Please reboot hub and also mobile devcie and make sure that the "current" firmwares are on it and not updates outstanding.

I rebooted the hub, my phone, checked that the hub has latest firmware and checked for updates on google home app. Still same issue

Hi, in the latest there is a command line parameter to limit the interfaces used for Matter advertise. You can try to use it to limit to the main interface.

Ultra-bob commented 2 weeks ago

Please reboot hub and also mobile devcie and make sure that the "current" firmwares are on it and not updates outstanding.

I rebooted the hub, my phone, checked that the hub has latest firmware and checked for updates on google home app. Still same issue

Hi, in the latest there is a command line parameter to limit the interfaces used for Matter advertise. You can try to use it to limit to the main interface.

How would I do that for the docker version?