Installing the conbee zigbee usb dongle on home assistant core

Z-wave and zigbee are two competing low-power wireless standards, so far I have used z-wave through a zwave hat on my raspberry pi.

Since zigbee seems to be gaining some traction I decided to also add a zigbee network. To do so, I bought the conbee usb dongle.

the integration with home assistant allows for some choices: ZHA, deconz or zigbee2mqtt. In my case, for no good reason I went with deconz first but could not get all sensors visible (my smart wall plug could be turned on and off but no power readings). Installing the ZHA integration then proved to be easier, no additonal daemon needed and all sensors were visible.

Probably though zigbee2mqtt is the way to go. I’ll try it if ZHA gives me issues.

Installation (for deconz)

/

As usual, on home assistant os all is done out of the box, for us home assistant core users we need to install the zigbee middleware (the gateway) ourselves. The required software is called ‘deconz’, no standard package is in the repositories for raspbian so we need to add the phoscon repository to apt. (alternatively a docker image is also available).

0. plug in the device. (it is recommended to use an usb extension cable to avoid interference, I did not yet do this).

  1. follow the instruction at phoscon for installing the driver.

(unfortunately all the gui tools are also installed you can expect a lot of dependencies)
start up the daemon:

after installation:
[email protected]:/etc/mosquitto# systemctl list-unit-files | grep conz
deconz-gui.service                     disabled
deconz-homebridge-install.service      disabled
deconz-homebridge.service              disabled
deconz-init.service                    disabled
deconz-update.service                  enabled
deconz-wifi.service                    disabled
deconz.service                         disabled

enable deconz and start it:
systemctl enable deconz
systemctl start deconz

new status:
[email protected]:/etc/mosquitto# systemctl list-unit-files | grep conz
deconz-gui.service                     disabled
deconz-homebridge-install.service      disabled
deconz-homebridge.service              disabled
deconz-init.service                    disabled
deconz-update.service                  enabled
deconz-wifi.service                    enabled
deconz.service                         enabled

check the log for correct startup. the default port is 80.

You can now connect your browser to http://<ip_of_your_pi>:80 and you will get the web interface.

2. through the web gui, you can configure the device:

  • you will be prompted for a password. set up the initial password.
  • if necessary, update firmware. Go to ‘menu’ then ‘gateway’.
  • in menu/gateway, click on ‘advanced’.

enable pairing mode by clicking on ‘authenticate app’.

3. link the zigbee gateway to your home assistant core: add the dconz integration.
(more info: https://www.home-assistant.io/integrations/deconz/)

  • go to devices and configure dconz
  • enter your ip, it can be 127.0.0.1 if running on the same system.
  • complete the pairing process.

installing an mqtt broker for home assistant core

What is MQTT and why do you want it ?

MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT). It is designed as an extremely lightweight publish/subscribe messaging transport that is ideal for connecting remote devices with a small code footprint and minimal network bandwidth.

From https://mqtt.org:

In other words, it is a messaging protocol which is designed to be efficient for frequent message sending between different devices. A device can send messages to an mqtt topic, and your home assistant server could retrieve these messages from that topic.
Like the Installing zwave-js on home assistant core article, this component is actually installed out of the box on home assistant but not in the installation of the core version.

I keep the below info as a reference for myself, the document will be improved as I make changes.

Installation and configuration:

Install the package using apt. Like eg the zwave server, this will run as a separate daemon on your home assistant appliance (next to home assistant itself):

mosquitto/oldstable,now 1.5.7-1+deb10u1 armhf [installed]

go into /etc/mosquitto/ and add a custom configuration file to conf.d:

Set up a configuration:

# global
allow_anonymous false
password_file  /etc/mosquitto/conf.d/mosquitto_users

# default listener
port 1883

# ssl listenener
listener 8883
cafile /etc/mosquitto/certs/wf_ca.crt
certfile /etc/mosquitto/certs/mqtt.crt
keyfile /etc/mosquitto/certs/mqtt.key
#tls_version tlsv1.2

Here, I disable anonymous connections to the broker, configure a location for a user/password file and set up an ssl and a plaintext listener.

Configure a user:

mosquitto_passwd -c mosquitto_users mqttuser

(the -c is used to create the file so should be used only once. through -b you could add the password immediately on the cli).

Create some certificates for the ssl listener, you need:

  1. the certificate of your ca. this should be a private, internal ca.
  2. the certificate to be used for your mqtt broker
  3. the private key to be used for your mqtt broker.

place them into the certs folder:

ls -l certs/
total 16
-rw-r--r-- 1 root root  130 Nov 16  2019 README
-rw-r--r-- 1 root root 1859 Feb 10 15:01 mqtt.crt
-rw-r--r-- 1 root root 3244 Feb 10 15:01 mqtt.key
-rw-r--r-- 1 root root 1815 Feb 10 15:17 wf_ca.crt

You can now start the daemon.

Configuration in home assistant:

Unfortunately, not all settings can be configured through the gui (yet and at the time of writing). Notably configuring the ssl part. In your configuration.yml put:

mqtt:
  certificate: "/etc/mosquitto/certs/wf_ca.crt"
  broker: "192.168.1.16"
  port: 8883
  username: mqttuser
  password: "thisismypassword"

Now go to settings/devices and verify the mqtt integration is there.

If you click ‘configure’ on the mqtt broker you can test it: