Вклад
21 сентября 2022
Translations:Rule Examples/108/en
Новая страница: «Sending data is done with the following shell command:»
Translations:Rule Examples/107/en
Новая страница: «2. Sending a command»
Translations:Rule Examples/106/en
Новая страница: «<pre> stty -F /dev/ttyNSC0 ospeed 9600 ispeed 9600 raw clocal -crtscts -parenb -echo cs8 </pre>»
Translations:Rule Examples/105/en
Новая страница: «To configure the / dev/ttyNSC0 port to 9600 speed, run the following command»
Rule Examples/en
Новая страница: «1. Port setting»
−73
Translations:Rule Examples/104/en
Новая страница: «1. Port setting»
Rule Examples/en
Новая страница: «</syntaxhighlight> == Sending commands via RS-485 ==»
−396
Translations:Rule Examples/103/en
Новая страница: «When you turn off the switch a command will be sent: (set channel brightness 00=0x00) for Uniel UCH-M141: <pre> FF FF 0A 01 00 00 00 0B </pre>»
Translations:Rule Examples/102/en
Новая страница: «When you turn on the switch a command will be sent: (Set Brightness ch. 00=0xff) for Uniel UCH-M141: <pre> FF FF 0A 01 FF 00 00 0A </pre>»
Translations:Rule Examples/101/en
Новая страница: «Create a virtual device with switch type control via rules engine.»
Rule Examples/en
Новая страница: «Termostat("R01-TS16-1", "A60-M1W3/External Sensor 1", "Termostat/R01-TS16-1-setpoint", "wb-gpio/EXT4_R3A1", "Termostat/R01-TS16-1-onoff"); // Hallway underfloor heating»
−565
Translations:Rule Examples/100/en
Новая страница: «For example, send a command to the device on the port /dev/ttys0 (corresponds to the hardware port RS-485-ISO on the Wiren Board 4). To do this, we will use the rules engine and the ability to execute arbitrary shell commands. See [https://github.com/contactless/wb-rules#%D0%94%D1%80%D1%83%D0%B3%D0%B8%D0%B5-%D0%BF%D1%80%D0%B5%D0%B4%D0%BE%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D1%91%D0%BD%D0%BD%D1%8B%D0%B5-%D1%84%D1%83%D0%BD%...»
Translations:Rule Examples/99/en
Новая страница: «</syntaxhighlight> == Sending commands via RS-485 ==»
Translations:Rule Examples/226/en
Новая страница: «Termostat("R01-TS16-1", "A60-M1W3/External Sensor 1", "Termostat/R01-TS16-1-setpoint", "wb-gpio/EXT4_R3A1", "Termostat/R01-TS16-1-onoff"); // Hallway underfloor heating»
Translations:Rule Examples/225/en
Новая страница: «var hysteresis = 0.5; function Termostat(name, temp, setpoint, TS, TS_onoff) { defineRule(name, { whenChanged: temp, //when the sensor state changes then: function (newValue, devName, cellName) { // do the following if (dev[TS_onoff]) { if ( newValue < dev[setpoint] - hysteresis) { //if the sensor temperature is less than the setpoint - hysteresis dev[TS] = true; } if ( newValue > dev[setpoint] + hysteresis) { //if the sensor temper...»
Rule Examples/en
Новая страница: «== Thermostat == An example of a simple thermostat from the [https://support.wirenboard.com/t/novaya-versiya-dvizhka-pravil/4196/158 topic on the support portal].»
−145
Translations:Rule Examples/224/en
Новая страница: «<syntaxhighlight lang="js"> defineVirtualDevice("Termostat", { title: "Termostat", cells: { // =============== hallway underfloor heating "R01-TS16-1-mode": {//mode 0-manual 1-scheduled type: "switch", value: false, }, "R01-TS16-1-setpoint": {//setting type: "range", value: 25, max: 30, readonly: false }, "R01-TS16-1-lock": {//blockage in visualization 0-unlocked 1-blocked typ...»
Rule Examples/en
Новая страница: «1. If the input voltage is less than the battery voltage, then the board is powered by the battery. In this case, 0V is also displayed as the input voltage.»
−97
Translations:Rule Examples/223/en
Новая страница: «== Thermostat == An example of a simple thermostat from the [https://support.wirenboard.com/t/novaya-versiya-dvizhka-pravil/4196/158 topic on the support portal].»
Rule Examples/en
Новая страница: «} });»
−168
Translations:Rule Examples/98/en
Новая страница: «</syntaxhighlight>»
Translations:Rule Examples/97/en
Новая страница: «defineRule("_system_dc_off", { asSoonAs: function () { return dev["wb-adc"]["Vin"] <= dev["wb-adc"]["BAT"]; }, then: function () { dev["power_status"]["working on battery"] = true; } });»
Translations:Rule Examples/96/en
Новая страница: «defineRule("_system_dc_on", { asSoonAs: function () { return dev["wb-adc"]["Vin"] > dev["wb-adc"]["BAT"]; }, then: function () { dev["power_status"]["working on battery"] = false; } });»
Rule Examples/en
Новая страница: «// A rule that will increase the brightness on a timer defineRule({ when: function () { return timers["input1_long_press"].firing; }, then: function () { var i = dev["wb-mdm3_58/Channel 1"];»
−56
Translations:Rule Examples/95/en
Новая страница: «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"] ; } } });»
Rule Examples/en
Новая страница: «defineRule("_system_buzzer_params", { whenChanged: [ "buzzer/frequency", "buzzer/volume", ],»
−168
Translations:Rule Examples/94/en
Новая страница: «} });»
Translations:Rule Examples/93/en
Новая страница: «cells: { 'working on battery' : { type : "switch", value : false, readonly : true }, 'Vin' : { type : "voltage", value : 0 }»
Translations:Rule Examples/92/en
Новая страница: «defineVirtualDevice("power_status", { title: "Power status", //»
Rule Examples/en
Новая страница: «<syntaxhighlight lang="ecmascript">»
−232
Translations:Rule Examples/91/en
Новая страница: «<syntaxhighlight lang="ecmascript">»
Translations:Rule Examples/90/en
Новая страница: «To illustrate, the rules use two different ways of triggering: by changing the value of the control (rule _system_track_vin) and by changing the value of the expression (the other two).»
Rule Examples/en
Новая страница: «2. If the input voltage is greater than the battery voltage, then the board is powered by an external power source. The measurement from the Vin channel is displayed as the input voltage.»
−195
Translations:Rule Examples/89/en
Новая страница: «2. If the input voltage is greater than the battery voltage, then the board is powered by an external power source. The measurement from the Vin channel is displayed as the input voltage.»
Rule Examples/en
Новая страница: «=== CO2 === When the CO2 concentration is less than 650, we flash green once every 10 seconds.»
−559
Translations:Rule Examples/88/en
Новая страница: «1. If the input voltage is less than the battery voltage, then the board is powered by the battery. In this case, 0V is also displayed as the input voltage.»
Translations:Rule Examples/87/en
Новая страница: «The following logic is implemented:»
Translations:Rule Examples/86/en
Новая страница: «[https://github.com/contactless/wb-rules-system/blob/master/rules/power_status.js Rule] creates a virtual device that reports the current power status. Two ADC channels are used as input data: battery voltage measurement and input voltage measurement.»
Rule Examples/en
Новая страница: «runShellCommand("echo " + period + " > /sys/class/pwm/pwmchip0/pwm2/period"); runShellCommand("echo " + duty_cycle + " > /sys/class/pwm/pwmchip0/pwm2/duty_cycle"); };»
−90
Translations:Rule Examples/85/en
Новая страница: «=== Power status rule ===»
Rule Examples/en
Новая страница: «defineRule({ whenChanged: "wb-mcm8_20/Input 1 Long Press Counter", then: function (newValue, devName, cellName) { // Start a timer that will increase the value of the control startTicker("input1_long_press", 75); } });»
−280
Translations:Rule Examples/84/en
Новая страница: «</syntaxhighlight>»
Translations:Rule Examples/83/en
Новая страница: «defineRule("_system_buzzer_onof", { whenChanged: "buzzer/enabled", then: function (newValue, devName, cellName) { if ( dev.buzzer.enabled) { _buzzer_set_params(); runShellCommand("echo 1 > /sys/class/pwm/pwmchip0/pwm2/enable"); } else { runShellCommand("echo 0 > /sys/class/pwm/pwmchip0/pwm2/enable"); } } });»
Translations:Rule Examples/82/en
Новая страница: «then: function (newValue, devName, cellName) { if ( dev.buzzer.enabled) { _buzzer_set_params(); } } });»
Translations:Rule Examples/81/en
Новая страница: «defineRule("_system_buzzer_params", { whenChanged: [ "buzzer/frequency", "buzzer/volume", ],»
Rule Examples/en
Новая страница: «function _buzzer_set_params() { var period = parseInt(1.0 / dev.buzzer.frequency * 1E9); var duty_cycle = parseInt(dev.buzzer.volume * 1.0 / 100 * period * 0.5);»
−224
Translations:Rule Examples/80/en
Новая страница: «runShellCommand("echo " + period + " > /sys/class/pwm/pwmchip0/pwm2/period"); runShellCommand("echo " + duty_cycle + " > /sys/class/pwm/pwmchip0/pwm2/duty_cycle"); };»
Translations:Rule Examples/79/en
Новая страница: «function _buzzer_set_params() { var period = parseInt(1.0 / dev.buzzer.frequency * 1E9); var duty_cycle = parseInt(dev.buzzer.volume * 1.0 / 100 * period * 0.5);»
Translations:Rule Examples/78/en
Новая страница: «// setup pwm2 runShellCommand("echo 2 > /sys/class/pwm/pwmchip0/export");»
Translations:Rule Examples/77/en
Новая страница: «cells: { frequency : { type : "range", value : 3000, max : 7000, }, volume : { type : "range", value : 10, max : 100, }, enabled : { type : "switch", value : false, }, } });»