-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Monitor wifi connectivity #940
base: main-dev
Are you sure you want to change the base?
Conversation
new process to monitor wifi connectivity
wifi connectivity monitor teslausb_setup_variables.conf parameters
Background for this pull request: I setup Home wifi SSID and enabled AP access point in TeslaUSB. I noticed that TeslaUSB does not automatically connects to home wifi when I return home. But it will successfully connect to home wifi after a reboot. So I setup a monitor script to reboot TeslaUSB if after X consecutive failed checks |
Do a ping test connectivity. Default to ping 8.8.8.8 if ping_host not defined in config
Update with ping host config
pi-gen-sources/00-teslausb-tweaks/files/teslausb_setup_variables.conf.sample
Outdated
Show resolved
Hide resolved
pi-gen-sources/00-teslausb-tweaks/files/teslausb_setup_variables.conf.sample
Outdated
Show resolved
Hide resolved
# TeslaUSB will check wifi connectivity on a 60-seconds internal. | ||
# TeslaUSB will reboot if SSID is in range, but ping failed after WIFI_MAX_FAILS | ||
#export MAX_FAILS = 3 | ||
#export PING_HOST="192.168.1.1" # Host to ping for connectivity; defaults to 8.8.8.8 if unset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should either ping the archive server, or the default gateway.
I think I prefer the latter, because then it would do the right thing (which is nothing) both if the inernet is down or if the archive server is down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this is just a change in the comment?
The current version, the user can specify a host that response to ping. It can be router/gateway/archive server or external ip address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this is just a change in the comment?
I was thinking that the code that actually does the pinging should default to the gateway if PING_HOST is unspecified, i.e. something like : ${PING_HOST:=$(route | grep '^default' | awk '{print $2}')}
and then the user can just leave it unspecified in the config file. That would then also work if the user specified multiple networks to connect to (e.g. home, work, hotspot, etc.)
Rename MAX_FAILS back to WIFI_MAX_FAILS. Support both Networking Manager & WPA Supplicant. Update the monitoring logic so that monitoring will only happen if SSID, WIFI_MAX_FAILS and PING_HOST are defined.
Rename MAX_FAILS back to WIFI_MAX_FAILS. Update descriptions on how wifi monitoring works.
Add a new process for Wifi connectivity check.
If SSID and WIFI_MAX_FAILS are defined, Wi-Fi monitoring is enabled.
Teslausb will check wifi connectivity on a 60-seconds internal.
Teslausb will reboot if SSID is in range, but not connected after WIFI_MAX_FAILS