[ASUSWRT] sensor - specify network interface name

The current ASUSWRT component relies on the Aioasuswrt helper. Aioasuswrt uses the following commands to determine upload/download speed:

ifconfig eth0 |grep bytes
cat /sys/class/net/eth0/statistics/rx_bytes
cat /sys/class/net/eth0/statistics/tx_bytes

There is also the following for loop which looks for the interface name ‘eth0’:

        for line in data:
            if 'eth0' in line:
                rx = data[i+3].split(' ')[4]
                tx = data[i+5].split(' ')[4]
                break
            i += 1
        return int(rx), int(tx)

The problem is that this code only works if the main interface on the router is named ‘eth0’. The code fails if, for example, a bridged connection is in use, which is often named ‘br0’.

It would be great if we could specify the interface name that Aioasuswrt should search for via the configuration.yaml file.