Перейти к содержанию

Навигация

Wb-mqtt-serial driver/en: различия между версиями

м
FuzzyBot переименовал страницу Драйвер wb-mqtt-serial/en в Wb-mqtt-serial driver/en без оставления перенаправления: Часть переводимой страницы Драйвер wb-mqtt-serial.
(Новая страница: «The driver configuration is specified in the <code>/etc/wb-mqtt-serial.conf</code> file. If such a file is created, the driver starts automatically when the contr…»)
м (FuzzyBot переименовал страницу Драйвер wb-mqtt-serial/en в Wb-mqtt-serial driver/en без оставления перенаправления: Часть переводимой страницы Драйвер wb-mqtt-serial.)
 
(не показано 8 промежуточных версий 2 участников)
Строка 33: Строка 33:




== Конфигурационный файл драйвера ==
== The configuration file of the driver ==


Для работы драйвера нужно отредактировать файл <code>/etc/wb-mqtt-serial.conf</code>. Обычный пользователь может воспользоваться способом [[RS-485:Настройка через веб-интерфейс|RS-485:Настройка через веб-интерфейс]], который тоже приводит к правильному заполнению файла конфигурации. Однако отредактировать файл можно и вручную, для этого:
To run the driver, edit the  <code>/etc/wb-mqtt-serial.conf</code> file. An ordinary user can use the RS-485 method:[[RS-485:Настройка через веб-интерфейс|RS-485:configuration via the web interface]], which also leads to the correct filling of the configuration file. However, you can edit the file manually. To do this:
#Ознакомьтесь с инструкцией [[Special:MyLanguage/Просмотр файлов контроллера с компьютера|Просмотр файлов контроллера с компьютера]]
#Read the instructions[[Special:MyLanguage/Просмотр файлов контроллера с компьютера/en|How to view controller files from your computer]]
#Файл <code>/etc/wb-mqtt-serial.conf</code> имеет структуру ''порты (ports) -> устройства (devices)'': в файле есть описания физических портов контроллера, а внутри них - список устройств, которые подключены к этому порту.
#File <code>/etc/wb-mqtt-serial.conf</code> has the structure ''ports -> devices'': there are descriptions of the physical ports of the controller in the file, and inside them there is a list of devices that are connected to this port.
#:Для каждого порта указываются настройки (скорость, чётность и т.п.), а также протокол (Modbus, RTU, etc.)
#:Settings (speed, parity, etc.) and protocol (Modbus, RTU, etc.) are specified for each port.
#:Для каждого устройства обязательно указывается его уникальный адрес на шине - ''slave_id''. Также можно указать другие необязательные параметры - смотрите полное описание формата [https://github.com/contactless/wb-homa-drivers/tree/master/wb-mqtt-serial в описании драйвера на нашем Github].
#:Each device must have its unique address on the bus - slave_id. You can also specify other optional parameters - see the [https://github.com/contactless/wb-homa-drivers/tree/master/wb-mqtt-serial full description of the format in the driver description on our Github].
#Впишите конфигурацию для портов и подключённых устройств в файл, используя примеры ниже.
#Enter the configuration for the ports and connected devices in the file using the examples below.
#Перезагрузите устройство ИЛИ выполните из консоли команду
#Restart the device OR run the command from the console
#: <syntaxhighlight lang="bash">
#: <syntaxhighlight lang="bash">
service wb-mqtt-serial restart
service wb-mqtt-serial restart
</syntaxhighlight>
</syntaxhighlight>
#:Она перезапустит драйвер, и подключённое устройство появится в веб-интерфейсе.
#:It will restart the driver and the connected device will appear in the web interface.
#Если устройство не появилось, выполните команду <syntaxhighlight lang="bash">tail /var/log/messages</syntaxhighlight> или откройте файл <code>/var/log/messages</code> и промотайте его до конца. Если там будет строчка такого типа:
#If the device does not appear, run the following command<syntaxhighlight lang="bash">tail /var/log/messages</syntaxhighlight> or open file <code>/var/log/messages</code> and scroll to the end. If there is a line like this one:
#:<code>May  6 17:50:58 wirenboard user.notice modbus: FATAL: Error parsing config file: Failed to parse JSON: * Line <b>15</b>, Column 17</code>
#:<code>May  6 17:50:58 wirenboard user.notice modbus: FATAL: Error parsing config file: Failed to parse JSON: * Line <b>15</b>, Column 17</code>
#:- ищите ошибку в 15-й строке конфигурационного файла.
#:- look for the error in the 15th line of the configuration file.




===Пример конфигурации для [[Special:MyLanguage/WB-MRM2 Реле 2х канальное | модуля реле WB-MRM2]], подключённого к изолированному порту (RS-485-ISO) Wiren Board 4===
=== The example of configuration for relay module [[WB-MRM2 Реле 2х канальное | WB-MRM2]] connected to the isolated Wiren Board 4 port (RS-485-ISO)===


<syntaxhighlight lang="javascript">{
<syntaxhighlight lang="javascript">{
     "ports": [
     "ports": [
         {
         {
             "path" : "/dev/ttyNSC0",  //псевдофайл, соответствующий порту
             "path" : "/dev/ttyNSC0",  //pseudofile corresponding to port
             "baud_rate": 9600, //скорость порта, 9600 почти для всех устройств, но проверьте документацию к ним
             "baud_rate": 9600, //the port speed is 9600 for almost all devices, but check the documentation first
             "parity": "N", //четность
             "parity": "N", //parity
             "data_bits": 8, //битов данных в посылке
             "data_bits": 8, //the number of data bits in the parcel
             "stop_bits": 2, //количество стоп-битов. Чётность, количество битов и стоп-битов тоже редко меняются
             "stop_bits": 2, //number of stop bits. Parity, bits, and stop bits are also rarely changed
             "poll_interval": 10, //интервал опроса устройств на порту в миллисекундах
             "poll_interval": 10, //device polling interval on the port in milliseconds
             "devices" : [
             "devices" : [
                 {
                 {
                     "device_type" : "WB-MRM2", //тип устройства, распознаваемый драйвером
                     "device_type" : "WB-MRM2", ////device type recognized by driver
                     "slave_id": 25 //адрес устройства
                     "slave_id": 25 //device address
                 }
                 }
             ]
             ]
Строка 71: Строка 71:
     ]
     ]
}</syntaxhighlight>
}</syntaxhighlight>
Узнать файл, соответствующий порту для вашего контроллера - [[Special:MyLanguage/RS-485#Реализация портов в разных версиях Wiren Board |RS-485#Реализация портов в разных версиях Wiren Board ]].


Полный список поддерживаемых типов устройств см. в статье [[Special:MyLanguage/Поддерживаемые устройства|Поддерживаемые устройства]], а также [https://github.com/contactless/wb-homa-drivers/blob/master/wb-homa-modbus/README.md#%D0%A2%D0%B0%D0%B1%D0%BB%D0%B8%D1%86%D0%B0-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%D0%BE%D0%B2-device_type здесь].
For a complete list of supported device types, see[[Поддерживаемые устройства/en|Supported devices]], and also [https://github.com/contactless/wb-homa-drivers/blob/master/wb-homa-modbus/README.md#%D0%A2%D0%B0%D0%B1%D0%BB%D0%B8%D1%86%D0%B0-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%D0%BE%D0%B2-device_type here].




=== Пример конфигурационного файла для нескольких подключённых устройств ===
=== An example of a configuration file for multiple connected devices ===


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
wb_editors
14 355

правок