Automating Trådfri or Hue lights with Home Assistant and Conbee

Getting started with Home assistant to automate your IKEA Trådfri or Philips Hue lights, using a Raspberry Pi and Conbee, the docker way

Hardware used in this writeup

  • Raspberry Pi 3
  • Conbee
  • IKEA Trådfri E27 1000 lm bulb


  • OS: Raspbian Stretch
  • Docker 18.06
  • Home Assistant 0.80
  • deCONZ 2.05.39 / 9/22/2018

Installing Docker, Home Assistant, deCONZ

0 Install Docker if not already installed

curl -fsSL -o && sh


1 Install Home assistant

docker run -d  \
    --name="home-assistant"  \
    -v /home/pi/homeassistant:/config \
    -v /etc/localtime:/etc/localtime:ro  \
    --net=host  \
    --restart=always \


In a short while you should be able to browse to http://ip-of-your-pi:8123

2 Install deCONZ

deCONZ is the software provided by Dresden Elektronik that controls connected Zigbee devices, such as lights. Make sure your Conbee is plugged in.

docker run -d \
    --name=deconz \
    --net=host \
    --restart=always \
    --/etc/localtime:/etc/localtime:ro \
    -v /opt/deconz:/root/.local/share/dresden-elektronik/deCONZ \
    --device=/dev/ttyUSB0 \
    -e DECONZ_WEB_PORT=8080 \
    -e DECONZ_WS_PORT=8443 \

Ref: Note: deCONZ by default listens on port 80 and 443, which is a problem if you want to run a web server, hence this snippet sets deCONZ to use port 8080 instead

Setting up the lights

I had some trouble adding my Trådfri lights. First of all deconz seem only to accept http connections from, so if you’re running your Pi headless you first need to set up an SSH tunnel. ssh -L 8080:localhost:8080 pi@pi

  1. Now point your web browser to http://localhost:8080
  2. Set a password
  3. For me, some bug in deCONZ wouldn’t let me log in. Google eventually led me to http://localhost:8080/edit_system.html
  4. Now logging in works..!
  5. Power on your light bulb close to the Conbee
  6. Menu -> Devices -> Lights -> Add new light
  7. Set a useful name, such as “Kitchen window”

deCONZ login trouble

Experiencing a lot off issues with deCONZ Web GUI.

Pairing the light is also a bit tricky. Using the reset sequence (on-off 6 times), deCONZ eventually found a Trådfri bulb.

Connecting deCONZ to Home assistant

  1. Log onto Home assistant http://pi:8123
  2. Menu -> Configuration -> Integration -> Set up a new integration -> deCONZ Zigbee gateway -> Configure
  3. Go back to deCONZ PWA
  4. Menu -> Gateway -> Advanced
  5. “Authenticate app”
  6. In Home assistant, click “I have pressed the button”

Grouping lights in Home assistant

# /home/pi/homeassistant/groups.yaml
  name: Kitchen
  view: yes

Automating lights

# /home/pi/homeassistant/automations.yaml
- alias: Lighten up
    - platform: sun
      event: sunset
      offset: "-00:30:00"
    - platform: time
      at: "06:00:00"
    service: light.turn_on
    entity_id: group.all_lights

- alias: Lights out
    - platform: sun
      event: sunrise
      offset: "00:30:00"
    - platform: time
      at: "01:00:00"
    service: light.turn_off
    entity_id: group.all_lights


If you made it this far, your lights should turn on half an hour before sunset and at 6 AM, they should also go dark a half hour after sunrise, and at 1 AM.

Home assistant


Add a comment