Sanderhuisman / home-assistant-custom-components

🏡 Custom components for Home-Assistant
https://www.home-assistant.io/
Apache License 2.0
33 stars 12 forks source link

All containers' properties are "UNKNOWN" #19

Open GuyKh opened 4 years ago

GuyKh commented 4 years ago

Using HA in a container with this configuration (in docker-compose):

  homeassistant:
    container_name: home-assistant
    restart: on-failure
    image: homeassistant/raspberrypi3-homeassistant:0.102.1
    volumes:
      - ${USERDIR}/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - ${USERDIR}/docker/shared:/shared
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8123:8123"
      - "6080:8080"
    privileged: true
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
    network_mode: host
    labels:
     - "traefik.enable=false"

And here, in HA - the containers are loaded - but without data: image

What to do?

Maerchensarg commented 4 years ago

I use Portainer to manage my docker containers. I have added the item "/var/run/docker.sock:/var/run/docker.sock" to the container "homeassistant". If I recreate the container, the sensors will receive data. But as soon as I restart the Home Assistant Server via GUI (Configuration - Server Controls), no more data will appear. Maybe this helps.

GuyKh commented 4 years ago

I use Portainer to manage my docker containers. I have added the item "/var/run/docker.sock:/var/run/docker.sock" to the container "homeassistant". If I recreate the container, the sensors will receive data. But as soon as I restart the Home Assistant Server via GUI (Configuration - Server Controls), no more data will appear. Maybe this helps.

As you see, I too add docker.sock to the container... I don't have it running on the first time...

StWiesi commented 4 years ago

I have a similar issue.

However, I see data for some containers. Some of them show up as unknown though. A HA restart fixed this sometimes. It can also happen that after a restart previously unknown container properties show up, but others that worked before are unknown then.

guillaumelamirand commented 4 years ago

@StWiesi It is because a reference to the container object is stored localy at startup with the id. When you recreate the container using the same name (ie docker-compose down and up) the name is the same but the id changed, so the reference is broken and never refresh until next restart of HA.

I deal with that in a fork with some additional fixes.