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

Making My Cabin Office Smart with Zigbee2MQTT

by published 10 October 20266 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 SNZB-06P presence sensorPresence in the office, plus light level
SONOFF SNZB-02D temperature and humidity sensors (2 pack)One in the office, one in the shed
Moes Zigbee roller blind motors (x2)Motorised blinds on the office windows
Heiman Zigbee smoke alarmFire detection
Tuya Zigbee rain sensor with light detectorTells me when it’s raining
eWeLink Zigbee 3.0 mini PIR motion sensorMovement in the garden outside the office
SONOFF SNZB-01P wireless buttons (2 packs)Office lights and shed light
SONOFF ZBMINIL2 smart switch (no neutral needed)The shed LED strip light
SONOFF S60ZBTPG smart plugThe table lamp, with energy monitoring

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. Outside, the roof and deck have WLED strip lights too.

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 light has its own button.

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
cabin-sonoff-temp-sensor-button.webp
A SONOFF temperature and humidity sensor showing 21.6°C and 56% next to a round SONOFF wireless button, both mounted on the cabin wall
A SNZB-02D sensor and an SNZB-01P button on the office wall.

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:

cabin-moes-blind-motor.webp
A white Moes Zigbee blind motor fixed to the cabin wall, driving the ball chain of a dark roller blind
One of the Moes motors. It drives the blind's ball chain and has its own up and down buttons.
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 Moda Smartstone ceramic electric radiator (1000W). It’s a WiFi radiator controlled by the Smart Life app, and Smart Life is connected to Home Assistant, so Home Assistant runs the heating 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

cabin-heiman-smoke-alarm.webp
A white Heiman Zigbee smoke alarm mounted on the wooden ceiling of the cabin next to a beam
The Heiman smoke alarm on the office ceiling.

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, up to five times, until the smoke clears. (The interruption-level: critical setting is for iPhones; on Android the equivalent is channel: alarm_stream.) 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, and it runs through Home Assistant along with everything else. I’m not going to go into how it’s set up, for obvious reasons.

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 Blind” 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.

The cabin isn’t the only part of the garden Home Assistant looks after. A Raspberry Pi runs my automated irrigation system, with soil moisture sensors, a pump and valves, and the roof and deck have WLED lights.

Was this helpful?

[jackwent]