MQTT/en: различия между версиями

Новая страница: « To control the device (change the channel value), you need to send a message to the topic "/devices/<device-id>/controls/<control-id>/on" This is done using t…»
(Новая страница: «==== Managing devices from the command line====»)
(Новая страница: « To control the device (change the channel value), you need to send a message to the topic "/devices/<device-id>/controls/<control-id>/on" This is done using t…»)
Строка 100: Строка 100:
==== Managing devices from the command line====
==== Managing devices from the command line====


Для управления устройством (изменения значения канала), необходимо отправить сообщение в топик "/devices/<device-id>/controls/<control-id>/on" (обратите внимание на /on в конце).
 
Это делается с помощью консольной команды '''mosquitto_pub'''. Пример:
To control the device (change the channel value), you need to send a message to the topic 
"/devices/<device-id>/controls/<control-id>/on" This is done using the '''mosquitto_pub''' console command. Example:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
root@wirenboard:~# mosquitto_pub -t "/devices/wb-mrm2_130/controls/Relay 1/on" -m "1"
root@wirenboard:~# mosquitto_pub -t "/devices/wb-mrm2_130/controls/Relay 1/on" -m "1"
</syntaxhighlight>
</syntaxhighlight>
команда отправляет сообщение "1" (логическую единицу, "включить") в топик, соответствующий подключённому по RS-485 релейном модуле WM-MRM2 с адресом 130.
the command sends the message "1" (logical unit, "turn on") to the topic corresponding to the connected via RS-485 relay module WM-MRM2 with the address '''130'''.


==== Слежение за состоянием устройства / подписка на топик ====
==== Слежение за состоянием устройства / подписка на топик ====
12 063

правки