RS-485:Configuration via Web Interface/en: различия между версиями
(Новая страница: «=== Setting the polling period ===») |
|||
(не показаны 3 промежуточные версии этого же участника) | |||
Строка 2: | Строка 2: | ||
{{DISPLAYTITLE:Начальное конфигурирование устройств через web-интерфейс}} | {{DISPLAYTITLE:Начальное конфигурирование устройств через web-интерфейс}} | ||
For general information on connecting RS-485 devices to the controller, see page [[RS-485 | For general information on connecting RS-485 devices to the controller, see page [[Special:MyLanguage/RS-485|RS-485]]. | ||
Строка 43: | Строка 43: | ||
=== Setting the polling period === | === Setting the polling period === | ||
Драйвер ([[https://github.com/contactless/wb-homa-drivers/tree/master/wb-mqtt-serial wb-mqtt-serial|https://github.com/contactless/wb-homa-drivers/tree/master/wb-mqtt-serial wb-mqtt-serial]]) позволяет определять, с какой скоростью будут опрашиваться те или иные каналы устройства. Данный параметр называется Desired poll interval и задается в миллисекундах. Общий для всех интервал опроса задается параметром Desired poll interval в конфигурации порта. Если этот параметр не будет переопределен в других устройствах или других каналов, то для каждого канала будет использоваться именно это значение. Если скорость опроса задана для какого-то конкретного устройства, то для всех каналов этого устройства будет использоваться именно она, опять-таки, если для какого-то канала не задан свой интервал опроса. Приоритет интервалов выглядит таким образом: канал-> устройство -> порт. Например, если у нас есть несколько входов релейного модуля, критичных ко времени срабатывания, для них мы можем задать минимальный интервал в 1 мс. По умолчанию в web-интерфейсе отсутствует поле для изменения этого свойства -- его надо добавить. Сначала указываем канал, свойство которого мы хотим переопределить, для чего щелкаем по кнопке '''+Item'''. Имя контрола и его адрес можно узнать в файле шаблона устройства [[Special:MyLanguage/Файл:Channel_name_address.png|400px|thumb|left|Фрагмент описания канала устройства из файла шаблона из директории /usr/share/wb-mqtt-serial/templates]] | |||
В поле Control name мы подставляем значение переменной "name", Address -- "address". Соответственно заполняем поля Control type и Register type. [[Special:MyLanguage/Файл:Channel_props_poll.png|400px|thumb|center|Добавляем свойство интервала опроса для канала устройства]] щелкаем на кнопке Properties соответствующего канала и ставим флажок в поле Desired poll interval (ms), как показано на рисунке. | |||
В результате получаем следующий набор полей:[[Special:MyLanguage/Файл:Channel_settings.png|600px|thumb|center|Набор полей, определяющих свойства конкретного канала. Поле Desired poll interval (ms) определяет интервал между двумя опросами параметра]] | |||
Для сохранения нажимаем кнопку Save в верхней части страницы. |
Версия 12:47, 29 мая 2019
Внимание: Отображаемое название «Начальное конфигурирование устройств через web-интерфейс» переопределяет ранее заданное отображаемое название «RS-485:Configuration via Web Interface». For general information on connecting RS-485 devices to the controller, see page RS-485.
Serial device configuration
Go to the Configs page of the web interface, and click /etc/wb-mqtt-serial.conf (serial is the label of serial ports, RS-485 refers to them), or select Serial Device Driver Configuration on the left panel of the interface.
The serial ports configuration page will open. On the left, select the port to which you have connected the device. Ports are named in Linux terminology,- /dev/ttyXXXN; to understand which one is used, see Wiren_Board_5: Apparatures.
Port setting
Set the port settings: speed (bit/s), number of bits in the packet, whether there is a parity bit, the number of stop bits - this information is specified in the documentation for the peripheral equipment. Then be sure to tip Enable port (with this setting, the port can be disabled if any hardware on it starts to fail).
NB. If you connect multiple devices to the same controller port, these settings must match.
Adding devices
Go to List of devices below. Press the + Serial Device button to add a device. Select the type of device (usually corresponds to the model of the device) and specify its address (usually indicated by the documentation for the device, for devices of our production is indicated on the body label in decimal format):
The device address is specified either in hexadecimal (starts with 0x..), or in decimal (as a normal number). Then be sure to click the blue Save button at the top of the page.
Checking the operation
To check the operation of the device, go to the Devices page. It should display the unit corresponding to the connected device. In our example,a block WB-MRM2 130 appeared (template name - DEVICE_TYPE_ADDRESS) with two buttons to control the relay, two input indicators for buttons and push counters. You can press the button - the relay on the connected device will switch.
Adding a widget
For web interface version 1.x
To add a control button to the Home page and name it according to its purpose (for example, The light in the corridor), you need to create a widget. To do this, go to the Widgets page and click the green add widget button. Then you need to enter the widget parameters: the name (as it is called in the interface), the room (the group to which the widget is attached; used to organize when there are many widgets - if not enough, you can choose any), and the type of widget - in our case, the relay controls the lighting, so choose Light Control Relay. After that, there is another option - you need to choose which device corresponds to the widget. All available devices of the selected type are shown in the list, their names are given in accordance with the terminology of MQTT. At the end, click Submit - the new widget will appear on the Widgets page.
Additional device settings
Additional device parameters can be set via the Properties button. Additional device configuration fields can be displayed in the drop-down menu.
The setup section (List of setup commands) is used to initialize certain device registers before operation. As an example, write the value 0 in the holding register of the WB-MR14 relay module to set the button control mode without locking for all inputs of the module. Click on the Properties button and select The list of setup commands checkbox. Click the Properties button again to hide the drop-down list.
Press the Save button and make sure that the module operates in the control mode of push-button switches. The device will have A list of setup commands section. Press the +Setup command button and proceed to creating the setup command. We need to specify the command name, the number of the Modbus register and the triggering value. Setup-initialization is performed once after the driver is loaded.
Setting the polling period
Драйвер ([wb-mqtt-serial|https://github.com/contactless/wb-homa-drivers/tree/master/wb-mqtt-serial wb-mqtt-serial]) позволяет определять, с какой скоростью будут опрашиваться те или иные каналы устройства. Данный параметр называется Desired poll interval и задается в миллисекундах. Общий для всех интервал опроса задается параметром Desired poll interval в конфигурации порта. Если этот параметр не будет переопределен в других устройствах или других каналов, то для каждого канала будет использоваться именно это значение. Если скорость опроса задана для какого-то конкретного устройства, то для всех каналов этого устройства будет использоваться именно она, опять-таки, если для какого-то канала не задан свой интервал опроса. Приоритет интервалов выглядит таким образом: канал-> устройство -> порт. Например, если у нас есть несколько входов релейного модуля, критичных ко времени срабатывания, для них мы можем задать минимальный интервал в 1 мс. По умолчанию в web-интерфейсе отсутствует поле для изменения этого свойства -- его надо добавить. Сначала указываем канал, свойство которого мы хотим переопределить, для чего щелкаем по кнопке +Item. Имя контрола и его адрес можно узнать в файле шаблона устройства 400px|thumb|left|Фрагмент описания канала устройства из файла шаблона из директории /usr/share/wb-mqtt-serial/templates В поле Control name мы подставляем значение переменной "name", Address -- "address". Соответственно заполняем поля Control type и Register type. 400px|thumb|center|Добавляем свойство интервала опроса для канала устройства щелкаем на кнопке Properties соответствующего канала и ставим флажок в поле Desired poll interval (ms), как показано на рисунке. В результате получаем следующий набор полей:600px|thumb|center|Набор полей, определяющих свойства конкретного канала. Поле Desired poll interval (ms) определяет интервал между двумя опросами параметра Для сохранения нажимаем кнопку Save в верхней части страницы.