I have a Flint 2 router, with WAN1 set as my primary internet connection and WAN2 as my backup (using a hotspot connected via Ethernet).
I’ve tested the failover process by disconnecting the WAN1 Ethernet cable, and the router successfully switches to the WAN2 hotspot.
My question is: I want to receive an email alert when this failover happens. I’ve set up a PowerShell script that runs SSH commands on my machine via Windows Task Scheduler, checking every minute. The script checks if WAN1 is UP, and if it’s DOWN, it successfully sends an email alert.
However, I’m wondering how to track the situation when WAN1 is UP, but there’s no internet connection, and the router switches over to WAN2. How can this scenario be detected via SSH commands?
If anyone wants the power-shell script, let me know. it was a pain to get it working had to use chatgpt's help due to parsing errors. long live the gpt! lol
you need putty so that it uses it for ssh connection and create a blank “counterData.json” and smtp for emailing - i have it so that when it triggers outage it sends me email to my “pushover” app via email and pushes notifications on my phone.
My setup is Flint 2 via (main) ethernet and my failover is using via usb (hotspot backup) - you can modify the script as it suits your needs.
For all the others, in Marble, they should be “eth1.1” and “eth.1.2” instead of the ones you posted.
I needed to change the SHA256 as well even if there was no variable at the beginning (you can obtain it after a first succesfull connection via ssh outside of the script) and there is no need to create a blank file json because it will crash if the file is empty, the file will be created itself by the script itself.
I will modify the script to call a callback instead because I want the alert biz logic to be handled by Homey or Home Assistant