Onhub TP-LINK TGR1900 future support?

What would be nice would be a method to get the LEDs to do what they did when OnHub was supported. I liked the teal ring when everything was up properly and the red ring if you lost the Internet connection. I already forget what the white ring was for (ready to setup?). Then with the ambient light sensor working all would be working normally. I know there's some LED controls on OpenWrt but exactly what to set them for to create this might be beyond OpenWrt.

The good news is you can tick on the options and see what the lights end up doing.

You are writing about the OnHub you compiled from scratch?

It looks like the LUCI 'LED Configuration' allows you to configure the LEDs to blink for activity, but not on status of lost WAN edit: upstream internet connectivity.
(unless there is some manual config I'm missing with it.)

As a workaround I did test this method which worked though.
It will ping a public IP and change the LED from green to red if actual internet connectivity is lost.

In /etc/config/system I added this:

config led 'wan_led'
        option name 'WAN LED'
        option sysfs 'green:status'
        option default '1'
        option trigger 'none'

In /user/bin/ I created (and made executable) a script called check_wan.sh with contents:

# You can replace 8.8.8.8 with whatever public server desired
if ping -c 1 8.8.8.8 >/dev/null 2>&1; then
        echo "default-on" > /sys/class/leds/green:status/trigger
        echo "none" > /sys/class/leds/red:status/trigger
else
        echo "default-on" > /sys/class/leds/red:status/trigger
        echo "none" > /sys/class/leds/green:status/trigger

fi

Then you can use a cron job in scheduled tasks to run the script at desired interval. Example, to check every minute:

***** /usr/bin/check_wan.sh

Note: I have the ASUS model Onhub. The LED format might be different on the TP-link version - not sure.

1 Like

I think the 'Link On' option gives that information (but may be device specific/tweaked), just not as you asked.
Instead of telling you lost, it denotes an on state.

1 Like

I realize now I could have worded that better. :grinning:
I should have made the distinction between the WAN port being in an 'ON' state (because it's connected to your on-premise ISP modem, etc. ) and secondarily having actual upstream internet connectivity.

1 Like

I'm presently screwing with the lights on the TP-Link OnHub since I have "perfected" and optimized an NSS build and have nothing else to tinker on or upgrade or bug fix. What am I supposed to do when everything is working reliably and fast and never generates any errors or issues and doesn't need regular updates? Of course I have to try and figure out colour palettes of SIX led lights that can each be any of three different colours. The original Google programmers got lots of colours and smooth transitions. Theoretically you can make any colour from red/green/blue like a television does. I think though this is beyond the LED controls in OpenWrt. Early on in this thread, someone posted a script which I have used from the beginning, but I'm thinking I can adapt your script to do something different. At least I have something new to tinker with.

3 Likes

There is also zigbee module, it can be used as some home automation concentator. Can i use Your work? I have asus to play with.

I haven't done any work other than trying to learn to do it myself because I had to. The code for OpenWrt is open source, and the NSS patches was work done by @Kong @ACwifidude and @vochong and I only learned by multiple failures. I've posted elsewhere on this forum the NSS binaries I successfully compiled. I'm still trying to do it again as things get updated and what worked a few months ago in the compile process doesn't work today.

The goal of my little effort is to create the last, best version of OpenWrt firmware for the OnHub routers which are way past end of life now. I'm just a tinkerer and I my last version seems to run smoothly in my simple setup and I don't get any errors in the log anymore. I'm getting speed at the upper limit of the device's capability. The supported Firmware Selector version only gets about half the theoretical top speed. I could just leave it alone.

I've had no success with any fancy light effects or using the zigbee module or programming the directional signal detection capabilities that Google created for this router. There's a lot of unused exotic hardware included here. It's all beyond what OpenWrt is designed to do but might be possible.

Play all you want - I don't know what I can do for you.

1 Like

This is my current LED setup based on the script very early on in this thread. As the firmware has been updated a lot since that ancient post, the internal names of the LEDs has changed from what's in the script, but you can see the general theme.

UCI Script LEDs

1 Like

If anyone wants to try my latest pre-built NSS binary for Asus and TP-Link OnHub routers link below. Use at your own risk. I'm an amateur. You always risk bricking your router when you flash firmware.

OnHub NSS pre-built firmware (November 23, 2024)

3 Likes

Just flashed to mine!!! Thanks for everybody envolved!!

1 Like

Thanks you

Also note, latest RC released yesterday!

24.10.0-rc2 shows latest kernel and other upgrades for ipq806x.

1 Like

Got the internal speaker working with Media Player Daemon (MPD) so I can play media and voice notifications from Home Assistant. Had many issues with playback speed, volume, permissions, etc so thought I would share.

Install mpd
opkg update && opkg install mpd-mini

Stop the service
service mpd stop

The sound driver does not have volume control so added new file /etc/asound.conf with software volume control:

vi /etc/asound.conf

Which contains:

pcm.softvol {
  type softvol
  slave.pcm "default"
  control.name "Volume"
  control.card 0
}

Edit the mpd configuration.
vi /etc/mpd.conf

Leave everything default except:

# It really wants these paths or will not start.
# Should auto create them on next run.
music_directory         "/mpd/music"
playlist_directory      "/mpd/playlists"
db_file                 "/mpd/database"
log_file                "/mpd/log"

# Force bind to IPV4 on all interfaces
bind_to_address         "0.0.0.0"     

audio_output {                                                         
        type            "alsa"                                        
        name            "My ALSA Device"                                     
        # Important to get playing at correct volume and speed
        format          "44100:16:1" 
        # Set software volume control. See /etc/asound.conf        
        device          "softvol"                      
        mixer_type      "software"
        mixer_device    "softvol-mixer"                                            
}

Check who owns the sound device.

ls -la /dev/snd

For mpd-mini this shows:

crw-rw----    1 root     audio     116,   0 Dec 17 20:55 controlC0
crw-rw----    1 root     audio     116,  16 Dec 17 20:55 pcmC0D0p
crw-rw----    1 root     audio     116,  33 Dec 17 20:55 timer

For mpd-full it looks like pulse audio takes control and the group is pulse instead of audio

Edit groups to add mpd user
vi /etc/group

Add mpd end to corresponding audio or pulse lines. e.g.

audio:x:29:mpd
or
pulse:x:51:pulse,mpd

Start the MPD service again.
service mpd start

Check that /mpd directory was created and is owned by mpd.
ls -la /

If wrong owner then:
chmod -R mpd:mpd /mpd

You can change the volume with alsamixer.

Finally in Home Assistant add Media Player Daemon integration and point it to the IP address of the router. No password using default port.

If anything does not work then check system log and vi /mpd/log for error messages.

If everything is working you can change /etc/mpd.conf and send log file to null so it does not take up space

log_file "/dev/null"

3 Likes

You're doing this on a TP-Link OnHub router?

Yes TP-Link TGR1900 OnHub router with OpenWRT and Media Player Daemon (MPD).

So nice to have an always on device that can output voice messages.

Edit:
The speaker is over blown using default output volume level. I have since changed /etc/asound.conf to:

pcm.softvol {
  type softvol
  slave.pcm "default"
  control.name "Volume"
  control.card 0
  max_dB -7.0
}
1 Like

Quick note for anyone upgrading to 24.10.0-rc4 firmware on the OnHub routers:

"Devices using Qualcomm Atheros IPQ806X SoCs, has been converted to use the Distributed Switch Architecture (DSA)."

Distributed Switch Architecture (DSA) is a major change in how the network switch is managed within the Linux kernel. There is no direct configuration migration path from the previous switch management system (swconfig) to DSA. This means that if you upgrade to the new firmware, you'll need to reconfigure your network settings. When upgrading, you'll need to perform a clean install without preserving your existing configuration.

4 Likes

Hi there!

I have a Google Onhub(TP-Link ver) running OpenWrt 23.05 with a USB drive as extroot partition and I have a following issue:
Every time I reboot the device(both from terminal or disconnecting from the power) it won’t boot with a USB drive connected, RGB is going red and system hangs. Seems it is caused by some bootloader features.
Any ideas what can be done to fix this if it is possible? If any logs are needed, please advice a command or location of the logs as I’m not very good in Linux.

Thank you!

Hi Udjin:
I have tested this behavior on it even with a wifi dongle in the USB. Basically, this means that the USB can be used only for attended duration during its normal operations. If it experiences any reboot and finds any USB device, the box will hang. In some ways, this makes the USB port non-usable.

People who have cow powers and tech know how will have to find out how big a deal will it be to find a fix and how to apply that fix. This was not a problem with this device when it was a chrome based router by Google.