Вклад участника Matveevrj
- 20:42, 21 сентября 2022 разн. история +236 Н Translations:Rule Examples/194/en Новая страница: «defineVirtualDevice("water_meters", { // We create a virtual device for display in the web interface. title: "Water meters", cells: { water_meter_1: { type: "value", value: 0 }, } });» текущая
- 20:42, 21 сентября 2022 разн. история −176 Rule Examples/en Новая страница: «defineRule("roller_shutter_1_both_on", { asSoonAs: function() { return relay_up_1 && relay_down_1; }, then: function () { relay_up_1 = 0; relay_down_1 = 0; log("Both roller shutter relays on, switching them off"); } }); })();»
- 20:41, 21 сентября 2022 разн. история +227 Н Translations:Rule Examples/193/en Новая страница: «<syntaxhighlight lang="ecmascript"> var meterCorrection = 123120 // Кcorrection value of the meter in liters var counterCorrection = 7 // WB-MCM8 correction value in pulses var inpulseValue = 10 // Number of liters per impulse» текущая
- 20:40, 21 сентября 2022 разн. история −442 Rule Examples/en Новая страница: «If you need several such motion detectors, then in order not to copy the code, you can wrap the creation of the rule and variables in a function:»
- 20:40, 21 сентября 2022 разн. история +219 Н Translations:Rule Examples/192/en Новая страница: «Pulse counter connected to WB-MCM8. Gives out 1 pulse per 10 liters of water. When connected, the meter showed readings of 123.120 m³, which is equal to 123120 liters of water. The WB-MCM8 had 7 pulses when plugged in.» текущая
- 20:40, 21 сентября 2022 разн. история +41 Н Translations:Rule Examples/69/en Новая страница: «</syntaxhighlight> == Impulse counters ==» текущая
- 20:39, 21 сентября 2022 разн. история +267 Н Translations:Rule Examples/68/en Новая страница: «defineRule("roller_shutter_1_both_on", { asSoonAs: function() { return relay_up_1 && relay_down_1; }, then: function () { relay_up_1 = 0; relay_down_1 = 0; log("Both roller shutter relays on, switching them off"); } }); })();» текущая
- 20:39, 21 сентября 2022 разн. история +221 Н Translations:Rule Examples/67/en Новая страница: «defineRule("roller_shutter_1_down_on", { asSoonAs: function() { return relay_down_1; }, then: function () { setTimeout(function() { relay_down_1 = 0; }, timeout_s * 1000); } });» текущая
- 20:39, 21 сентября 2022 разн. история +212 Н Translations:Rule Examples/66/en Новая страница: «defineRule("roller_shutter_1_up_on", { asSoonAs: function() { return relay_up_1; }, then: function () { setTimeout(function() { relay_up_1 = 0; }, timeout_s * 1000); } });» текущая
- 20:39, 21 сентября 2022 разн. история −56 Rule Examples/en Новая страница: «var timeout_s = 15; // End of settings var relay_up_timer_id = null; var relay_down_timer_id = null; defineRule( "roller_shutter_up_on" + suffix, { asSoonAs: function() { return dev[relay_up_device][relay_up_control]; }, then: function () { if (relay_up_timer_id) { relay_up_timer_id = clearTimeout(relay_up_timer_id); };»
- 20:39, 21 сентября 2022 разн. история +133 Н Translations:Rule Examples/65/en Новая страница: «(function() { defineAlias("relay_up_1", "lc103_4/Relay 1"); defineAlias("relay_down_1", "lc103_4/Relay 2"); var timeout_s = 15;» текущая
- 20:39, 21 сентября 2022 разн. история −345 Rule Examples/en Новая страница: «defineRule("roller_shutter_both_on" + suffix, { asSoonAs: function() { return dev[relay_up_device][relay_up_control] && dev[relay_down_device][relay_down_control]; }, then: function () { if (relay_up_timer_id) { relay_up_timer_id = clearTimeout(relay_up_timer_id); };»
- 20:39, 21 сентября 2022 разн. история +104 Н Translations:Rule Examples/64/en Новая страница: «An older version of the same script demonstrates the use of aliases: <syntaxhighlight lang="ecmascript">» текущая
- 20:39, 21 сентября 2022 разн. история +198 Н Translations:Rule Examples/63/en Новая страница: «dev[relay_up_device][relay_up_control] = 0; dev[relay_down_device][relay_down_control] = 0; log("Both roller shutter relays on, switching them off"); } }); })(); </syntaxhighlight>»
- 20:39, 21 сентября 2022 разн. история +101 Н Translations:Rule Examples/62/en Новая страница: «if (relay_down_timer_id) { relay_down_timer_id = clearTimeout(relay_down_timer_id); };» текущая
- 20:39, 21 сентября 2022 разн. история +306 Н Translations:Rule Examples/61/en Новая страница: «defineRule("roller_shutter_both_on" + suffix, { asSoonAs: function() { return dev[relay_up_device][relay_up_control] && dev[relay_down_device][relay_down_control]; }, then: function () { if (relay_up_timer_id) { relay_up_timer_id = clearTimeout(relay_up_timer_id); };»
- 20:39, 21 сентября 2022 разн. история −168 Rule Examples/en Новая страница: «var relay_down_device = "lc103_4"; var relay_down_control = "Relay 2";»
- 20:39, 21 сентября 2022 разн. история +425 Н Translations:Rule Examples/60/en Новая страница: «defineRule("roller_shutter_down_on" + suffix, { asSoonAs: function() { return dev[relay_down_device][relay_down_control]; }, then: function () { if (relay_down_timer_id) { relay_down_timer_id = clearTimeout(relay_down_timer_id); }; relay_down_timer_id = setTimeout(function() { dev[relay_down_device][relay_down_control] = 0; }, timeout_s * 1000); } });»
- 20:39, 21 сентября 2022 разн. история +142 Н Translations:Rule Examples/59/en Новая страница: «relay_up_timer_id = setTimeout(function() { return dev[relay_up_device][relay_up_control] = 0; }, timeout_s * 1000); } });»
- 20:38, 21 сентября 2022 разн. история +377 Н Translations:Rule Examples/58/en Новая страница: «var timeout_s = 15; // End of settings var relay_up_timer_id = null; var relay_down_timer_id = null; defineRule( "roller_shutter_up_on" + suffix, { asSoonAs: function() { return dev[relay_up_device][relay_up_control]; }, then: function () { if (relay_up_timer_id) { relay_up_timer_id = clearTimeout(relay_up_timer_id); };»
- 20:38, 21 сентября 2022 разн. история −170 Rule Examples/en Новая страница: «In addition, the rule turns off the engines after a specified time after being turned on.»
- 20:38, 21 сентября 2022 разн. история +72 Н Translations:Rule Examples/57/en Новая страница: «var relay_down_device = "lc103_4"; var relay_down_control = "Relay 2";» текущая
- 20:38, 21 сентября 2022 разн. история +212 Н Translations:Rule Examples/56/en Новая страница: «<syntaxhighlight lang="ecmascript"> (function() { //don't touch this line var suffix = "1"; // must be different in different JS files var relay_up_device = "lc103_4"; var relay_up_control = "Relay 1";» текущая
- 20:38, 21 сентября 2022 разн. история −178 Rule Examples/en Новая страница: «// time point marking the beginning of the interval // i.e. "today, at HH:MM". All dates are in UTC! var date_start = new Date(date); date_start.setHours(9); date_start.setMinutes(30);»
- 20:38, 21 сентября 2022 разн. история +89 Н Translations:Rule Examples/55/en Новая страница: «In addition, the rule turns off the engines after a specified time after being turned on.» текущая
- 20:38, 21 сентября 2022 разн. история +186 Н Translations:Rule Examples/54/en Новая страница: «One relay turns on the motor that raises the curtains, the second relay turns on the motor that lowers the curtains. The rule ensures that both relays are not turned on at the same time.» текущая
- 20:38, 21 сентября 2022 разн. история −54 Rule Examples/en Новая страница: «=== Activate the rule only at a certain time ===»
- 20:38, 21 сентября 2022 разн. история +24 Н Translations:Rule Examples/53/en Новая страница: «=== Rolling shutters ===» текущая
- 20:38, 21 сентября 2022 разн. история −264 Rule Examples/en Новая страница: «<syntaxhighlight lang="ecmascript"> var motion_timer_1_timeout_ms = 5 * 1000; var motion_timer_1_id = null; defineRule("motion_detector_1", { whenChanged: "wb-gpio/A1_IN", then: function (newValue, devName, cellName) { var date = new Date();»
- 20:37, 21 сентября 2022 разн. история +653 Н Translations:Rule Examples/52/en Новая страница: «// time point marking the end of the interval var date_end = new Date(date); date_end.setHours(17); date_end.setMinutes(10); // if time is between 09:30 and 17:10 UTC if ((date > date_start) && (date < date_end)) { if (newValue) { dev["wb-gpio"]["EXT1_R3A1"] = 1; if (motion_timer_1_id) { clearTimeout(motion_timer_1_id); } motion_timer_1_id = setTimeout(function () {...»
- 20:37, 21 сентября 2022 разн. история +200 Н Translations:Rule Examples/51/en Новая страница: «// time point marking the beginning of the interval // i.e. "today, at HH:MM". All dates are in UTC! var date_start = new Date(date); date_start.setHours(9); date_start.setMinutes(30);» текущая
- 20:37, 21 сентября 2022 разн. история +251 Н Translations:Rule Examples/50/en Новая страница: «<syntaxhighlight lang="ecmascript"> var motion_timer_1_timeout_ms = 5 * 1000; var motion_timer_1_id = null; defineRule("motion_detector_1", { whenChanged: "wb-gpio/A1_IN", then: function (newValue, devName, cellName) { var date = new Date();» текущая
- 20:37, 21 сентября 2022 разн. история +91 Н Translations:Rule Examples/49/en Новая страница: «The rule is the same as in the previous section, but only runs from 9:30 am to 5:10 pm UTC.» текущая
- 20:37, 21 сентября 2022 разн. история −213 Rule Examples/en Новая страница: «defineRule("motion_detector_1", { whenChanged: "wb-gpio/D2_IN", then: function (newValue, devName, cellName) { if (newValue) { dev["wb-gpio"]["Relay_1"] = true; if (motion_timer_1_id) { clearTimeout(motion_timer_1_id); } motion_timer_1_id = setTimeout(function () { dev["wb-gpio"]["Relay_1"] = false; motion_timer_1_id = null; }, motion_t...»
- 20:37, 21 сентября 2022 разн. история +48 Н Translations:Rule Examples/48/en Новая страница: «=== Activate the rule only at a certain time ===» текущая
- 20:37, 21 сентября 2022 разн. история +237 Н Translations:Rule Examples/47/en Новая страница: «makeMotionDetector("motion_detector_1", 20000, "EXT1_DR1", "EXT2_R3A1"); makeMotionDetector("motion_detector_2", 10000, "EXT1_DR2", "EXT2_R3A2"); makeMotionDetector("motion_detector_3", 10000, "EXT1_DR3", "EXT2_R3A3"); </syntaxhighlight>» текущая
- 20:37, 21 сентября 2022 разн. история +198 Н Translations:Rule Examples/46/en Новая страница: «motion_timer_id = setTimeout(function() { dev["wb-gpio"][relay_control] = false; motion_timer_id = null; }, timeout_ms); } } }); }»
- 20:37, 21 сентября 2022 разн. история −56 Rule Examples/en Новая страница: «<syntaxhighlight lang="ecmascript"> function makeMotionDetector(name, timeout_ms, detector_control, relay_control) { var motion_timer_id = null; defineRule(name, { whenChanged: "wb-gpio/" + detector_control, then: function(newValue, devName, cellName) { if (!newValue) { dev["wb-gpio"][relay_control] = true; if (motion_timer_id) { clearTimeout(motion_timer_id); }»
- 20:37, 21 сентября 2022 разн. история +451 Н Translations:Rule Examples/45/en Новая страница: «<syntaxhighlight lang="ecmascript"> function makeMotionDetector(name, timeout_ms, detector_control, relay_control) { var motion_timer_id = null; defineRule(name, { whenChanged: "wb-gpio/" + detector_control, then: function(newValue, devName, cellName) { if (!newValue) { dev["wb-gpio"][relay_control] = true; if (motion_timer_id) { clearTimeout(motion_timer_id); }»
- 20:37, 21 сентября 2022 разн. история −237 Rule Examples/en Новая страница: «<syntaxhighlight lang="ecmascript"> var motion_timer_1_timeout_ms = 30 * 1000; var motion_timer_1_id = null;»
- 20:37, 21 сентября 2022 разн. история +145 Н Translations:Rule Examples/44/en Новая страница: «If you need several such motion detectors, then in order not to copy the code, you can wrap the creation of the rule and variables in a function:» текущая
- 20:36, 21 сентября 2022 разн. история +30 Н Translations:Rule Examples/43/en Новая страница: «=== Creating similar rules ===» текущая
- 20:36, 21 сентября 2022 разн. история −432 Rule Examples/en Новая страница: «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.»
- 20:36, 21 сентября 2022 разн. история +521 Н Translations:Rule Examples/191/en Новая страница: «defineRule("motion_detector_1", { whenChanged: "wb-gpio/D2_IN", then: function (newValue, devName, cellName) { if (newValue) { dev["wb-gpio"]["Relay_1"] = true; if (motion_timer_1_id) { clearTimeout(motion_timer_1_id); } motion_timer_1_id = setTimeout(function () { dev["wb-gpio"]["Relay_1"] = false; motion_timer_1_id = null; }, motion_t...»
- 20:36, 21 сентября 2022 разн. история +108 Н Translations:Rule Examples/38/en Новая страница: «<syntaxhighlight lang="ecmascript"> var motion_timer_1_timeout_ms = 30 * 1000; var motion_timer_1_id = null;» текущая
- 20:36, 21 сентября 2022 разн. история +265 Н Translations:Rule Examples/36/en Новая страница: «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.»
- 20:34, 21 сентября 2022 разн. история −104 Rule Examples/en Новая страница: «The lighting is connected via a built-in relay corresponding to the <code>wb-gpio/Relay_1</code> channel.»
- 20:33, 21 сентября 2022 разн. история +105 Н Translations:Rule Examples/37/en Новая страница: «The lighting is connected via a built-in relay corresponding to the <code>wb-gpio/Relay_1</code> channel.» текущая
- 20:33, 21 сентября 2022 разн. история −173 Rule Examples/en Новая страница: «A motion detector with a "dry contact" output is connected to input D2. When motion is detected, it shorts D2 and GND and status "1" appears on the corresponding <code>wb-gpio/D2_IN</code> channel.»
- 20:33, 21 сентября 2022 разн. история +197 Н Translations:Rule Examples/35/en Новая страница: «A motion detector with a "dry contact" output is connected to input D2. When motion is detected, it shorts D2 and GND and status "1" appears on the corresponding <code>wb-gpio/D2_IN</code> channel.»