Skip to content

zigbee2mqtt/hassio-zigbee2mqtt

Repository files navigation



Official Zigbee2MQTT Home Assistant app

Caution

If you're using a Raspberry Pi, ensure you have at least a Raspberry Pi 4, as running it on a Raspberry Pi 3 may cause instability due to its limited resources.

Installation

  1. If you don't have an MQTT broker yet; in Home Assistant go to Settings → Apps → App store and install the Mosquitto broker app, then start it.
  2. Go back to the App store, click ⋮ → Repositories, fill in
    https://github.com/zigbee2mqtt/hassio-zigbee2mqtt and click Add → Close or click the Add repository button below, click Add → Close (You might need to enter the internal IP address of your Home Assistant instance first). Open your Home Assistant instance and show the add app repository dialog with a specific repository URL pre-filled.
  3. The repository includes two apps:
    • Zigbee2MQTT is the stable release that tracks the released versions of Zigbee2MQTT. (recommended for most users)
    • Zigbee2MQTT Edge tracks the dev branch of Zigbee2MQTT such that you can install the edge version if there are features or fixes in the Zigbee2MQTT dev branch that are not yet released.
  4. Click on the app and press Install and wait till the app is installed.
  5. Start the app by going to Info and click Start
  6. Wait a few seconds and press OPEN WEB UI, you will now see the onboarding page. More information about the onboarding can be found here.
  7. Fill in the desired settings, for most setups changing the following is enough:
    • Select your adapter under Found Devices, this will configure the Coordinator/Adapter Port/Path and Coordinator/Adapter Type/Stack/Driver.
    • Fill in the Closests WiFi Channel to select the most optimal Zigbee channel.
  8. Press Submit, Zigbee2MQTT will now start, wait a few seconds and refresh the page. You should now see the Zigbee2MQTT frontend.
    • If it shows 502: Bad Gateway wait a bit more and refresh the page.
    • If this takes too long (e.g. 2 minutes +) check the Log tab to see what went wrong.
    • In case the app fails to start with the following error: USB adapter discovery error (No valid USB adapter found). Specify valid 'adapter' and 'port' in your configuration., we need to fill in the serial section. Format can be found here, but skip the initial serial: indent. e.g.:
      adapter: zstack
      port: /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00
      If you don't know the port and you have just one USB device connected to your machine try /dev/ttyACM0 or /dev/ttyUSB0 or /dev/ttyAMA0. Else use the Home Assistant CLI and execute ha hardware info to find out.

For more information see the documentation.

Restoring data from a standalone installation

  1. Ensure that both environments are running the same version
  2. Ensure you can SSH to your Home Assistant OS (NOT to the SSH App)
  3. Backup your standalone environment data folder (possibly leaving out the logs/ folder)
  4. Start the Zigbee2MQTT HA app with a non-existing tty device, to create the data folder
  5. Restore your data folder contents into /mnt/data/supervisor/homeassistant/zigbee2mqtt, e.g. via scp -O -P 22222 -i PATHTOUSEDSSHKEY ./data/* root@hass:/mnt/data/supervisor/homeassistant/zigbee2mqtt/
  6. Configure your serial port and MQTT settings using the HA app configuration UI
  7. Edit the /usr/share/hassio/homeassistant/zigbee2mqtt/configuration.yaml file:
    • Ensure that the serial port section matches the one configured with the UI
    • Remove any irrelevant sections from the config (e.g. mqtt (if not needed), advanced/log_syslog, frontend)
  8. Start the app

Changelog

The format is based on Keep a Changelog.

All notable changes to this project will be documented in the CHANGELOG.md file.

Version for releases is based on Zigbee2MQTT format: X.Y.Z.

Any changes on the app that do not require a new version of Zigbee2MQTT will use the format: X.Y.Z-A where X.Y.Z is fixed on the Zigbee2MQTT release version and A is related to the app.

Edge version will not maintain a CHANGELOG and doesn't have a version.

Issues

If you find any issues with the app, please check the issue tracker for similar issues before creating one. If your issue is regarding specific devices or, more generally, an issue that arises after Zigbee2MQTT has successfully started, it should likely be reported in the Zigbee2MQTT issue tracker.

Feel free to create a PR for fixes and enhancements.

Testing changes locally

If you're submitting a PR and wish to test it locally:

  • Gain root access to your Home Assistant installation
  • In the App Settings, Ensure "Watchdog" is turned off so the container isn't automatically restarted when it's stopped via the CLI

image

  • Enter the zigbee2mqtt container interactively.
docker exec -it $(docker ps | grep zigbee2mqtt | cut -d" " -f 1) /bin/sh
  • Edit the file you'd like to test & save.
vi node_modules/zigbee-herdsman-converters/converters/toZigbee.js
  • Back on the Home Assistant installation, restart the zigbee2mqtt container
docker restart $(docker ps | grep zigbee2mqtt | cut -d" " -f 1)
  • Refresh the web UI and perform your testing.

Credits