LED color based on bandwidth usage

i’ve got a somehow related question: as one can see in the video, the LEDs are illuminating each other… do you think it’s possible to paint the transparent plastic thingies to mitigate this?

Check the link in this post: https://www.turris.cz/forum/topic_show.pl?pid=10803
3D printed Omnia “led shield”

6 Likes

Yes, I was thinking about CPU load.
Thanks for instructions, I installed your tool, it’s working.

Hi,

I really like the concept of using the RGB-LEDs for status informations.
There ist potential to that idea and we shouldn’t just set it for the WAN bandwidth but for all ports/leds.

For me upload bandwidth is less important than download bandwidth and most internet consumer lines are designed that way. Therefore I think we should focus on the download bandwidth utilization with colors red, yellow and green
for the different levels of network load like dpdrown described at the beginning.
I think for the upload bandwidth one color is sufficient because it is confusing to use different leds for up and download status.

I draw a simple example of what i think would be the easiest way. Every port (0 to 4 + the WAN Ports) and the PCI-LEDs should use the white color for simply plugged in indication with almost no traffic on the line. Depending on the download usage the color should
change from green to yellow to red but with some adaption to the scaling.
If the upload bandwidth usage reaches over 50% the LED should change to blue exclusively, indicating high upload usage. That way you can see on every port the vital download usage and if occuring a high upload
usage on every port.

Expanding this to the PCI-LEDs with the wifi bandwidth in mind would be nice too.

It is important to change the available WAN bandwidth easily via shell or web-ui. That way anyone could adapt it to their own internet speed.

BTW what are the LEDs A+B for?

They are user selectable.

You can’t do colors per each lan port as there’s a switch between router and the physical ports. So, router sees all the ports grouped as eth1. You’d need to reconfigure the interfaces completely first… I’m quite sure that this would have severe unforseen consequences elsewhere.

1 Like

ok, so that means the ports that can be addressed with checks an colors are the ones I can see via shell:
br-lan
eth0
eth1
eth2
lo
wlan0
wlan2

hmm…tricky. :smirk:

Yeah, some switches have per-port packet counters in swconfig. The switch in the turris does not:

# swconfig dev switch0 help | tail -5
 --port
    Attribute 1 (string): mask (Port-based VLAN mask)
    Attribute 2 (int): qmode (802.1q mode: 0=off/1=fallback/2=check/3=secure)
    Attribute 3 (int): pvid (Primary VLAN ID)
    Attribute 4 (string): link (Get port link information)

Which line do I need to modify to get the following setup for the wan bandwidth? What do I have to adjust to vary the download percentage?

Would it be possible to use blue for a high priority indication if upload reaches >50% ?

Where can I change the colors in the script?

Do I have to activate the user-leds in LuCI to use them in the script?

I added a Pull Request based on your suggestion, it makes more sense:

It would be nice to extend the to all ethernet ports.

2 Likes

The omnia-led-colors project now has an external config file, /etc/config/omnia-led-colors

The example config file still uses the lan0/wan LEDs:

config led wan
        option colorfunction 'bandwidth'
        option interface 'eth1'
        option direction 'in'
        option limit 300000000

config led lan0
        option colorfunction 'bandwidth'
        option interface 'eth1'
        option direction 'out'
        option limit 20000000

But I’ve created a new colorfunction “dualbandwidth” from @b00zuki’s suggestion. Upload above 50% sets the color to blue, below 50% the color is set by the download speed. This config example sets the wan LED.

config led wan
       option colorfunction 'dualbandwidth'
       option interface 'eth1'
       option limit_in 300000000
       option limit_out 20000000

This way you can customize what colors are set and when. Using a uci config file also means a LuCI module could be created to manage these settings in the future.

2 Likes

Hi @dpdrown, thanks for your work!
I have one question, what’s the difference in your config file between “option interface ‘wlan1’” and “option phy ‘phy0’”? Why can’t I use “option interface ‘wlan0’” for the 5GHz card?

Also, after reboot the manualy modified settings of the LED configuration in LuCI are lost (reset). I need to change the sequence there, since I am using an mSATA ssd in slot pci1 and therefore the wlan/radio1 (2.4GHz card) in slot pci3. wlan/radio0 (5GHz card) stays in slot pci2.

Yep, bumped into that as well, in my case it is LED setting for PCI1, which gets reset on every reboot.

Because the ath10k and the ath9k drivers work differently for exporting their channel use statistics.

This should be set in LuCI: System > LED Configuration

1 Like

Well, I have done it via Luci, still resets after reboot.

Looks like /etc/init.d/led_autoconfig tries to rewrite the PCI LEDs based on PCI device location. I think if you rename it from “Auto-configuration for PCIx” it should stop rewriting the configuration.

It’s looking for the following directories:

PCI1 LED:
/sys/devices/platform/soc/soc:pcie-controller/pci0000:00/0000:00:03.0/0000:03:00.0/ieee80211/phy*/device/net/wlan*

PCI2 LED:
/sys/devices/platform/soc/soc:pcie-controller/pci0000:00/0000:00:02.0/0000:02:00.0/ieee80211/phy*/device/net/wlan*

PCI3 LED:
/sys/devices/platform/soc/soc:pcie-controller/pci0000:00/0000:00:01.0/0000:01:00.0/ieee80211/phy*/device/net/wlan*

The SATA detection is similiar (PCI3 example):
/sys/devices/platform/soc/soc:pcie-controller/pci0000:00/0000:00:01.0/0000:01:00.0/ata*/host*/target*//block/sd

You are right, changed it to just “Configuration for PCI1” (Truncated Auto- part) and it persists reboots now.

Main reason to tinker was, that is there seems to be no “Auto-configuration” for LTE interface, so I had to create one.

1 Like

dpdrown Can you also include a case when you saturate DL and UL concurrently?

What color should show up with that case? Purple?

Something like:
Over 80% of both UL & DL => Purple LED?

1 Like

Hi, I want to ask how to most easily uninstalls these modifications? Thanks.