Migrating z2m-copied over all files from old config/data-devices not showing

I am running HA and Z2M on a RPI3. Something was going wrong where my entire setup would crash and become unresponsive. Rather than taking the time to troubleshoot, I figured I would just setup HA and Z2M on another spare RPI3 I had.

I copied everything in the Z2M folder from my old system to my new system. All the configurations for MQTT and Z2M are the same.

However, my devices are not showing up.

I thought it would be as simple as copying over all the files from the old system to the new system?

Here is my Z2M log

[17:44:12] INFO: Preparing to start...
[17:44:14] INFO: Socat not enabled
[17:44:20] INFO: Starting Zigbee2MQTT...
[2024-06-16 17:44:34] info: 	z2m: Logging to console, file (filename: log.log)
[2024-06-16 17:44:35] info: 	z2m: Starting Zigbee2MQTT version 1.38.0 (commit #unknown)
[2024-06-16 17:44:35] info: 	z2m: Starting zigbee-herdsman (0.49.2)
[2024-06-16 17:44:36] info: 	zh:zstack:znp: Opening SerialPort with {"path":"/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_e63a560570d8ed1182bb796162c613ac-if00-port0","baudRate":115200,"rtscts":false,"autoOpen":false}
[2024-06-16 17:44:36] info: 	zh:zstack:znp: Serialport opened
[2024-06-16 17:44:37] info: 	z2m: zigbee-herdsman started (resumed)
[2024-06-16 17:44:37] info: 	z2m: Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20210708,"transportrev":2},"type":"zStack3x0"}'
[2024-06-16 17:44:37] info: 	z2m: Currently 0 devices are joined:
[2024-06-16 17:44:37] info: 	z2m: Zigbee: disabling joining new devices.
[2024-06-16 17:44:37] info: 	z2m:mqtt: Connecting to MQTT server at mqtt://core-mosquitto:1883
[2024-06-16 17:44:39] info: 	z2m:mqtt: Connected to MQTT server
[2024-06-16 17:44:39] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
[2024-06-16 17:44:40] info: 	z2m: Started frontend on port 8099
[2024-06-16 17:44:40] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
[2024-06-16 17:44:40] info: 	z2m: Zigbee2MQTT started!
[2024-06-16 17:44:45] info: 	z2m:mqtt: MQTT publish: topic 'homeassistant/binary_sensor/1221051039810110150109113116116_0x00124b002c3af01e/connection_state/config', payload '{"device":{"hw_version":"zStack3x0 20210708","identifiers":["zigbee2mqtt_bridge_0x00124b002c3af01e"],"manufacturer":"Zigbee2MQTT","model":"Bridge","name":"Zigbee2MQTT Bridge","sw_version":"1.38.0"},"device_class":"connectivity","entity_category":"diagnostic","name":"Connection state","object_id":"zigbee2mqtt_bridge_connection_state","origin":{"name":"Zigbee2MQTT","sw":"1.38.0","url":"https://www.zigbee2mqtt.io"},"payload_off":"offline","payload_on":"online","state_topic":"zigbee2mqtt/bridge/state","unique_id":"bridge_0x00124b002c3af01e_connection_state_zigbee2mqtt","value_template":"{{ value_json.state }}"}'

How is Zigbee2MQTT installed ?

I’m not quite sure what you mean.

I added the repository and installed the regular version of Zigbee2MQTT

Ok. You can install Zigbee2MQTT bare-metal, as a Docker container and as a HA Add-on. Since you talk about a repository I will assume the HA Add-on.

How did you copy the files over ? I guess it is because the HA Add-on can’t read them because of wrong file-permissions.

Yes HA Add-on, I used File Editor from the HA Add-on store to upload the files.

File Editor should set the correct permissions. Do you see your devices in the add-on ?

No, there is nothing in my devices.

I posted the log because it does not seem Z2M is reading the devices section of the config?

If you stop Zigbee2MQTT, and then look at /config/zigbee2mqtt, are the configuration files overwritten ?

I added the new device and it was added to the end of my configuration file

Here is everything before the list of my devices

homeassistant: true
    - 33
    - 27
    - 0
    - 22
    - 86
    - 182
    - 32
    - 199
    - 116
    - 209
    - 233
    - 48
    - 214
    - 17
    - 112
    - 145
  pan_id: 61514
    - 135
    - 158
    - 117
    - 25
    - 17
    - 24
    - 146
    - 97
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
  server: mqtt://core-mosquitto:1883
  user: XXXXX
  password: XXXXX
  port: >-
  port: 8099
  legacy: false

Did you copy the database.db too ?

Yes, I will delete what is in the folder and copy again tomorrow

I think it copying over the datebase.db fixed it. I think I might have to repair some devices such as motion sensors since the motion sensors are not on all the time for Z2M to configure when loading everything from before.

I have no idea what happened last time but I wanted to do a fresh install of HA again and get everything setup finally.

These are my steps in case I mess up again.

Install mosquitto broker, setup a user for mqtt, start mqtt, add mqtt integration, configure mqtt integration

add z2m repo, configure serial and port (I use 8099), start z2m to create the folder (maybe you can create a folder first and then start?), install file editor, copy over backed up z2m files, start z2m

z2m is still currently running but my devices are slowly showing up

1 Like