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

м
FuzzyBot переименовал страницу Драйвер wb-mqtt-serial:Примеры написания шаблонов/en в Wb-mqtt-serial templates/en без оставления перенаправления: Часть переводимой страницы Драйвер wb-mqtt-serial:Примеры написания шаблонов.
(Новая страница: «WB-MAP3H — three-channel electricity meter. It measures a large number of electrical network parameters. Since it can take quite a l…»)
м (FuzzyBot переименовал страницу Драйвер wb-mqtt-serial:Примеры написания шаблонов/en в Wb-mqtt-serial templates/en без оставления перенаправления: Часть переводимой страницы Драйвер wb-mqtt-serial:Примеры написания шаблонов.)
 
(не показано 13 промежуточных версий 1 участника)
Строка 1: Строка 1:
<languages/>
<languages/>
 
 
=== The general structure of the device template
=== The general structure of the device template===
===


A device template file is a [https://en.wikipedia.org/wiki/JSON JSON] structure that describes device parameters. The template allows comments. The JSON structure is written inside the space between the opening and closing braces:<code> { ... }</code>
A device template file is a [https://en.wikipedia.org/wiki/JSON JSON] structure that describes device parameters. The template allows comments. The JSON structure is written inside the space between the opening and closing braces:<code> { ... }</code>
Строка 101: Строка 100:
==== WB-MS-THLS v.2 ====
==== WB-MS-THLS v.2 ====


The [[WB-MS_Modbus_Sensor/en|WB-MS-THLS]] device is a universal combined Modbus sensor for temperature, humidity, light and sound pressure. The device provides access to data via Modbus input registers. The initial settings of the device are recorded in the holding registers, but are not used to obtain data and control the device, so the template is not included.You can see the full template code via link "Expand".
The [[WB-MS_Modbus_Sensor/en|WB-MS]] device is a universal combined Modbus sensor for temperature, humidity, lighting and sound pressure. The device provides access to data via Modbus input registers. The initial settings of the device are recorded in the holding registers, but are not used to obtain data and control the device, so the template is not included.You can see the full template code via the following link.


<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
Строка 185: Строка 184:
----
----


==== WB-MRGBW-D ==== [[WB-MRGBW-D|WB-MRGBW-D]] is a four channel dimmer to control the led strip. Can control RGB+W tape or four single color tapes independently. Brightness settings are stored in holding registers; the template describes which registers can be changed to get the desired brightness of the channels, track the dimmer button presses and get the value of the number of clicks.The link "Expand" you can see the full template code.
==== WB-MRGBW-D ==== [[WB-MRGBW-D/en|WB-MRGBW-D]] is a four channel dimmer to control the led strip. Can control RGB+W tape or four single color tapes independently. Brightness settings are stored in holding registers; the template describes which registers can be changed to get the desired brightness of the channels, track the dimmer button presses and get the value of the number of clicks.You can see the full template code via the following link.


<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
Строка 316: Строка 315:


==== WBIO-DO-R10A-8 ====
==== WBIO-DO-R10A-8 ====
Устройство [[WBIO-DO-R10A-8_Relay_Module|WBIO-DO-R10A-8]] — is a relay side module that connects directly to the controller's WBIO connector and is not Modbus controlled. But when it is connected via a WB-MIO or WB-MIO-E expansion device, it becomes a full-fledged Modbus device for which there is a corresponding template. You can see the full template code via link "Expand".
Устройство [[WBIO-DO-R10A-8_Relay_Module/en|WBIO-DO-R10A-8]] — is a relay side module that connects directly to the controller's WBIO connector and is not Modbus controlled. But when it is connected via a WB-MIO or WB-MIO-E expansion device, it becomes a full-fledged Modbus device for which there is a corresponding template.You can see the full template code via the following link.


<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
Строка 458: Строка 457:
==== WB-MAP3H ====
==== WB-MAP3H ====


[[WB-MAP3H_Power_Meter/en|WB-MAP3H]] — three-channel electricity meter. It measures a large number of electrical network parameters. Since it can take quite a long time to poll all registers of such a device, there are several templates that contain the optimal set of parameters for the current task. We'll look at the basic pattern. You can see the full template code via link "Expand".
[[WB-MAP3H_Power_Meter/en|WB-MAP3H]] — three-channel electricity meter. It measures a large number of electrical network parameters. Since it can take quite a long time to poll all registers of such a device, there are several templates that contain the optimal set of parameters for the current task. We'll look at the basic pattern. You can see the full template code via the following link.


<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
<div class="mw-collapsible mw-collapsed"  style="width:500px; overflow: hidden;" >
Строка 870: Строка 869:
</div>
</div>


На что следует обратить внимание в этом шаблоне? В первую очередь в параметрах устройства мы указываем, что одновременно следует считывать не более 60 регистров, чтобы не останавливать надолго опрос остальных устройств: '''"max_read_registers": 60'''.  
What is so important in this template? First of all, we specify in the device parameters that no more than 60 registers should be read at the same time, so as not to stop for a long time the polling of other devices:  
Также показательным является параметр, описывающий накопленную реактивную энергию по фазе L1:
'''"max_read_registers" : 60'''. Also  the parameter describing the accumulated reactive energy in the phase L1 is indicative:
<syntaxhighlight lang="JSON">
<syntaxhighlight lang="JSON">
   {
   {
Строка 885: Строка 884:
</syntaxhighlight>  
</syntaxhighlight>  


Здесь стоит обратить внимание на то, что адрес регистра может задаваться и в шестнадцатеричном виде: '''"address": "0x1224"''', вещественный коэффициент масштабирования можно задавать в экспоненциальной записи: '''"scale": 3.125e-05''', при считывании значения округлять его до нужного порядка: '''"round_to": 0.0001''', а также учитывать, что число в Modbus-регистрах хранится в порядке от младшего к старшему: '''"word_order": "little_endian"'''.
Here you should pay attention to the fact that the address of the register can be set in hexadecimal form:''' "address": "0x1224" ''', the real scaling factor can be set in the exponential notation:''' "scale": 3.125 e-05'''', when reading the value round it to the desired order:''' "round_to": 0.0001''', and also take into account that the number in the Modbus-registers is stored in order from the youngest to the oldest: '''"word_order": "little_endian"'''. Storage formats for 16-bit Modbus registers are described as follows:
Форматы хранения для 16-битных Modbus регистров описываются следующим образом:
<pre>
<pre>
         big-endian    : ( [0xAA 0xBB] [0xCC 0xDD] => 0xAABBCCDD )  
         big-endian    : ( [0xAA 0xBB] [0xCC 0xDD] => 0xAABBCCDD )  
         little-endian : ( [0xAA 0xBB] [0xCC 0xDD] => 0xCCDDAABB )
         little-endian : ( [0xAA 0xBB] [0xCC 0xDD] => 0xCCDDAABB )
</pre>
</pre>
По умолчанию предполагается формат big-endian.
The default format is big-endian.


Типы переменных, используемых в шаблонах, перечислены в следующей таблице:
The types of variables used in the templates are listed in the following table:
{| class="wikitable"
{| class="wikitable"
! Обозначение !! Тип
! Designation !! Type
|-
|-
| s16 || Signed 16-bit integer
| s16 || Signed 16-bit integer
Строка 932: Строка 930:
|}
|}


=== Источники информации ===
=== Information resources ===
В этой статье описаны основные правила создания шаблонов устройств для контроллеров Wiren Board. Информация изменяется и дополняется по мере обновления ПО и выходу новых продуктов. Самая полная и актуальная информация может быть найдена в следующих источниках:
This article describes the basic rules for creating device templates for Wiren Board controllers. The information changes and is updated as the SOFTWARE is updated and new products are released. The most complete and up-to-date information can be found in the following sources:
* в описании сервиса [https://github.com/contactless/wb-mqtt-serial/ wb-mqtt-serial] на GitHub;
*in the WB-mqtt-serial service description on GitHub;
* в файлах самих шаблонов.
*in the template files
* в файле [https://github.com/contactless/wb-mqtt-serial/blob/master/wb-mqtt-serial.schema.json wb-mqtt-serial.schema.json] на GitHub.
in the [https://github.com/contactless/wb-mqtt-serial/blob/master/wb-mqtt-serial.schema.json wb-mqtt-serial.schema.json] file on GitHub.
wb_editors
14 355

правок