Zigbee2MQTT sees devices but they are unavailable in HA

I switched from ZHA to Zigbee2MQTT a couple of months ago and everything has been working very well.

A neighbour asked me about HA and I wanted to set up a test system for her using a spare RPi and ConBee II dongle I had after converting to a Sonoff dongle. Without thinking it through I enabled ZHA on the RPi with the Conbee II plugged into the RPi. I am assuming that this caused my Zigbee network to become unstable because the Zigbee routers are now unavailable in my HA.

On my own system, everything seems fine in Zigbee2MQTT. I can toggle the devices, particularly plugs that I am using both as Zigbee routers and to turn lights on/off. But the devices are unavailable in HA. I have reset some of the plugs, even deleted them in Zigbee2MQTT, and then added them back again. But they remain unavailable in HA.

HELP!!

This is the Zigbee2MQTT configuration:

This is a list of all the plugs/routers. They are all online but for one which I will remove and add again.

If I open the details of one of the plugs I get the following.

If I click on Exposes I get the following and I can toggle the plug on/off state from the Zigbee2MQTT page.

But when I go to Settings -> Devices&Services -> Devices and filter on "plug - " I get the following.

All the plugs are there. But if I now click on Plug - Upstairs Hall I get the following:

Please notice that from the log it became unavailable about 14 hours ago, which is when I started up the test RPi.

If I look at the MQTT InfoI get the following:

When I expand all the messages I get this:

Plug - Upstairs Hall (switch.plug_upstairs_hall)
MQTT discovery data:
Topic: homeassistant/switch/0x7cb03eaa0a0a6038/switch/config
Payload
availability:
  - topic: zigbee2mqtt/bridge/state
    value_template: '{{ value_json.state }}'
  - topic: zigbee2mqtt/Plug - Upstairs Hall/availability
    value_template: '{{ value_json.state }}'
availability_mode: all
command_topic: zigbee2mqtt/Plug - Upstairs Hall/set
device:
  identifiers:
    - zigbee2mqtt_0x7cb03eaa0a0a6038
  manufacturer: OSRAM
  model: Smart+ plug (AB3257001NJ)
  name: Plug - Upstairs Hall
  sw_version: V1.05.09
name: Plug - Upstairs Hall
payload_off: 'OFF'
payload_on: 'ON'
state_topic: zigbee2mqtt/Plug - Upstairs Hall
unique_id: 0x7cb03eaa0a0a6038_switch_zigbee2mqtt
value_template: '{{ value_json.state }}'
platform: mqtt
Subscribed topics:
zigbee2mqtt/bridge/state
1 most recently received message(s)
Received 10:35:34
QoS: 0, Retained
Payload: offline
zigbee2mqtt/Plug - Upstairs Hall/availability
1 most recently received message(s)
Received 10:35:34
QoS: 0, Retained
Payload: state: online
zigbee2mqtt/Plug - Upstairs Hall
8 most recently received message(s)
Received 11:13:15
QoS: 0
Payload: linkquality: 21
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:15
QoS: 0
Payload: linkquality: 14
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:17
QoS: 0
Payload: linkquality: 43
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:17
QoS: 0
Payload: linkquality: 43
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:20
QoS: 0
Payload: linkquality: 21
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:20
QoS: 0
Payload: linkquality: 21
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:25
QoS: 0
Payload: linkquality: 14
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:25
QoS: 0
Payload: linkquality: 43
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Transmitted messages:
Plug - Upstairs Hall (update.plug_upstairs_hall)
MQTT discovery data:
Topic: homeassistant/update/0x7cb03eaa0a0a6038/update/config
Payload
availability:
  - topic: zigbee2mqtt/bridge/state
    value_template: '{{ value_json.state }}'
  - topic: zigbee2mqtt/Plug - Upstairs Hall/availability
    value_template: '{{ value_json.state }}'
availability_mode: all
command_topic: zigbee2mqtt/bridge/request/device/ota_update/update
device:
  identifiers:
    - zigbee2mqtt_0x7cb03eaa0a0a6038
  manufacturer: OSRAM
  model: Smart+ plug (AB3257001NJ)
  name: Plug - Upstairs Hall
  sw_version: V1.05.09
device_class: firmware
entity_picture: https://github.com/Koenkk/zigbee2mqtt/raw/master/images/logo.png
latest_version_template: '{{ value_json[''update''][''latest_version''] }}'
latest_version_topic: zigbee2mqtt/Plug - Upstairs Hall
name: Plug - Upstairs Hall
payload_install: '{"id": "0x7cb03eaa0a0a6038"}'
state_topic: zigbee2mqtt/Plug - Upstairs Hall
unique_id: 0x7cb03eaa0a0a6038_update_zigbee2mqtt
value_template: '{{ value_json[''update''][''installed_version''] }}'
platform: mqtt
Subscribed topics:
zigbee2mqtt/bridge/state
1 most recently received message(s)
Received 10:35:34
QoS: 0, Retained
Payload: offline
zigbee2mqtt/Plug - Upstairs Hall/availability
1 most recently received message(s)
Received 10:35:34
QoS: 0, Retained
Payload: state: online
zigbee2mqtt/Plug - Upstairs Hall
8 most recently received message(s)
Received 11:13:15
QoS: 0
Payload: linkquality: 21
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:15
QoS: 0
Payload: linkquality: 14
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:17
QoS: 0
Payload: linkquality: 43
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:17
QoS: 0
Payload: linkquality: 43
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:20
QoS: 0
Payload: linkquality: 21
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:20
QoS: 0
Payload: linkquality: 21
state: 'ON'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:25
QoS: 0
Payload: linkquality: 14
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null
Received 11:13:25
QoS: 0
Payload: linkquality: 43
state: 'OFF'
update:
  installed_version: -1
  latest_version: -1
  state: null
update_available: null

SOLVED

I don’t really know what I did but I suspected that the issue was the MQTT broker, so I looked at the Mosquitto Broker log and saw that the connection to Z2M was being refused. So I edited the MQTT URL to mqtt:/localhost:1883 as per the instructions and restarted Mosquitto Broker. Still nothing. So I set the MQTT URL back to mqtt:/192.168.xxx.xxx:1883 and rebooted. And just like that everything is working again.

I don’t really know what I did, but it is working now.

============================================

2 Likes