custom-components / sensor.airthings_wave

hassio support for Airthings Wave BLE environmental radon sensor.
MIT License
100 stars 28 forks source link

Need to map /var/run/dbus/:/var/run/dbus/:z in docker #90

Open TomTorger opened 2 years ago

TomTorger commented 2 years ago

Hello,

I was stuck for a while. I am running HA in docker on Ubuntu and had to map /var/run/dbus to get this to work. Not sure there is anything the repo can do to fix this issue, but perhaps include some text somewhere for those who get stuck? :-)

`(...) volumes:

You can find the same issue here: https://github.com/devbis/ble2mqtt/issues/5

ismarslomic commented 2 years ago

I get same issue as @mikeboiko in #86, after upgrading Airthings Wave custom component to v4.0.0 in HACS. I even tried redownloading and Updating the information in HACS, without any luck.

2022-07-20 22:44:46 ERROR (SyncWorker_2) [custom_components.airthings_wave.airthings] Not getting device info because failed to connect to device.

I'm running HA v2022.7.5 in Docker container on Ubuntu Server (22.04 LTS) running on Intel Nuc. I tried mounting dbus as volume, but without any luck.

docker-compose.yml for HA:

version: '3.8'
services:
  homeassistant:
    container_name: homeassistant
    image: homeassistant/intel-nuc-homeassistant:2022.7.5
    volumes:
      - ./config/ha:/config
      - /var/run/dbus:/var/run/dbus:z
    environment:
      - TZ=Europe/Oslo
    restart: unless-stopped
    network_mode: "host"
    depends_on:
      - zwavejs2mqtt

Custom sensor configuration for Airthings that is unchanged and worked previously:

- platform: airthings_wave
  mac: !secret airthings_wave_mac
  scan_interval: 600 # in seconds (10 minutes)

Edit: I have Airthings Wave Plus device

ismarslomic commented 2 years ago

@TomTorger since you run HA in docker and on Ubuntu, and you have managed to fix the issue similar to mine, could you please share your docker-compose.yml file for HA and the sensor configuration for Airthings Wave? I have tried removing the mac property of sensor configuration, but then I get the error below. So I think I need to explicitly set the mac address since mine Airthings Wave Plus device can't be auto detected.

ERROR (SyncWorker_4) [custom_components.airthings_wave.sensor] Failed intial setup.
mikeboiko commented 2 years ago

@TomTorger, thanks for the share. The dbus volume mount fixed my issue!

ismarslomic commented 2 years ago

@mikeboiko see my posts above. Could you please share your setup, since mounting dbus volume did not fix mine issue.

mikeboiko commented 2 years ago

@ismarslomic, sure. This is my compose snippet:

  home-assistant:
    container_name: home-assistant
    hostname: home-assistant
    image: ghcr.io/home-assistant/home-assistant:latest
    environment:
      TZ: 'America/Edmonton'
    volumes:
      - ./volumes/ha:/config
      - /etc/localtime:/etc/localtime:ro
      - /var/run/dbus/:/var/run/dbus/:z
    restart: always
    network_mode: host
    depends_on:
      - mqtt
      - db
      - assistant-relay
      - zwavejs2mqtt
    privileged: true
ismarslomic commented 2 years ago

@mikeboiko Excellent, it worked! Thanks mate! Issue where that I did not start the container in privileged mode.

mikeboiko commented 2 years ago

@ismarslomic good stuff!

TomTorger commented 2 years ago

Guess I should have included the full docker config. Great to see you managed anyways :-)