Skip to content

Instantly share code, notes, and snippets.

@amercier
Last active November 13, 2024 09:36
Show Gist options
  • Save amercier/e64ee30eb3f96fcc42e3 to your computer and use it in GitHub Desktop.
Save amercier/e64ee30eb3f96fcc42e3 to your computer and use it in GitHub Desktop.
Turn leds on/off on Synology DiskStation

Synology scheduled tasks

Usage

Go to Control Panel / Task Scheduler and add the content of these scripts as root scripts.

Leds

Codes have been taken from this article.

  • turn-leds-off.sh: turns leds off
  • turn-leds-on.sh: turn leds back on

Ex (this is how I use it): turn leds daily at 10PM, turn them back on at 6AM.

#!/bin/sh
printf \\x36 > /dev/ttyS1 # UART2_CMD_LED_POWER_OFF
printf \\x37 > /dev/ttyS1 # UART2_CMD_LED_HD_OFF
printf \\x42 > /dev/ttyS1 # UART2_CMD_LED_USB_OFF
printf \\x4B > /dev/ttyS1 # UART2_CMD_LED_10G_LAN_OFF
printf \\x50 > /dev/ttyS1 # UART2_CMD_LED_MIRROR_OFF
#!/bin/sh
printf \\x34 > /dev/ttyS1 # UART2_CMD_LED_POWER_ON
printf \\x38 > /dev/ttyS1 # UART2_CMD_LED_HD_GS
printf \\x40 > /dev/ttyS1 # UART2_CMD_LED_USB_ON
printf \\x4A > /dev/ttyS1 # UART2_CMD_LED_10G_LAN_ON
printf \\x51 > /dev/ttyS1 # UART2_CMD_LED_MIRROR_GS
@neddy
Copy link

neddy commented Feb 15, 2017

Hey Guys, thanks for the script, I really appreciate it... I've just found that in DSM there is actually a feature now to completely control the LEDs. It's under 'Control Panel>Hardware & Power>LED Brightness Control' it allows you to completely turn off the LEDs and to set a schedule too... Hopefully this helps someone. Cheers

@Kirdock
Copy link

Kirdock commented Feb 19, 2017

The setting "LED Brightness Control" does not exist on my NAS. (DS1515+; DSM 6.0.2-8451 Update 9).
Does nobody has a solution for LAN LED?

@mornology
Copy link

I have the RS3617xs with DSM 6.1.3-15152 Update 1 and the LED options within control panel do not exist. I used the script trick with the DS1515+ but once I updated that system to DSM 6.0 it no longer worked. I tried the script with my RS3617xs but only the power button goes out, not the insanely bright HDD lights.

@mosauter
Copy link

Has anybody tried that with a extension unit? In my case a DX513. Cause the main module has a led control via the website but I seem to be unable to find the settings for the extension...

@vistalba
Copy link

For me only Power, Status and USB works on DS211+ :(
The option to control the LED from Synology itself is only avaiable on newer devices. (DS916+ in my case).

Is there a way also to switch off LAN, DISC1 and DISC2? That would be great for me :)

@johnflan
Copy link

Thanks for this, like some of the people it works for power LEDs etc but not for disk activity LEDs.

@howdey57
Copy link

howdey57 commented Jan 1, 2019

Does anyone know the codes to turn off the LAN, DISC1 and DISC2 lights too?

Thanks

@sniarn
Copy link

sniarn commented Feb 17, 2019

Thanks for this. The blue power LED was driving me nuts (ds3617xs).

@neolith
Copy link

neolith commented Aug 12, 2020

Awesome! Thank you so much!

@stevenfoxhound
Copy link

stevenfoxhound commented Feb 10, 2021

Function code working from Task scheduler script on the DSM or from SSH:

echo 0 >/dev/ttyS1 Power on
echo 1 >/dev/ttyS1 Power off
echo 2 >/dev/ttyS1 Short beep
echo 3 >/dev/ttyS1 Long beep
echo 4 >/dev/ttyS1 Power LED on
echo 5 >/dev/ttyS1 Power LED flash
echo 6 >/dev/ttyS1 Power LED off
echo 7 >/dev/ttyS1 Status LED off
echo 8 >/dev/ttyS1 Status LED on green
echo 9 >/dev/ttyS1 Status LED flash green
echo A >/dev/ttyS1 USBCopy LED flash
echo B >/dev/ttyS1 USBCopy LED off
echo C >/dev/ttyS1 Reset
echo @ >/dev/ttyS1 USBCopy LED on
echo : >/dev/ttyS1 Status LED on orange
echo ; >/dev/ttyS1 Status LED flash orange

You can mix several code together.

echo 48 >/dev/ttyS1 Power LED on + Status LED on green

@1RandomDev
Copy link

Function code working from Task scheduler script on the DSM or from SSH:

echo 0 >/dev/ttyS1 Power on echo 1 >/dev/ttyS1 Power off echo 2 >/dev/ttyS1 Short beep echo 3 >/dev/ttyS1 Long beep echo 4 >/dev/ttyS1 Power LED on echo 5 >/dev/ttyS1 Power LED flash echo 6 >/dev/ttyS1 Power LED off echo 7 >/dev/ttyS1 Status LED off echo 8 >/dev/ttyS1 Status LED on green echo 9 >/dev/ttyS1 Status LED flash green echo A >/dev/ttyS1 USBCopy LED flash echo B >/dev/ttyS1 USBCopy LED off echo C >/dev/ttyS1 Reset echo @ >/dev/ttyS1 USBCopy LED on echo : >/dev/ttyS1 Status LED on orange echo ; >/dev/ttyS1 Status LED flash orange

You can mix several code together.

echo 48 >/dev/ttyS1 Power LED on + Status LED on green

Most of them are obvious, but what exactly do code 0 and 1 do? Apparently they are not used to turn the NAS on and off and they don't seem to have any effect at all. (Tested on DS220+)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment