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

(Новая страница: «The lighting is connected via a built-in relay corresponding to the <code>wb-gpio/Relay_1</code> channel.»)
(Новая страница: «The rule works like this: * when movement appears, the light turns on. If a thirty-second "off" timer was previously started, this timer is disabled; * when motion is lost, a thirty second "off" timer is started. If he manages to reach the end, the light turns off.»)
Строка 53: Строка 53:
The lighting is connected via a built-in relay corresponding to the <code>wb-gpio/Relay_1</code> channel.
The lighting is connected via a built-in relay corresponding to the <code>wb-gpio/Relay_1</code> channel.


<div lang="ru" dir="ltr" class="mw-content-ltr">
The rule works like this:
Правило работает так:
* when movement appears, the light turns on. If a thirty-second "off" timer was previously started, this timer is disabled;
* когда движение появляется, свет включается. Если ранее был запущен тридцатисекундный таймер "на выключение", этот таймер отключается;
* when motion is lost, a thirty second "off" timer is started. If he manages to reach the end, the light turns off.
* когда движение пропадает, запускается тридцатисекундный таймер "на выключение". Если ему удаётся дойти до конца, свет выключается.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
<syntaxhighlight lang="ecmascript">
<syntaxhighlight lang="ecmascript">
var motion_timer_1_timeout_ms = 30 * 1000;
var motion_timer_1_timeout_ms = 30 * 1000;
var motion_timer_1_id = null;
var motion_timer_1_id = null;
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
defineRule("motion_detector_1", {
defineRule("motion_detector_1", {
     whenChanged: "wb-gpio/D2_IN",
     whenChanged: "wb-gpio/D2_IN",
Строка 82: Строка 77:
});
});
</syntaxhighlight>
</syntaxhighlight>
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
<div lang="ru" dir="ltr" class="mw-content-ltr">