Rule Examples/en: различия между версиями
Matveevrj (обсуждение | вклад) (Новая страница: «The same, but with a virtual device as an event source. Usage example: scripted button that turns on/off the siren and light bulb.») |
Matveevrj (обсуждение | вклад) (Новая страница: «} }); </syntaxhighlight>») |
||
Строка 26: | Строка 26: | ||
The same, but with a virtual device as an event source. Usage example: scripted button that turns on/off the siren and light bulb. | The same, but with a virtual device as an event source. Usage example: scripted button that turns on/off the siren and light bulb. | ||
<syntaxhighlight lang="ecmascript"> | <syntaxhighlight lang="ecmascript"> | ||
defineVirtualDevice("simple_test", { | defineVirtualDevice("simple_test", { | ||
Строка 37: | Строка 36: | ||
} | } | ||
}); | }); | ||
defineRule("simple_switch", { | defineRule("simple_switch", { | ||
whenChanged: "simple_test/enabled", | whenChanged: "simple_test/enabled", | ||
Строка 45: | Строка 42: | ||
dev["wb-gpio"]["Relay_2"] = newValue; | dev["wb-gpio"]["Relay_2"] = newValue; | ||
dev["wb-mrm2_6"]["Relay 1"] = newValue; | dev["wb-mrm2_6"]["Relay 1"] = newValue; | ||
} | |||
} | |||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="ru" dir="ltr" class="mw-content-ltr"> | <div lang="ru" dir="ltr" class="mw-content-ltr"> |