How to update zigbee2mqtt

How to update zigbee2mqtt

How to update zigbee2mqtt

Давно известно, что с zigbee устройствами можно работать не только через шлюз MiHome. Имеется множество других решений, через которые можно получать данные и управлять устройствами (deconz, athom hommey, samsung smartthings, philips hue, Smart home Hommyn Zigbee Хаб (HU-20-Z) и др.). По моему мнению, самым интересным и бюджетным вариантом является проект zigbee2mqtt

Для работы zigbee2mqtt понадобится прошитый usb-стик и компьютер (windows, linux, в том числе микрокомпьютеры на arm-процессорах)

Желательно все позиции заказывать у одного продавца, тогда мы молучим один трек на все товары. Я имел неосторожность заказать у разных продавцов, в итоге кабель ожидал около 3 месяцев.

Прошивка USB-стика cc2531 через arduino.

Также usb-стик можно прошить у коллег в вашем городе, например в Екатеринбурге я могу прошить стик за символическую плату в размере 500 руб.

Инструкция по перепрошивке USB-стика cc2531 через отладчик:

Понадобится драйвер для отладчика
Прошивку следует осуществлять по этой инструкции.
Альтернативная инструкция
Ссылка на прошивальщик
Последние версии прошивок можно взять тут

Инструкция по установке zigbee2mqtt для linux:

Если вам нужна поддержка разрабатываемого в данный момент железа, можно установить девелоперскую ветку. Тогда вместо

Установка zigbee2mqtt для windows

1) Устанавливаем брокер mqtt, если у вас его еще нет по инструкции

Также в качестве mqtt брокера, при наличии платной подписки на connect-pac (200р.), вы можете использовать адрес http://connect.smartliving.ru в качестве брокера mqtt. Логик и пароль необходимо использовать реквизиты входа сайта http://connect.smartliving.ru

2) Качаем и устанавливаем git

3) Качаем и устанавливаем node.js для windows

Далее процесс идентичен установке под linux.

Настраиваем конфигурационного файла

Конфигурационный файл обычно расположен по указанному пути /opt/zigbee2mqtt/data/configuration.yaml

Пример вариантов настроек конфигурационного файла

homeassistant: false
permit_join: true
advanced:
channel: 26
log_level: debug
mqtt:
base_topic: zigbee2mqtt
# server: ‘mqtt://192.168.178.32:1900’
server: ‘mqtt://192.168.1.39’

serial:
port: /dev/ttyACM1

26 канал выбран для livolo выключателя (работают только на 26 канале https://github.com/Koenkk/zigbee2mqtt/issues/592). При отсутствии ливоло выключателей, можно удалить эту строку.

Если вы настраиваете систему под windows, порт необходимо указать в следующем формате:

Запускаем командой sudo systemctl start zigbee2mqtt

Обновление локального zigbee2mqtt до актуальной версии:

# Stop zigbee2mqtt and go to directory
sudo systemctl stop zigbee2mqtt
cd /opt/zigbee2mqtt

# Start zigbee2mqtt
sudo systemctl start zigbee2mqtt

Чтобы сервис стартовал автоматически, не забудьте после п. 5 (Optional) Running as a daemon with systemctl выполнить

sudo systemctl enable zigbee2mqtt

(сервис будет запускаться автоматически при старте системы)

Текущий статус модуля: бетта

Реализовано:

1) подписка на канал zigbee2mqtt/#
2) автоматическое создание устройств;
3) автоматическое заполнение метрик устройств;
4) привязка метрик к объектам.
5) просмотр логов zigbee2mqtt;
6) конвертирование привязанных переменных в стандартный для мажордомо формат (вместо 1/0 в zigbee2mqtt используется ON/OFF);
7) управление устройствами;
8) создание карты устройств.
9) Добавлено управление и просмотр режимами сопряжения.
10) Добавлено управление (ON OFF) устройствами с главного окна модуля.
11)Подсвечиваются серым потерянные устройства.

Что планируется:

1) Работа с группами https://www.zigbee2mqtt.io/information/groups.html
2) Заведение отсутствующих метрик, чтобы можно было привязать не описанные события)
3) Отладить работу. Поступают противоречивые данные, у кого-то не отображаются выпадающие списки с картинками и тд.
4) Отладить работу, когда мажордомо и zigbee2mqtt находятся на разных устройствах. Запросил информацию для отвязки от конфигов
5) Настройка прямого управления устройствами

6) Разработка шлюза на базе платы сс2530 и микрокомпьютера raspberry pi nano в едином корпусе.

Ссылки:

Ссылка на интересный тематический канал в телеграм: https://t.me/zigbeer
Ссылка на репозиторий модуля zigbee2mqtt:
Топики для управления устройствами через mqtt
Топики для управления шлюзом через mqtt

Драйвера для smartRF04EB начинаются на swrc* есть в репозитории Кирова Ильи
Огромная благодарность Илье @goofyk за помощь в освоении материала )

# OTA updates

An ongoing discussion about this feature can be found in #2921

This feature allows to update your Zigbee devices over-the-air.

Not all manufacturers make their updates available, below is a (not-complete) list of manufacturer/devices that support it:

To check wether your specific device supports OTA updates via Zigbee2MQTT, go to the supported devices page, click on your device and look for the OTA updates section.

# Automatic checking for available updates

Your zigbee devices can request a firmware update check. Zigbee2MQTT obliges this, and will automatically check if updates are available for your devices.

To protect privacy it is possible to limit how often third party servers may be contacted. You can set the minimum time that should pass between two firmware update checks, in minutes. The default is 1440 minutes (1 day). Here it is set to check at most every two days:

It is also possible to completely ignore these device-initiated requests for updates checks by modifying the configuration.yaml file. In the example below, only manual firmware update checks will be possible:

NOTE: there is also a property update_available which is deprecated.

# Manually check if an update is available

# Update to latest firmware

An update typically takes +- 10 minutes. While a device is updating a lot of traffic is generated on the network, therefore it is not recommend to execute multiple updates at the same time.

# Using the IKEA TRADFRI test server

WARNING: Use at your own risk!

# Local OTA index and firmware files

OTA Index file is a list of firmware images available on a particular server. When checking if an update is available, Zigbee2MQTT determines current hardware and firmware version for a particular device, and then searches for a suitable upgrade image in the index file. Some vendors (such as IKEA Tradfri, Ledvance, Salus, Ubisys) use their proprietary index files, but the most of the devices use Zigbee-OTA

Sometimes it is necessary to add a firmware image that is not on the main index. This could be helpful when developing a DIY device, or install a test/alternate image for a mass-produced device. In this case user can supply Zigbee2MQTT with an alternate index file, located locally or on a web server. This index file will point Zigbee2MQTT to the firmware image files. Records in the override OTA index file will override corresponding records in the main index, so that it is possible to alter the image for a particular device type.

Local index file is searched in the configuration directory (next to configuration.yaml ). The file name could be also a full path to the file, taking into account that host file system may not be available when running Zigbee2MQTT inside a docker container. Alternatively, Zigbee2MQTT supports index files located on a remote HTTP(s) server. In this case zigbee_ota_override_index_location key should be an URL of the index file.

The override OTA index file shall have the same structure as the main index file

open in new window script (follow instructions here

open in new window ). Correct image location and image URL as necessary.

Firmware files can be located either on a web server, or on the local file system. In this case url field in the index file entry shall be either a full path to the image file, or relative to the Zigbee2MQTT configuration directory. In case of local image file, index entry can be simplified to only ‘url’ field. Other fields are still allowed, but if omitted corresponding information (firmware version, image type, manufacturer ID, etc) is read from the image file.

Normally Zigbee2MQTT compares current device firmware with available images version, and allows flashing only firmwares with fileVersion that is higher than current. To force Zigbee2MQTT to use arbitrary version a force field can be used:

Please note, even though Zigbee specification basically allows firmware version downgrade, some of the devices may reject older firmwares. This cannot be forced from Zigbee2MQTT side.

# Linux

These instructions explain how to run Zigbee2MQTT on Linux.

For the sake of simplicity this guide assumes running on a Raspberry Pi 4 with Raspbian Stretch Lite, but it should work on any Linux machine.

Therefore the user pi is used the following examples, but the user may differ between distributions e.g. openhabian should be used on Openhabian.

Before starting make sure you have an MQTT broker installed on your system. There are many tutorials available on how to do this, example

# Determine location of the adapter and checking user permissions

However, it is recommended to use «by ID» mapping of the device (see Adapter settings). This kind of device path mapping is more stable, but can also be handy if you have multiple serial devices connected to your Raspberry Pi. In the example below the device location is: /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00

# Installing

If everything went correctly the output of npm ci is similar to (the number of packages and seconds is probably different on your device):

Note that the npm ci produces some warning which can be ignored.

# Configuring

Before we can start Zigbee2MQTT we need to edit the configuration.yaml file. This file contains the configuration which will be used by Zigbee2MQTT.

Open the configuration file:

To enable the frontend add the following (see the Frontend page for more settings):

Save the file and exit.

# Starting Zigbee2MQTT

Now that we have setup everything correctly we can start Zigbee2MQTT.

When started successfully, you will see something like:

# (Optional) Running as a daemon with systemctl

To run Zigbee2MQTT as daemon (in background) and start it automatically on boot we will run Zigbee2MQTT with systemctl.

Add the following to this file:

If you are using a Raspberry Pi 1 or Zero AND if you followed this guide

open in new window in Zigbee2MQTT configuration to keep only the journalctl logging.

Save the file and exit.

Verify that the configuration works:

Output should look like:

Now that everything works, we want systemctl to start Zigbee2MQTT automatically on boot, this can be done by executing:

Some tips that can be handy later:

# (For later) Update Zigbee2MQTT to the latest version

To update Zigbee2MQTT to the latest version, execute:

How to update zigbee2mqtt

This problem can be divided in 2 categories; no logging is shown at all OR interview fails.

# No logging is shown at all

# Interview fails

# How do I migrate from one adapter to another?

Want to migrate from e.g. a CC2531 to a more powerful adapter (e.g. ZZH)? Then follow these instructions:

# How do I move my Zigbee2MQTT instance to a different environment?

# What does and does not require repairing of all devices?

# Requires repairing

You need to re-pair all you devices when:

# Doesn’t require repairing

You don’t need to re-pair your devices when:

# Why are some links missing from my networkmap?

No worry, in case it happens with end devices (battery powered) it most of the times does not mean the devices aren’t connected to the network map anymore. Some end devices (e.g. Xiaomi door sensor) sleep for a too long time which causes the parent (router child ageing) to remove it from it from its child table. This is what causes the missing link. Even while its not in the child table anymore, the end device can still communicate via the router. This does not always happen since not all routers use child ageing (this is a Zigbee 3.0 feature).

# Why is the action property always empty?

When the Home Assistant integration is enabled ( homeassistant: true in your configuration.yaml ) the action property of your e.g. buttons will almost always be empty. Whenever an action is published e.g. <"action": "single">it will be immediately followed up by a <"action": "">. This is to trigger a state change in the Home Assistant action sensor (so that it can be used in e.g. automations).

# I read that Zigbee2MQTT has a limit of 20 devices (when using a CC2530/CC2531 adapter), is this true?

Definitely not! Example given: the default Zigbee2MQTT CC2531 firmware indeed supports 20 devices connected directly to the coordinator. However, by having routers in your network the network size can be extended. Probably all AC powered devices e.g. bulbs serve as a router, you can even use another CC2530/CC2531 as a router (which has a limit of 21 devices).

# Example

When using the default Zigbee2MQTT CC2531 coordinator firmware + 2 CC2531 routers your device limit will be:

# Common error codes

A list of common error codes and what to do in case of them:

open in new window to have same root cause as the above MAC_CHANNEL_ACCESS_FAILURE

# How do I run multiple instances of Zigbee2MQTT?

# Zigbee2MQTT crashes after some time

zigbee2mqtt/hassio-zigbee2mqtt

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Official Zigbee2MQTT Home Assistant addon

For more information see the documentation.

The format is based on Keep a Changelog.

All notable changes to this project will be documented in the CHANGELOG.md file.

Any changes on the addon that do not require a new version of Zigbee2MQTT will use the format: X.Y.Z-A where X.Y.Z is fixed on the Zigbee2MQTT release version and A is related to the addon.

Edge version will not maintain a CHANGELOG and doesn’t have a version.

If you find any issues with the add-on, please check the issue tracker for similar issues before creating one. If your issue is regarding specific devices or, more generally, an issue that arises after Zigbee2MQTT has successfully started, it should likely be reported in the Zigbee2MQTT issue tracker.

Feel free to create a PR for fixes and enhancements.

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *