Shortly … with default state '1'(in system config) and status 'auto' (in rainbow config) …and with option mode 'link tx rx' led will be on if the link is up , off when links is down and blinks when rx/tx occurs . option mode 'tx rx' led will be off and blinks when rx/tx occurs
led for vpn, system uci config
config led
option sysfs 'omnia-led:pci1'
option trigger 'netdev'
option default '1'
option name 'PCI1'
option dev 'tun_turris'
option mode 'link tx rx'
personal side notes
Your setup makes that led to be off by default and only when tx/rx events occurs it should blink,but as you have “default state = 0” it remains off. you can have multiple led-configs linked to single led. In such case only one led-config should have default-state=1 rest should have it 0. (some time ago i had one led showing all writes from all blockdevices and second led has all reads from all blockdevices).
in paralell / in combination with /etc/config/rainbow where each led has “option status” which can be on/off/auto. On = led is always on, Off = led is always off, Auto = led is blinking based on hardware events (tx/rx) or (link/tx/rx).
My intention is that the LED blinks on tx/rx, therefore option mode 'tx rx' without link.
Regarding “you can have multiple led-configs linked to single led. In such case only one led-config should have default-state=1 rest should have it 0.”: LED User 1 is only associated with one led config.
The configuration is the following at the moment:
/etc/config/system:
config led
option sysfs 'omnia-led:user1'
option trigger 'netdev'
option name 'IPv6 (HE) Network Activity'
option dev '6in4-WAN6_HE_48'
option default '1'
list mode 'tx'
list mode 'rx'
and /etc/config/rainbow:
config led 'usr1'
option color 'green'
option status 'auto'
Unfortunately the LED remains dark (= not blinking on tunnel traffic).
I also tried option mode 'tx rx'
instead
of
list mode 'tx'
list mode 'rx'
but there is no change.
I spotted the different naming user1 in /etc/config/system and usr1 in /etc/config/rainbow. However, it works fine for user2/usr2 which is associated with the VPN tunnel interface.
config led
option sysfs 'omnia-led:user1'
option trigger 'netdev'
option name 'IPv6 (HE) Network Activity'
option dev '6in4-WAN6_HE_48'
option default '1'
list mode 'tx rx'
config led
option sysfs 'omnia-led:user1'
option trigger 'netdev'
option name 'VPN'
option dev 'tun_turris'
option default '0'
list mode 'tx rx'
that will cause ‘usr1’ led to be ON for “6in4” and blinks on tx/rx or/and led will be OFF for “tun_turris” and blinks on tx/rx . In general you can have 1 or 0 as default state so both led-configs will cause led to be on/off prior to trigger-event, that is valid option. Now i see, that my note ragarding that might misslead you. Sorry for that.
that is correct, it should be (according to Openwrt wiki) “list of elements separated with ‘space’”
naming in “system” config is up to you, how you name it (it is just config block name) , that’s why you can have as many as you want , in “rainbow” config it is given by default (the names), no need to change or keep the names same in both. Rainbow(usr1) == System(omniga-led:user1)
If the led is not blinking (and you know it should), give it one minute (sometimes it has delay, sometimes i have do “save&apply” in Luci/System/Led-Config twice, before it stats flashing). Also check if you have all other led-configs correctly set (syntax).
If you have “USR2” working, copy that block as-is (in system config) as “USR1” and just change “option dev” line. Restart rainbow and system services and it should work.
The actual problem appears to be something different.
For testing I had both user LEDs reacting to VPN (interface WG0 for Wireguard) traffic:
config led
option dev 'WG0'
option sysfs 'omnia-led:user2'
option default '0'
option trigger 'netdev'
list mode 'tx'
list mode 'rx'
option name 'VPN'
config led
option sysfs 'omnia-led:user1'
option default '0'
option trigger 'netdev'
list mode 'tx'
list mode 'rx'
option name 'IPv6 (HE) Network Activity'
option dev 'WG0'
This worked perfectly fine and both LEDs were blinking.
When I change the dev parameter back to the IPv6 tunnel interface
config led
option sysfs 'omnia-led:user1'
option default '0'
option trigger 'netdev'
list mode 'tx'
list mode 'rx'
option name 'IPv6 (HE) Network Activity'
option dev '6in4-WAN6_HE_48'
and then restart the LED service using
service led restart
I get
setting up led Auto-configuration for PCI1
setting up led Auto-configuration for PCI2
setting up led Auto-configuration for PCI3
setting up led Auto-configuration for WAN
setting up led VPN
setting up led IPv6 (HE) Network Activity
sh: write error: Invalid argument
I haven’t seen the error message in the past, because I always executed the restart from the UI.
I thought there may be a typo and therefore selected the interface again from the UI (LUCI) and received the same result.
Here’s the solution!
In /etc/config/network I changed (removing the unterdashes (_))
WAN6_HE_48
to
WAN6HE48
and reselected the interface in the LED configuration. Now LED User 1 blinks on IPv6 tunnel traffic
btw: i think that “/etc/init.d/led” is something similar to mine “/etc/init.d/led_autoconfig” which update WAN,mSATA,WiFi led configuration …, i never used it. as i understand “/etc/init.d/system” should use “/etc/config/system” to reload led-config and “/etc/init.d/rainbow” to reload color setup for each led.
Regarding the “-” or “_” >> taken from openwrt wiki…
It is important to know that UCI identifiers and config file names may contain only the characters a-z , 0-9 and _ . E.g. no hyphens ( - ) are allowed. Option values may contain any character (as long they are properly quoted).
service rainbow restart
service led restart
service system restart
(Gießkannenprinzip in the german language )
Could you provide a link to the OpenWRT wiki?
Interesting, I removed the underdashes from the interface name, which would be allowed according to the quoted text.
Hyphens are automatically added for the device name, in my case 6in4-WAN6HE48. WAN6HE48 is what I entered an an interface name