Estimated reading time: 3 minutes
Do you have Zigbee devices in use and always want to be up to date when an update is available? With Home Assistant and Zigbee2MQTT, you can set up notifications for firmware updates that inform you immediately when one of your Zigbee devices needs an update. This article shows you step by step how to set this up in Home Assistant.
What is Zigbee2MQTT and why is MQTT important?
Zigbee2MQTT is a popular open source software that allows you to seamlessly integrate Zigbee devices with Home Assistant. Zigbee2MQTT connects to a Zigbee adapter and then communicates with Home Assistant using the MQTT protocol. MQTT is a lightweight messaging protocol specifically designed for small data transfers between IoT devices. It ensures that Home Assistant receives messages from Zigbee2MQTT - e.g. a message when a firmware update is available for one of your devices.
Step 1: Set up the MQTT broker
If you have not yet installed an MQTT broker, this is the first step. An MQTT broker receives messages from Zigbee2MQTT and forwards them to Home Assistant.
- Open the Home Assistant interface and go to Settings > Add-ons.
- Search for the Mosquitto Broker (the standard MQTT broker for Home Assistant) and install it.
- After installation, start the broker and configure the user name and password if necessary.
- Now go to Settings > Integrations and add the MQTT integration if it is not already present.
The other option is to install MQTT independently, for example as a Docker container.
Step 2: Set up Zigbee2MQTT
To receive firmware update notifications from your Zigbee devices, you must ensure that Zigbee2MQTT is configured correctly.
- Open the Zigbee2MQTT configuration file (
configuration.yaml
), which you can find in your installation directory. - Make sure that the
homeassistant: true
and themqtt:
entry are configured correctly so that Zigbee2MQTT sends messages to your MQTT broker. - Add if necessary.
advanced: log_level: info
so that you receive comprehensive information in the log - this helps with troubleshooting. - Restart Zigbee2MQTT.
Now your Home Assistant receives information about the status of your Zigbee devices and is informed when an update is available.
You can also change the settings in the Web UI of Zigbee2MQTT under OTA updates
set the frequency of the update checks. By default, the Update check interval
1440 minutes, which corresponds to exactly one day.
Step 3: Create automation for update notifications
alias: Zigbee2MQTT device update notification
triggers:
- value_template: >
{{ states.update | selectattr('state', 'eq', 'on') |
selectattr('attributes.device_class', 'eq', 'firmware') | list | length >
0 }}
trigger: template
actions:
- data:
title: Firmware updates for devices
message: >
{% set devices = states.update | selectattr('state', 'eq', 'on') |
selectattr('attributes.device_class', 'eq', 'firmware') %} {% for entity
in devices %}
- {{ entity.name }}
{% endfor %}
data:
notification_icon: mdi:update
color: red
action: notify.smartphones
mode: single
This Home Assistant automation notifies you when firmware updates are available for Zigbee2MQTT devices:
- TriggerChecks whether at least one device requires a firmware update (status
on
anddevice_class
isfirmware
).states.update
: Accesses all entities of the typeupdate
which represent firmware updates.selectattr('state', 'eq', 'on')
: Filters all entities for which the stateon
which means that an update is available.selectattr('attributes.device_class', 'eq', 'firmware')
: Restricts the selection further to firmware updates (entities withdevice_class
equalfirmware
).list | length > 0
Converts the filtered results into a list and checks whether it contains at least one element.
- ActionSends a message with a list of affected devices to the group
notify.smartphones
. The notification has an update icon and a red marker. - Mode:
single
ensures that the automation is not executed multiple times at the same time.
In short: It informs you about available firmware updates.
YouTube video implementation
Conclusion
With Zigbee2MQTT and MQTT, you can easily get Home Assistant to inform you about new firmware updates for your Zigbee devices. This allows you to stay up to date and keep your devices secure and functional.
0 Comments