~/jackwent.co.uk
jack@jackwent:~$ cat cabin-zigbee2mqtt.yaml

Making My Cabin Office Smart with Zigbee2MQTT

published 10 October 20265 min read

Once I’d built my log cabin home office at the bottom of the garden, the next job was getting it into Home Assistant like the rest of the house. Now I can see what’s going on down there from the house, the heating and blinds look after themselves, one button turns the office on and off, and I find out straight away if something goes wrong.

Most of that runs on Zigbee, through Zigbee2MQTT. This is how it’s set up.

The problem: the office is at the bottom of the garden

Home Assistant runs in the house. The office is at the far end of the garden, behind log walls. Zigbee is low power radio, and a long way through walls and across a garden is exactly where it gets unreliable. Sensors drop off, buttons need pressing twice, and you stop trusting it.

The fix was to stop trying to reach the office from the house, and put the Zigbee radio in the office instead.

A network Zigbee coordinator in the office

The coordinator (the radio that runs the Zigbee network) is an SMLIGHT SLZB-06MU. It connects over Ethernet rather than USB, so it doesn’t need to be plugged into the Home Assistant machine. It sits in the cabin, right in the middle of the devices it talks to.

Zigbee2MQTT, running as an add-on on Home Assistant in the house, connects to it over the network:

# Zigbee2MQTT configuration.yaml (the relevant part)
serial:
  port: tcp://<coordinator-ip>:6638
  adapter: ember

So the only thing crossing the garden is the normal network connection, which the office has anyway. All the Zigbee radio traffic stays inside the cabin, where it’s short range and reliable. Zigbee2MQTT then publishes everything to the Mosquitto MQTT broker, and Home Assistant picks the devices up automatically.

Reliable communication with the office is the reason I went with Zigbee2MQTT and a network coordinator. It has a few other benefits too: Zigbee2MQTT supports a huge range of devices, it runs separately from Home Assistant so restarting Home Assistant doesn’t restart the Zigbee network, and it can update device firmware itself.

The SLZB-06MU has its own Home Assistant integration too, so its network and Zigbee status show up on my dashboard next to everything else, and I can restart it remotely if I ever need to.

What’s in the cabin

These are the Zigbee devices in the office and the shed on the side:

DeviceWhat it’s for
SONOFF Zigbee occupancy sensorPresence in the office, plus light level
SONOFF temperature and humidity sensors with screensOne in the office, one in the shed
Moes roller blind motors (x2)Motorised blinds on the office windows
Heiman smart smoke alarmFire detection
HOBEIAN rain sensorTells me when it’s raining
HOBEIAN motion sensorMovement in the garden outside the office
SONOFF wireless buttons (x3)Office lights, shed light and garden lights
SONOFF smart switch (no neutral)The shed light
Door and window sensors, alarm sirensThe cabin alarm (more on that below)

Everything else in the office is on WiFi or Matter: the ceiling bulbs and floor lamps (Matter), WLED desk lights, a smart radiator, a Sonos speaker, a Home Assistant Voice assistant, a 3D printer and a UniFi access point for the network.

My favourite: the presence sensor

The presence sensor is the one I like most. From the house I can see straight away whether anyone’s in the office, without walking down the garden to check. It also reports the light level in the room, and it feeds into the alarm. I’m building more automations around it next, so the office can react to someone actually being in there rather than just the time of day.

The automations

One button for the whole office

A SONOFF wireless button toggles the office lights (a light group of the ceiling bulbs and floor lamps) and the lava lamp in one press. The shed and the garden lights have their own buttons.

alias: Office Lights
triggers:
  - trigger: device
    domain: mqtt
    device_id: <office-light-button>
    type: action
    subtype: single
actions:
  - action: light.toggle
    target:
      entity_id: light.office_lights
  - action: switch.toggle
    target:
      entity_id: switch.office_lava_lamp_switch

The garden lights run on a 30 minute timer, and an automation turns them off when the timer finishes, so they don’t get left on all night.

Blinds

The blinds open at 8am every morning and close at sunset, so I never have to think about them:

alias: Cabin Blinds
triggers:
  - trigger: time
    at: "08:00:00"
    id: open
  - trigger: sun
    event: sunset
    id: close
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: open
        sequence:
          - action: cover.open_cover
            target:
              entity_id: [cover.office_blind_left, cover.right_office_blind]
      - conditions:
          - condition: trigger
            id: close
        sequence:
          - action: cover.close_cover
            target:
              entity_id: [cover.office_blind_left, cover.right_office_blind]

Heating

The office has a smart radiator, and the heating runs on a simple schedule:

  • On office mornings (Monday, Wednesday and Friday), it warms the office to 22°C at 6am if it’s cold.
  • At midnight, it drops back to 7°C. That’s just frost protection, so an empty room isn’t being heated overnight.
  • When the alarm is armed, it drops to 7°C straight away, because nobody’s in there.

Smoke alarm

The office has a Zigbee smoke alarm. If it detects smoke for more than 10 seconds, Home Assistant sends a critical notification to my phone. That type of alert breaks through silent mode and Do Not Disturb, and it repeats every two minutes until the smoke clears. When you’re in the house and the office is at the bottom of the garden, you’d never hear a smoke alarm going off down there, so this one matters.

alias: Cabin Fire Alarm
triggers:
  - trigger: state
    entity_id: binary_sensor.office_smoke_alarm_smoke
    to: "on"
    for:
      seconds: 10
actions:
  - repeat:
      sequence:
        - action: notify.mobile_app_your_phone
          data:
            title: "FIRE ALARM - Cabin"
            message: "Smoke detected in the cabin at {{ now().strftime('%-I:%M %p') }}."
            data:
              push:
                interruption-level: critical
                sound:
                  name: default
                  critical: 1
                  volume: 1
        - delay:
            minutes: 2
      until:
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.office_smoke_alarm_smoke
              state: "off"
            - condition: template
              value_template: "{{ repeat.index >= 5 }}"

The alarm

The cabin is alarmed. There are sirens, plenty of sensors, and cameras that take snapshots if it goes off. I’m not going to go into how it’s set up, for obvious reasons, but it all runs through Home Assistant along with everything else.

Keeping it all running

Zigbee devices are only useful if you know when one has stopped working, so a few things keep an eye on it:

  • Zigbee2MQTT reports each device’s battery level, so I can swap batteries before a sensor goes quiet.
  • The Zigbee2MQTT bridge and the coordinator both report their connection status to Home Assistant.
  • Zigbee2MQTT flags firmware updates for the Zigbee devices in Home Assistant. For my ESP devices I go a step further with automatic ESPHome firmware updates.

Tips if you’re doing the same

  • Put the coordinator where the devices are. A network coordinator (Ethernet or PoE) means it doesn’t have to sit next to your Home Assistant server. It’s the single biggest thing for reliability in an outbuilding.
  • Mains powered Zigbee devices extend the mesh. Plugs and wired switches act as repeaters for battery sensors further away, so add them where the signal is weakest.
  • Name devices properly from day one. “Office Left Window Sensor” is a lot easier to work with in automations than a string of random characters.
  • Use critical alerts for anything safety related. A normal notification is easy to miss. A smoke alarm in a building you can’t hear from the house needs to be impossible to ignore.

Next up is using that presence sensor properly, so the office lights and heating follow whether I’m actually in there.

[jackwent]