jens-maus / RaspberryMatic

:house: A feature-rich but lightweight, buildroot-based Linux operating system alternative for your CloudFree CCU3/ELV-Charly 'homematicIP CCU' IoT smarthome central. Running as a pure virtual appliance (ProxmoxVE, Home Assistant, LXC, Docker/OCI, Kubernetes/K8s, etc.) on a dedicated embedded device (RaspberryPi, etc.) or generic x86/ARM hardware.
https://raspberrymatic.de
Apache License 2.0
1.53k stars 186 forks source link

HmIPW-DRAP/HmIP-HAP cannot identify RaspberryMatic as a HA addon #1373

Open ThomasSiegmund opened 3 years ago

ThomasSiegmund commented 3 years ago

Running RaspberryMatic in a standard Docker subnetwork on the host prevents a DRAP from connecting ...

Steps to reproduce the behavior

  1. Configure a DRAP to connect to a standalone RaspberryMatic. Make sure it can connect and the LED lights up in turquoise
  2. Switch off the DRAP
  3. Move your RaspberryMatic installation into a Docker container, e.g. by creating a backup and restoring from it in a freshly set up Docker installation according to the installation guide. I used the docker-compose variant of the docker setup.
  4. Power up the DRAP The DRAP goes to the usual sequence of yellow, green and turqoise lights. In the end it flashes in turquoise, indicating that it wants to connect to CCU but does not find it.

Expected behavior The DRAP should discover the CCU and connect to it.

System information:

Additional context The issue seems to be related to network discovery by UDP broadcasts. I noticed that RaspberryMatic running on bare metal is visible to EQ3's Netfinder program, but RaspberryMatic running under Docker ist not. So I watched network traffic during Netfinder discovery.

In this example Netfinder is on 10.10.15.1, and two DRAPs are running on 10.10.15.100 und 10.10.15.101

No. Time    Source  Destination Protocol    Length  Info
4   0.648462575 10.10.15.1  255.255.255.255 UDP 52  43537 → 43439 Len=10
6   1.348330504 10.10.15.100    255.255.255.255 UDP 103 43439 → 43537 Len=61
7   1.410798515 10.10.15.101    255.255.255.255 UDP 103 43439 → 43537 Len=61

You can see Netfinder sending a UDP broadcast package, which is immediately answerded by the two DRAPs. I guessed that a similar mechanism might also be used by the DRAP at startup to find the CCU. However, this will fail on a standard Docker setup, because Docker does not support this kind of broadcast messages. The only easy way to fix this I know of, is to run the container in host mode like with this docker compose file:

version: "3.7"
services:
  raspberrymatic:
    image: ghcr.io/jens-maus/raspberrymatic:latest
    container_name: ccu
    hostname: homematic-raspi
    privileged: true
    restart: unless-stopped
    stop_grace_period: 30s
    network_mode: host
    volumes:
      - ccu_data:/usr/local:rw
      - /lib/modules:/lib/modules:ro

Here network_mode: host makes the container use the host network without any internal network or port mapping. Just adding this line to the docker-compose.yaml and restarting the container makes the DRAP connect and to go from flashing to solid turquoise light.

Interestingly, in my experience this problem exists only for the DRAPs. HAPs when run as a range extender to a CCU seem to have a different mechanism of network discovery.

jens-maus commented 11 months ago

Hello, you say it works for you without any problems. Do you also have a wired 6-fold button in operation? For me, 3 different buttons are not trained, the Falmot c12 could be trained.

Sorry @Thorsten1982, but please stay on topic. This is not a discussion fora here, but a bug/issue ticket system and it is about HmIPW-DRAP/HmIP-HAP integration if RaspberryMatic is used as a HA addon. Thus, if you were able to apply the mentioned patch mechanism and you were able to teach-in a HmIPW-DRAP/HmIP-HAP, there is nothing more that needs to be talked here. So if you have other questions, please walk to the discussion part in GitHub here and start a new discussion or use extenal discussion fora instead. We really need to keep this issue ticket clean from such support requests, I am afraid.

Thorsten1982 commented 11 months ago

Yes, sorry, that's of course true. I just wanted to give feedback that the patch works for me but I can't get a wall button or RT trained and thought maybe this could be related to the patch.

jens-maus commented 11 months ago

Yes, sorry, that's of course true. I just wanted to give feedback that the patch works for me but I can't get a wall button or RT trained and thought maybe this could be related to the patch.

No it is not. This is a completely different layer issue which needs to be discussed elsewhere.

ZTHawk commented 11 months ago

I have been struggling with this decision for some time and have now moved to a standalone version instead of HA addon. I have now 2 VirtualBox instances. One with HA and the other with RaspberryMatic.

jens-maus commented 7 months ago

FYI: Please note that discussion regarding general support for macvlan docker container support in HomeAssistant has actually started. See here:

https://github.com/home-assistant/architecture/discussions/1034