translator, wb_editors
4544
правки
Matveevrj (обсуждение | вклад) |
Matveevrj (обсуждение | вклад) |
||
Строка 169: | Строка 169: | ||
var relay_down_control = "Relay 2"; | var relay_down_control = "Relay 2"; | ||
var timeout_s = 15; | |||
var timeout_s = 15; | |||
// End of settings | // End of settings | ||
Строка 180: | Строка 179: | ||
defineRule( "roller_shutter_up_on" + suffix, { | defineRule( "roller_shutter_up_on" + suffix, { | ||
asSoonAs: function() { | asSoonAs: function() { | ||
return dev[relay_up_device | return dev["relay_up_device/relay_up_control"]; | ||
}, | }, | ||
then: function () { | then: function () { | ||
Строка 186: | Строка 185: | ||
relay_up_timer_id = clearTimeout(relay_up_timer_id); | relay_up_timer_id = clearTimeout(relay_up_timer_id); | ||
}; | }; | ||
relay_up_timer_id = setTimeout(function() { | |||
relay_up_timer_id = setTimeout(function() { | return dev["relay_up_device/relay_up_control"] = 0; | ||
return dev[relay_up_device | |||
}, timeout_s * 1000); | }, timeout_s * 1000); | ||
} | } | ||
}); | }); | ||
defineRule("roller_shutter_down_on" + suffix, { | |||
defineRule("roller_shutter_down_on" + suffix, { | |||
asSoonAs: function() { | asSoonAs: function() { | ||
return dev[relay_down_device][relay_down_control]; | return dev[relay_down_device][relay_down_control]; | ||
Строка 207: | Строка 202: | ||
relay_down_timer_id = setTimeout(function() { | relay_down_timer_id = setTimeout(function() { | ||
dev[relay_down_device | dev["relay_down_device/relay_down_control"] = 0; | ||
}, timeout_s * 1000); | }, timeout_s * 1000); | ||
} | } | ||
}); | }); | ||
defineRule("roller_shutter_both_on" + suffix, { | |||
defineRule("roller_shutter_both_on" + suffix, { | |||
asSoonAs: function() { | asSoonAs: function() { | ||
return dev[relay_up_device][relay_up_control] && dev[relay_down_device | return dev[relay_up_device][relay_up_control] && dev["relay_down_device/relay_down_control"]; | ||
}, | }, | ||
then: function () { | then: function () { | ||
Строка 222: | Строка 215: | ||
relay_up_timer_id = clearTimeout(relay_up_timer_id); | relay_up_timer_id = clearTimeout(relay_up_timer_id); | ||
}; | }; | ||
if (relay_down_timer_id) { | if (relay_down_timer_id) { |