t0bst4r / matterbridge-home-assistant

Apache License 2.0
31 stars 2 forks source link

Bug: Can´t install/update the home assistant plugin from within Matterbridge #97

Closed Jibbonator closed 1 week ago

Jibbonator commented 2 weeks ago

At First I Would like to thank t0bst4r for his outstanding Plugin. I´ve waited a long time for something like this, because I´m no programmer myself xD I really like the Idea to connect my homeassistant local to Alexa without the need of an custom Alexa skill and own Domain. I know i could use Emulated Hue, but it doesn´t support other Entity Types than Lights.

Here´s my Problem:

I have a Standalone Docker environment with working Matterbridge with Zigbee2Mqtt Addon. I like it because my Mqtt Broker is standalone and could even work without Homeassistant running. I use it because in the momentary state it supports many entity Types. https://github.com/Luligu/matterbridge-zigbee2mqtt

I´m using the official matterbridge Docker Container.

I try to add "matterbridge-home-assistant"

The Addon is installed but doesn´t start. Here is a screenshot and my config:

image

here´s my config:

services:
  matterbridge:
    container_name: matterbridge
    image: luligu/matterbridge:latest # Matterbridge image with the latest tag
    network_mode: host # Ensures the Matter mdns works
    restart: unless-stopped # Ensures the container always restarts automatically
    volumes:
      - "/mnt/Matterbridge:/root/Matterbridge" # Mounts the Matterbridge plugin directory
      - "/mnt/Matterbridge/.matterbridge:/root/.matterbridge" # Mounts the Matterbridge storage directory
    environment:
      HOME_ASSISTANT_URL: 'http://192.*.*.*:8123'
      HOME_ASSISTANT_ACCESS_TOKEN: 'eyJ**********4k'
      HOME_ASSISTANT_CLIENT_CONFIG: |
        {
          "includeDomains": ["light", "media_player"],
          "excludePatterns": ["media_player.*echo*"]
        }
          "excludePatterns": ["media_player.*echo*"]
        }

An I´m overlooking something? Is my config correct? I tried to look into the Logs but "matterbridge-home-assistant" ist even in it.

Any help is appreciated

update: Just updated to 1.1.3. No it´s starting but with no devices.

the error in the log is:

[12:21:51.231] [HomeAssistantMatterAdapter] Failed to register device for light.wzd1 [12:21:51.231] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.233] [HomeAssistantMatterAdapter] Failed to register device for light.wzd2 [12:21:51.233] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.234] [HomeAssistantMatterAdapter] Failed to register device for light.wzd3 [12:21:51.234] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.236] [HomeAssistantMatterAdapter] Failed to register device for light.wzd4 [12:21:51.236] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.237] [HomeAssistantMatterAdapter] Failed to register device for light.shellywohnzimmerlicht [12:21:51.237] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.238] [HomeAssistantMatterAdapter] Failed to register device for light.0xa4c1381250d6ac83 [12:21:51.239] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.241] [HomeAssistantMatterAdapter] Failed to register device for media_player.shield_2 [12:21:51.241] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.242] [HomeAssistantMatterAdapter] Failed to register device for media_player.shield [12:21:51.242] [HomeAssistantMatterAdapter] Error: Only supported EndpointInterface implementation is Endpoint [12:21:51.244] [HomeAssistantMatterAdapter] Failed to register device for light.flur_kamera_floodlight_timed

image

There is a workaround for the standalone installation: https://github.com/t0bst4r/matterbridge-home-assistant/issues/59

But I don´t know to adapt this to my problem.

t0bst4r commented 2 weeks ago

Hi @Jibbonator , thanks for reaching out!

The problem is related to how npm handles globally installed packages and their dependencies. As recommended for npm packages I added "matterbridge" as a dependency (i also tried peerDependencies) to my project.

But when installed globally, npm installs all dependencies and peerDependencies into an extra node_modules folder of the package itself. After that you have the following folder structure:

You can see that matterbridge and project-chip are installed twice. This does not happen when using the workaround in #59 because they are not installed globally, but locally. Matterbridge itself always installs plugins globally via the UI.

When that happens, node.js considers those packages not to be compatible.

Why does it work for other plugins? Other plugins (like zigbee2mqtt) do not add matterbridge and project-chip as a dependency at all to the plugin. This leads to both globally installed projects to use the same version of matter.js.

Why don't I remove matterbridge and project-chip from the dependencies list? It is just wrong to not add it.

How to solve it?

  1. Build your own docker image using the workaround from #59. You can install the zigbee plugin the same way. But it'll never work with the web ui.
  2. I could move the dependencies to devDependencies and exclude the eslint rule. Having that, it would also work using the UI.

Let me just think about solution 2 for one or two days, then I'll come back with an answer if I want to do it, or not 😬

Jibbonator commented 2 weeks ago

Thanks for the fast reply.

Take your time with the decision.

I'm currently just experimenting with Matterbridge, so there's no rush.

github-actions[bot] commented 1 week ago

:tada: This issue has been resolved in version 1.2.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Jibbonator commented 1 week ago

Thx for the fast solution. I can now install and start the plugin. The entities are showing up and I can control them.