First of all I’m not a script-guru, so tried my best to achieve the goal to turn on USER-LED on specific case, when the route (called: test) is active. Otherwise, turn USER-LED off. Of course, the specific Route entry is commented with “test” correctly, so that is double checked.
I’m trying hard with this:
{
/system leds add leds=user-led type=off;
:local status [/ip route get value-name=active [find comment=“test”]];
:if ($status = true) do={
/system leds set [find where leds=“user-led”] type=on
} else={
/system leds set [find where leds=“user-led”] type=off;
}
}
I’m not sure if all setting is done properly, plus the System / LED setting in the WEB GUI is mandatory or not for the user led (or indifferent)
If anyone can guide me where the problem exists, then would be fine.
You can’t add everytime the led, or the 2nd run throw an error.
Creating “led” and the “route” must one preparatory part than must be done before…
Write the code on more clear way…
/system leds
:if ([/ip route get [find where comment=“LED”] active]) do={
set [find where leds=“user-led”] type=on
} else={
set [find where leds=“user-led”] type=off
}
Hello,
thank you for the tip, but this also does not work in System >Script section.
If I run the script with the “Run Script” button(or a created scheduler task reaches the 60 seconds) LED not changing to on.
Steady off.
I have RB750Gr3 with latest OS 7.11.2.
If I set the LED from the System/LEDs menu (GUI) to set on or off, then it’s ok. Seems that the script is not controlling the LED this way.
Any other tought?
Hi,
I would correct my self.
The script works well.
Precondition is to Enable and configure an Off state to the user LED.
After the setting, script runs immediately and LED follows the condition.