Zigbee2mqtt: moving to docker

I have zigbee2mqtt version 1.2.1 running with 3 devices.
Now I want to run this in a docker environment and tried to follow this site.
Started the container as described to create the create the configuration directory.
Copied my configuration.yaml from my 1.2.1 installation directory to the fresh created configuration.yaml.
Started the docker container with docker-compose.
I see one payload in HA, but that is never updated.
How can I figure out, where the problem is located?

configuration.yaml:

homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.178.111'
serial:
  port: >-
    /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X1111110019364111-if00
devices:
  '0x111111002b51111':
    friendly_name: XiaomiAqara-1
    retain: false
  '0x11111100025e1111':
    friendly_name: XiaomiAqara-2
    retain: false
  '0x1111110002e21111':
    friendly_name: XiaomiSmart-1
    retain: false
  '0x111111fffe271111':
    friendly_name: '0x111111fffe271111'
    retain: false

docker-compose.yml

  version: '3'
  services:
    zigbee2mqtt:
      container_name: zigbee2mqtt
      image: koenkk/zigbee2mqtt
      volumes:
        - /home/pi/data:/app/data
      devices:
        - /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X1111110019364111-if00
      restart: unless-stopped 
      network_mode: host

Output of docker-compose up:

Starting zigbee2mqtt ... done
Attaching to zigbee2mqtt
zigbee2mqtt      | Using '/app/data' as data directory
zigbee2mqtt      | 
zigbee2mqtt      | > [email protected] start /app
zigbee2mqtt      | > node index.js
zigbee2mqtt      | 
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:22 AM Logging to directory: '/app/data/log/2019-07-16.07-43-22'
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:23 AM Starting zigbee2mqtt version 1.4.0 (commit #unknown)
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:23 AM Starting zigbee-shepherd
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM zigbee-shepherd started
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM Coordinator firmware version: '20190223'
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM Currently 1 devices are joined:
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM 0x111111fffe271111 (0x111111fffe271111): unkown - undefined unknown (EndDevice)
zigbee2mqtt      |   zigbee2mqtt:warn 7/16/2019, 7:43:25 AM `permit_join` set to  `true` in configuration.yaml.
zigbee2mqtt      |   zigbee2mqtt:warn 7/16/2019, 7:43:25 AM Allowing new devices to join.
zigbee2mqtt      |   zigbee2mqtt:warn 7/16/2019, 7:43:25 AM Set `permit_join` to `false` once you joined all devices.
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM Zigbee: allowing new devices to join.
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM Connecting to MQTT server at mqtt://192.168.178.111
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM zigbee-shepherd ready
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM Connected to MQTT server
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'online'
zigbee2mqtt      |   zigbee2mqtt:info 7/16/2019, 7:43:25 AM MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"version":"1.4.0","commit":"unknown","coordinator":20190223,"log_level":"info","permit_join":true}'

When I check the non-docker log, I see 4 devices joined… None of those undefined unknown…

Did you also copy database.db over from your prior installation to /home/pi/data? That’s z2m’s repository of joined devices and their types and capabilities.

1 Like

No, I haven’t because I saw (one time) values after starting the container, but no updates.
Now, I have copied the database and I don’t see the first values anymore and even no updates…

Hmm, odd.

In that case, I would try this:

  • stop the container
  • delete the database.db and state.json files
  • restart the container
  • reset your devices
  • re-join your devices

Yes, it’s a pain, but with only three it should only take a couple of minutes.

1 Like

Yes, but this would be the last option. Because than they won’t work with my non docker install, too.
Maybe someone else has another idea which I could try first :thinking:

Problem was that the non docker installation had started automatically after reboot… Stopped that and everything works.