t0bst4r / matterbridge-home-assistant

Apache License 2.0
79 stars 9 forks source link

[Bug]: all devices shown as offline in Google Home #176

Open chino-lu opened 1 month ago

chino-lu commented 1 month ago

What happened?

I have set up the Matterbridge via unRaid. It seems that the connection to Home Assistant is fine since all the lights are shown.

The pairing with Google Home is working as well, but after this all devices are shown as offline and I can't toggle them.

Your configuration

No response

Relevant log output

No response

Version

Matterbrigde 1.3.13 // Plugin 1.6.17

bobbieluke1 commented 1 month ago

I am running into the same issue on v1.4.1. Do you have any Active Sessions or any update on the issue?

t0bst4r commented 1 month ago

Could you provide some details?

chino-lu commented 1 month ago

no update on the issue from my side.

I have the feeleing it is due to the usage of VLANS, but not yet the time to look into it further

t0bst4r commented 1 month ago

There are definitley some restrictions for matter regarding VLANs.

Matter is using MDNS, a UDP based protocol, to discover devices. This can be blocked by firewalls or network settings. Also different network segments can be a problem because routers normally do not route UDP packages between them. If you have such a setup please make sure everything is configured to route UDP packages.

https://github.com/project-chip/matter.js/blob/main/docs/TROUBLESHOOTING.md#network-considerations

bobbieluke1 commented 1 month ago
debug - [13:43:19.467] [Matterbridge]: Commissioning changed on fabric 1 for Matterbridge [ { fabricIndex: 1, fabricId: 10864597200969996862, nodeId: 1362384309, rootNodeId: 18446744060824715265, rootVendorId: 24582, label: '' } ]
info - [13:43:19.858] [Matterbridge]: Active session changed on fabric 1 id 10864597200969996862 vendor 24582 (GoogleHome) for Matterbridge { name: 'secure/3162', nodeId: 1362384309, peerNodeId: 3330267060, fabric: { fabricIndex: 1, fabricId: 10864597200969996862, nodeId: 1362384309, rootNodeId: 18446744060824715265, rootVendorId: 24582, label: '' }, isPeerActive: true, secure: true, lastInteractionTimestamp: 1722951799858, lastActiveTimestamp: 1722951799858, numberOfActiveSubscriptions: 0 }
info - [13:43:29.869] [Matterbridge]: Setting reachability to true for Matterbridge
debug - [13:43:29.869] [Matterbridge]: Setting reachability to true for bridged device: MA-onoffpluginunit
debug - [13:43:29.870] [Matterbridge]: Setting reachability to true for bridged device: MA-extendedcolorlight
debug - [13:43:36.104] [Matterbridge]: The frontend sent /api/settings
debug - [13:43:36.104] [Matterbridge]: WebSocketServer logger local callback: inactive
debug - [13:43:36.104] [Matterbridge]: WebSocketServer logger global callback: active
debug - [13:47:10.908] [input_boolean.test / OnOffAspect]: FROM HA: input_boolean.test changed on-off state to on
debug - [13:47:11.759] [input_boolean.test / OnOffAspect]: FROM HA: input_boolean.test changed on-off state to off

Screenshot 2024-08-06 2 52 51 PM

It is connected to home assistant and can see state changes, google can see the devices and entities I have exposed as a test but they are always offline.

It is installed via docker-compose as is home assistant not HAOS or as an addon. Also when trying to connect in home assistant via the matter configuration popup I can't connect to the websocket, I'm not sure if I am meant to be able to?

t0bst4r commented 1 month ago

Could you add another screenshot of the "devices" page? Reachability seems to be true for both devices... So actually there should be no reason to show it as offline.

You say Google Home updates the status coming from matter - even when its showing the devices as offline? That's strange...

bobbieluke1 commented 1 month ago

Screenshot 2024-08-06 3 19 48 PM Screenshot_20240806_151801_Home

I have added a device and it didn't update in the google home app so had to reset commissioning.

bobbieluke1 commented 1 month ago

It seems similar to this issue but not sure how to resolve: https://github.com/Luligu/matterbridge/issues/92

Lanstrom commented 1 month ago

Screenshot_2024-08-14-19-54-25-200_com android chrome-edit

Is there any further updates on this?

I've just set up Matterbridge in docker and exposed entities from Home Assistant to it. That bit went fine and I can see everything I exposed in Matterbridge. I added the entities to Google Home but they all show Offline.

I use a Unifi network and although I do have my Google devices on a separate vlan I don't usually have any issues. My Home Assistant and docker setup all runs on the main LAN so that shouldn't cause any issues.

bobbieluke1 commented 1 month ago

No still stick at that point too. I have a Cisco switch with ipv6 enabled and a single vlan. I can ping6 devices across the network without issue. I have been trying for the last couple of months with no luck.

Lanstrom commented 1 month ago

I've enabled ipv6 on my Unifi setup. I deleted the previous devices in Google home and then reset Matterbridge so I could start the process fresh. None of that helped. Devices still show Offline :(

t0bst4r commented 1 month ago

I am so sorry, that i am not very helpful here, but i am not that experienced with network setups and network requirements of matter.

Anyway this bug still looks a lot like the bug posted in the matterbridge rep (posted by bobbieluke1 before):

Could you please

  1. set the log level to debug
  2. reset matterbridge commissioning (shouldnt show any fabrics, but the QR code)
  3. start commissioning and post the full log of the commissioning process? Not a screenshot from within matterbridge.

Maybe this will lead us to some root cause.

Lanstrom commented 1 month ago

@t0bst4r

You were right to go along with IPv6 being the issue. I now have it fully working (connected to Google Home and showing Active Sessions in Matterbridge).

I went to https://unique-local-ipv6.com/ and generated an IPv6 address. So for example I got fd55:7362:3cf0::/48 I converted this to fd55:7362:3cf0:1001::/64 (changed the end bit from ::/48 to 1001::/64) and pasted it into the IPv6 tab in the network setup on Unifi. After doing that I rebooted my Matterbridge server and observed that the Matterbridge UI was now showing an IPv6 address in the subnet above. Suddenly Matterbridge reported that Google Home was active and it all worked.

EDIT: Just to clarify. I added the 1001 because I also set up another IPv6 for a seperate VLAN on 1002 just so I could easily tell which VLAN a device was on by looking at its IPv6.

Many thanks for this plugin :)

mwhrtin commented 2 weeks ago

@Lanstrom

Could you share more details about your Unifi configuration, I have similar issues with all the devices showing as offline in Google Home and I'm also using a Unifi network. I read on this page, Effortless Matter setup with Unifi, that Multicast DNS should be off but it doesn't make any difference for me if I disable it.

My setup:

At first I had the IPv6 Interface Type set to "None" in the network settings but I changed it to "Static" and replicated what you did with generating an IPv6 address and copying it to the settings. The other IPv6 settings was set to "Auto", but I've now changed that to manual settings and using Client Address Assignment set to "DHCPv6" instead of the default "SLAAC" (made no difference).

Once I updated the IPv6 subnet I restarted the server and verified that both the server itself and the Matterbridge UI showed the same IPv6 address and that it was in the subnet. The device is added in Google Home but it goes offline soon after being added, it's also named "bridge" and all the lights are listed as "bulb" instead of their real name and placed in an unassigned room:

I also get this error message in the log (three times) when I add the device. I assume it's related to why the devices go offline:

error - [09:42:30.797] [SubscriptionHandler]: Error sending subscription update message (error count=1): RetransmissionLimitReachedError at MessageExchange.retransmitMessage (file:///usr/local/l ... eExchange.js:276:36) at TimerNode.callback (file:///usr/local/l ... eExchange.js:296:20) at Timeout._onTimeout (file:///usr/local/l ... e/TimeNode.js:50:12) at listOnTimeout (node:internal/timers:581:17) at process.processTimers (node:internal/timers:519:7)

I've reset the Matterbridge commissioning and re-added the device several times trying different network settings, but they all end up with offline devices. One time I was asked to select the room for the bridge when I added it, that time the bridge was actually given the name I entered while adding it and it was placed in the room I selected. But instead none of the lights were added, only the bridge, and it still went offline soon after being added. But I haven't been able to reproduce that behavior (only bridge added but with correct name) since then.

Lanstrom commented 2 weeks ago

IMG_20240826_120216 That's what it should look like. You should tick the auto for the DNS if you are not using a DNS forwarder like pihole or Adguard.

Hope that helps.

chino-lu commented 2 weeks ago

I had been finally able to get it up and running. I moved the matterbridge docker container on the IoT VLAN (how this is achieved in UnRaid can be read here: https://forums.unraid.net/topic/117906-how-to-assign-a-docker-to-a-vlan/)

After this, I had to turn on IoT Auto-Discovery for the IoT network and Multicast Filtering off.

I was able to connect to Matterbridge with a Tablet which is also on the IoT VLAN. Before, I could not set it up correctly, so it must be something with the communication between Default and IoT VLAN.