Changes

709 bytes added ,  13:24, 3 February 2022
no edit summary
Line 11: Line 11:  
{|class="wikitable"
 
{|class="wikitable"
 
|-
 
|-
!Name!!type and variety!!description
+
!Название!!Тип и диапазон!!Описание
 
|-
 
|-
|sub-type||enum||sensor – virtual sensor<br><br>text – virtual sensor of text type (UTF8), length is to be equal to 0<br>long-text – virtual field of text type (UTF8), length is to be equal to 0<br>Devices that need script to track the status (see the example below the table):<br>lamp, dimer-lamp, rgb-lamp, jalousie, gate, gate120, jalousie120<br>prf – with formatted set of status, the description isbelow
+
|sub-type||перечисление||sensor – виртуальный датчик<br><br>text – виртуальный датчик текстового типа (UTF8), длина должна быть равна 0<br>long-text – виртуальное поле текстового типа (UTF8), длина должна быть равна 0<br>Устройства, которым нужен скрипт для отслеживания статуса (см. пример под таблицей):<br>лампа, лампа с диммированием, rgb-подсветка, жалюзи, ворота, ворота 120, жалюзи 120 <br>prf – с отформатированным набором статусов, описание ниже
 
|-
 
|-
|length*||number||status size, bytes<br>0 – dynamic size (obvious for the elements of "sub-type=text" type)
+
|length*||число||размер статуса, байт<br>0 – динамический размер (явный для элементов типа «sub-type=text»)
 
|-
 
|-
|dim||symbol||Symbol added to the end of virtual sensor value (for example, % or С)
+
|dim||символ||Символ, добавляемый в конце значения виртуального датчика (например, % или С)
 
|}
 
|}
<nowiki>*</nowiki> – required fields
+
<nowiki>*</nowiki> – обязательные поля
   −
===Example of virtual device "lamp"===
+
===Пример виртуального устройства "лампа"===
    
<syntaxhighlight lang="xml" line>
 
<syntaxhighlight lang="xml" line>
Line 27: Line 27:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
The processing of pressing in the script
+
Обработка нажатия в скрипте
    
<syntaxhighlight lang="cpp" line>
 
<syntaxhighlight lang="cpp" line>
 
u8 state = 0;
 
u8 state = 0;
 
V-ID/142:99 {
 
V-ID/142:99 {
     if (opt(0)==0xff){//pressing the element in the interface
+
     if (opt(0)==0xff){//нажатие элемента в интерфейсе
 
         if (state==0) state = 1;
 
         if (state==0) state = 1;
 
         else state = 0;
 
         else state = 0;
         setStatus(142:99,state);//for correct displaying in the interface
+
         setStatus(142:99,state);//для корректного отображения в интерфейсе
 
     }
 
     }
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
===Example of virtual device "dimmable lamp"===
+
===Пример виртуального устройства "лампа с диммированием"===  
 
<syntaxhighlight lang="xml" line>
 
<syntaxhighlight lang="xml" line>
 
<item addr="142:99" length="2" name="Lamp" sub-type="dimer-lamp" type="virtual"/>
 
<item addr="142:99" length="2" name="Lamp" sub-type="dimer-lamp" type="virtual"/>
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
The script  processing of stroke
+
Скрипт обработки нажатия
 
<syntaxhighlight lang="cpp" line>
 
<syntaxhighlight lang="cpp" line>
 
u8 state[2] = {0,0};
 
u8 state[2] = {0,0};
editor, translation-admin, translator
4,754

edits