- Client mqtt для windows
- Дополнительные опции:
- Новый MQTT (для RTOS прошивок ESP8266/ESP32)
- Для ESP8266:
- Для RTOS прошивок:
- Ограничения в MQTT
- Сервисные MQTT команды:
- MQTT серверы (брокеры):
- Таблица метрик:
- MQTT Client Tools — The Seven Best Tools
- Written by The HiveMQ Team
- Category: MQTT MQTT Client
- Published: July 15, 2019
- MQTT.fx
- mqtt-spy
- MQTT Inspector
- MyMQTT
- HiveMQ Websocket Client
- MQTT Lens
- mosquitto_tools
- Others
- Summary
- About The HiveMQ Team
Client mqtt для windows
Клиент протокола MQTT. Двухсторонний обмен данными. Управление модулем. Не требуется «белый» IP адрес для управления. Для ESP8266 рекомендуемый SDK 1.5.1 и выше, если имеются проблемы со связью.
MQTT (Message Queue Telemetry Transport) — упрощённый сетевой протокол, работающий поверх TCP/IP. Используется для обмена сообщениями между устройствами по принципу издатель-подписчик.
Информация на брокере MQTT публикуется в элементах-топиках, которые в простейшем виде имеют вид login/hostname/метрика,
где:
login— логин или emal, который используется для доступа к MQTT брокеру(серверу). Указывается на вкладке настроек Servers. Там же указывается пароль, если он требуется
hostname — имя модуля, настраивается на вкладке настроек Main.
метрика — имя датчика или устройства, а так же номер GPIO.
Пример: mylogin/dacha/dsw3 — в этом топике публикуются показания третьего датчика DS18b20 с модуля с именем dacha, который использует логин mylogin для публикации на брокере.
Важно: В адресе топика в MQTT нет корневого слэша, то есть всегда пишется login/hostname/sensor, а не /login/hostname/sensor
Нельзя называть модуль (hostname) русскими буквами — иначе возможны проблемы в работе MQTT.
Дополнительные опции:
MQTT Lite Mode — короткие топики, без включенной настройки топики будут иметь более длинный вид с текстом login/hostname/sensors/xxx и login/hostname/gpio/xxx
fix 2.05.16 — исправление для стабильности работы MQTT (для ESP8266).
Дополнительный буфер MQTT — необходимо установить объем памяти зарезервированный под MQTT в случае, если не все метрики видно на брокере. Расчет примерно 50 байт на каждую метрику. Опция уменьшает размер свободного ОЗУ модуля. Конструктор прошивки автоматически рассчитывает размер буфера, но иногда его может не хватать (для ESP8266).
Отдельный топик на запись — login/hostname/set/output5 — для записи, login/hostname/output5 — для чтения. Во избежание срабатывания от эхо — рекомендуемая опция.
Свой корневой топик — вместо login/hostname/sensor (описанного в данной документации) будет использоваться путь свой_текст/sensor, который установлен в настройках модуля. Можно делать вложенные топики. Длина до 63 символов.
Новый MQTT (для RTOS прошивок ESP8266/ESP32)
Данная опция использует mqtt из SDK. Опция поддерживает несколько вариантов подключения. Требуется указывать префикс перед адресом:
mqtt:// — стандартное подключение
ws:// — websocket режим.
mqtts:// — стандартное подключение, но с ssl
wss:// -websocket режим, но с ssl
Пример mqtt://mqtt.wifi-iot.com или ws://mqtt.wifi-iot.com для websocket режима
SSL должен поддерживается сервером. Обычно для него используется отдельный порт.
Возможна работа через сертификаты TLS, загружаемые из SPIFFS, но функция не активирована.
Статус подключения MQTT
На сервисной вкладке http://[ip_adr]/debug можно узнать статус подключения к серверу MQTT.
Для ESP8266:
Пример: MQTT IP: 192.81.221.198 State: 15 / Errors: 1
Что значит модуль подключен к серверу IP адресом 192.81.221.198. Статус подключения 15, количество переподключений — 1.
Статус может принимать несколько вариантов:
15 — подключение успешно. Данные должны передаваться.
6 — ошибка, возможно не верный логин/пароль.
7,8 — ошибка подключения, сбой, исправляется обычно перезагрузкой модуля. Редкая проблема, но бывает, например, если сервер отключался.
Для RTOS прошивок:
Отображает счетчик переподключений и текущее состояние подключения.
Ограничения в MQTT
В Free варианте нельзя управлять устройством, интервал отправки фиксирован на 600 секундах.
Ограничение длины поля логина у ESP8266- 20 символов, пароля — 10 символов. В данный момент увеличить длину пароля можно через дополнительную настройку в шестеренке опции, но это испортит настройки модуля из-за смещения структуры параметров если не используется опция NVS2.
При изменении настроек MQTT сервера, логина, пароля или имени устройства рекомендуется перезагрузка устройства.
VDD у ESP8266 не передается.
В safe mode у ESP8266 MQTT не работает.
Сервисные MQTT команды:
login/hostname/[set/]system/restart — перезапуск модуля.
login/hostname/[set/]system/upd — обновление по OTA.
login/hostname/[set/]system/aupd — обновление по Auto OTA.
В данные топики нужно отправить цифру 1.
set/ добавляется (без скобок), если включены отдельные топики на запись.
MQTT серверы (брокеры):
wqtt.ru — платный брокер, поддержка управления через Алису. Группа телеграм https://t.me/wqtt_ru
dealgate.ru — бесплатный брокер, поддержка управления через Алису и WhatsApp. Поддержка сценариев.
При проблемах в работе данных сервисов необходимо обращаться в их поддержку, проект wifi-iot не имеет к ним отношения. Перед обращением убедитесь, что логин, пароль и другие параметры введены верно и на модуле доступен интернет.
Android приложения, совместимые с проектом:
Таблица метрик:
Внимание ! Имена некоторых метрик поменялись с 6.02.21 !! Новые имена можно посмотреть на вкладке Metrics на самом модуле.
MQTT Client Tools — The Seven Best Tools
Written by The HiveMQ Team
Category: MQTT MQTT Client
Published: July 15, 2019
Everybody from MQTT beginner to expert needs a handy tool to try out stuff or for debugging. A while ago we had already taken a look at such tools, but since then a lot of new tools have emerged, which definitely justifies an update on that topic. The goal of this blog post is to give a brief overview of the best MQTT client tools for different platforms and highlight special features.
We from HiveMQ are very active in spreading the word about MQTT at conferences in Germany & Europe and to the whole world over the internet. So we often demonstrate and explain how MQTT works and what its benefits are. Also during the further development of HiveMQ and when implementing IoT solutions for customers, we need tools to publish and subscribe to different topics easily. These are only 2 use cases out of many others where a MQTT client tool comes very handy and is often inevitable. Due to the particular suitability of MQTT for mobile devices, tools for mobile platform are as important as desktop versions.
So there’s definitely a right to exist for tools on different platforms and we will directly jump into our top 7 in no particular order.
The MQTT CLI is an open-source Java MQTT client tool that enables you to interact quickly and easily with any MQTT Broker in various ways. The CLI gives you a single compact tool for the most important client operations (PUBLISH and SUBSCRIBE). The CLI tool also provides an interactive and comfortable SHELL mode that enables you to work with multiple MQTT clients in parallel and supports connection handling. The MQTT CLI supports all MQTT features for MQTT Version 5 & 3.1.1. The tool uses the HiveMQ-MQTT client library, which is a fast, low-overhead, high-throughput, and modern MQTT library written in Java. The MQTT CLI comes in various binary packages that can be downloaded from the documentation homepage on GitHub.
HiveMQ has released the HiveMQ MQTT Client, a Java library that is available under the Apache license on GitHub. This new MQTT client is compatible with MQTT 3.1.1 and MQTT 5. It is designed for high-performance so it is very useful for server-side MQTT clients that integrate enterprise systems. The client features a reactive, blocking and non-blocking API. Download if for free from the HiveMQ Github repo.
MQTT.fx
(available for Win/MacOSX/Linux, MQTT.fx, free)
MQTT.fx — Broker status via $SYS-topics
MQTT.fx has been around since 2014 and built its fan base in our team. It comes with the portability of the Java VM and a quite impressive feature set. MQTT.fx is implemented with JavaFX, which is quite obvious, when opening the tool for the first time. Due to the native packaging available for JavaFX, there are binaries for Windows, MacOSX and Linux, which makes the installation a breeze. But lets have a look at the MQTT part. Besides standard publish/subscribe functionality it provides support for $SYS topics and connection profiles for connecting to different brokers. Especially the $SYS topic support is awesome, it helps to inspect the internals of the broker from time to time. We haven’t seen that kind of displaying in another tool. The connection profiles allow the configuration of connection options like client id, SSL/TLS, username/password and Last Will and Testament. Another functionality which has been introduced in one of the last releases is scripting. This makes the simulation of different sensors, etc. easily possible. Just for the record, there are also a few small things, which sometimes makes the user experience inconvenient. For example the publish/subscribe functionality is separated in two tabs, which results in constant switching the tabs. Update: It is possible to view publisher and subscriber at the same time by detaching one of the tabs. Also here and there small bugs occur. But regardless of these little things, the listed features makes it definitely one of the best choices, when experimenting with MQTT at the moment.
mqtt-spy
mqtt-spy publish/subscribe (source: github.com/eclipse/paho.mqtt-spy)
mqtt-spy has been around since 2014 and as of early 2016 is part of Eclipse Paho and Eclipse IoT. It ships as a JAR file and runs on top of Java 8 and JavaFX. MQTT-Spy has a very nice way of displaying the basic MQTT publish/subscribe mechanism. It makes it easy to publish and subscribe at the same time and there are different tabs for connections to several brokers. The different areas of the pub/sub window (publish, new subscription, subscription & messages) can be closed down to make room for the currently used ones. Its search functionality allows to find and filter the often heavy load of MQTT messages running through such a tool. Another handy feature is that it logs every published and received message in the standard output and also into a file. So it is easy to open the file in any text editor and make deeper analysis of the messages, which is often necessary when dealing with many MQTT messages. It also comes with advanced features like scripting, filtering & searching, decoding & formatting received messages and graphing/charts. It’s a sophisticated tool for the day-to-day usage.
MQTT Inspector
MQTT Inspector on iPad (source: jpmens.net/2013/11/19/mqtt-inspector-for-ios/)
The MQTT inspector is a really great tool for any iOS device. It is especially suited for power users. It is possible to create and store connection options, similar to most of the other tools. But this tool also allows to pre-configure publishes and subscriptions as templates. After connecting to the broker a simple click activates a subscription or triggers a publish. Therefore it is good to know beforehand to which topics MQTT Inspector should publish or subscribe to. Of course it is possible to change this during an open connection. As a power user tool it allows to switch between a simple message feed, a view grouped by topic and a low level view.The low level mode shows low-level MQTT command messages and some basic data plus its representation in hex. Another functionality allows to filter the message by their topic, attributes or payload. This is very handy when a lot of messages arrive and only some of them are of interest. As soon as you have understood the handling of MQTT inspector there’s no way it wouldn’t make it onto your iOS device.
MyMQTT
MyMQTT Android App (Picture from Google Play Store)
The Android App MyMQTT can be installed via the Google Play Store. It is a useful app that has basic publish and subscribe capabilities. A functionality which differentiates this app from others is its ability to store messages on the phone. These are shown in the menu under “Stored Messages”. The app is still under development and essential features like different quality of service levels, Last Will and Testament as well as retained messages are missing. However, the last update is almost one year old. So hopefully the announcement of the new MQTT standard this September will bring a new version of this useful app for Android.
HiveMQ Websocket Client
_HiveMQ Websocket Client_
The HiveMQ Websocket Client is a simple and clean tool made by us while implementing the native websocket support for HiveMQ. After websockets were introduced in HiveMQ, we decided to improve this app a little bit and made it available to everybody as open source. This application is also a perfect starting point to build your own app with the Eclipse Paho JavaScript library. It is a full-fledged MQTT client, which supports all common protocol features except persistent session. The visualization of the different subscription is colorized and the predefined defaults make it possible to publish and receive a message with 3 clicks and no input (Connect, Add new Topic Subscription, Publish). It can also connect to local brokers, when using a local IP address or hostname. The tool particularly comes handy when a MQTT connection over Websockets should be tested or a tool is needed without prior installation. Of course the HiveMQ websocket client works in every modern browser and on most operating systems, including iOS and Android.
MQTT Lens
MQTT Lens — pub/sub view
MQTT Lens is also a quite new project, which was developed during the Google Summer of Code 2014. It can be easily installed through the Google Chrome App Store. The tool has a pretty clean interface and supports all the available connection options from the MQTT spec, except persistent sessions. It accepts connections to more than one broker at the same time and colors them differently for easy association. The interface for subscribing, publishing and seeing all received messages is simple and easy to grasp. Sadly there is no possibility to publish retained messages. But although this app is installed via Chrome, it runs as standalone application and can also connect to brokers via the plain MQTT port 1883, which can’t be done by pure JavaScript Web clients. A nice feature is the display of JSON payloads in a pretty way. In summary, MQTT Lens is particularly well suited for people who need basic pub/sub functionality without having power user needs.
mosquitto_tools
Nowadays with all the fancy client tools, there’s still a place for the mosquitto publish and subscribe tools. They are still the best option on a headless server for verifying the correct installation of a MQTT broker and doing other MQTT tests. The feature set is complete and it is ideal for devops, power users or everybody else who loves to work with the console.
Others
There are also other tools, which we didn’t cover in this post, they can be found on the official MQTT website. The following have also been covered in our earlier post:
- MQTT.app (MacOSX)
- SimpleMessage (MacOSX)
Summary
To sum things up, since the last time we had a look at MQTT client tools, the MQTT tool landscape has changed a lot and there are some really great new tools to get started with MQTT and for everday use.
What’s your favorite tool out there? Did we miss your favorite MQTT tool in this top 7 list? Tell us in the comments!
About The HiveMQ Team
We love writing about MQTT, IoT protocols and architecture in general. Our experts are here to help, so reach out to us if we can help!
Contact us