I use Nabu Casa service (everyone should IMO) for accessing HA remotely and was looking for a way to know my WAN IP address if I need to VPN my home network. My Asus router does support various DDNS services but I wasn’t interested to go that way as I don’t like to subscribe online services. My solution was to create a key using puttygen (without passphrase), enable SSH with newly created key in my router, copy key files to /config/ssh into HA with permissions then simply add sensor to config:
sensor:
#### Sensor for showing WAN IP address from Asus RT-AX88U using ssh
- platform: command_line
name: WAN_IP
command: ssh -i /config/ssh/asus_rtax88u_private -o StrictHostKeyChecking=no [email protected] "ifconfig eth0 | grep inet | sed -e 's/.*addr:\([^ ]*\) .*/\1/'"
A lot of information can be pull from those Asus router when using terminal, feel free to share the ones you like to monitor.
SNMP would be useful but has limits, as for securing my router, opening SSH on LAN side with sole key inside HA isn’t concerning. If someone was to hack my HA server, what he could do with my router would not be significant vs all threats possible with devices he could control.
I understand you guys aren’t used with wrt routers and everything you could do with those (cron jobs, scripting).
I know what a WRT flash device can and you are probably right, that when a breach that can read your SSH command line occur, then that will be the least of your problems.
I would still prefer to extract valus from the router through SMNP, though.
The WAN IP I would extract through a website like whatismyip.com, since I would get the true public IP.
The other method would fail with CGN.
If you can find the information, then a command line script can get it too.
It might not be easy, but it’s possible.
You need to make a new post with this question and ask for help with the scriptmake a description of what you do to find it, so people know which steps to make in the script.