Rule Examples/en: различия между версиями
Matveevrj (обсуждение | вклад) (Новая страница: «defineRule("_rs485_switch_on", { asSoonAs: function () { return dev.rs485_cmd.enabled; }, then: function() { runShellCommand("/usr/bin/printf '\\xff\\xff\\x0a\\x01\\xff\\x00\\x00\\x0a' > /dev/ttyNSC0"); } });») |
Matveevrj (обсуждение | вклад) (Новая страница: «defineRule("_system_track_vin", { whenChanged: "wb-adc/Vin", then: function() { if (dev["wb-adc"]["Vin"] < dev["wb-adc"]["BAT"] ) { dev["power_status"]["Vin"] = 0; } else { dev["power_status"]["Vin"] = dev["wb-adc"]["Vin"] ; } } });») |
||
Строка 851: | Строка 851: | ||
If you need to manually enter temperature and humidity settings in the interface of the Wiren Board controller. | If you need to manually enter temperature and humidity settings in the interface of the Wiren Board controller. | ||
An easy way is to do in the defineVirtualDevice() field, make it readonly: false. And it will appear in the web interface in Devices as editable, and the value will be saved in the rules engine. | |||
But a complex setup with menus and options cannot be done this way. | |||
The correct but tricky way is to create a new tab in the Configs section with editable settings options fields. | |||
Three files are required: | |||
1. The output scheme of the html page in the Configs | |||
1. | section: /usr/share/wb-mqtt-confed/schemas/test-config.schema.json | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
{ | { | ||
Строка 871: | Строка 865: | ||
"title":"Test configuration", | "title":"Test configuration", | ||
"description":"Long description configuration", | "description":"Long description configuration", | ||
"configFile": { | "configFile": { | ||
"path":"/etc/test-config.conf", | "path":"/etc/test-config.conf", | ||
"service":"wb-rules" | "service":"wb-rules" | ||
}, | }, | ||
<div lang="ru" dir="ltr" class="mw-content-ltr"> | <div lang="ru" dir="ltr" class="mw-content-ltr"> |