mirror of
https://github.com/OpenVoiceOS/OpenVoiceOS
synced 2025-04-17 20:07:23 +02:00
Bump wifi skill (again again)
This commit is contained in:
parent
74ca185bc0
commit
f36b651595
@ -26,8 +26,8 @@ class WifiConnect(MycroftSkill):
|
|||||||
self.settings["color"] = "#FF0000"
|
self.settings["color"] = "#FF0000"
|
||||||
if "stop_on_internet" not in self.settings:
|
if "stop_on_internet" not in self.settings:
|
||||||
self.settings["stop_on_internet"] = False
|
self.settings["stop_on_internet"] = False
|
||||||
if "increase_timeout_on_internet" not in self.settings:
|
if "timeout_after_internet" not in self.settings:
|
||||||
self.settings["increase_timeout_on_internet"] = 60
|
self.settings["timeout_after_internet"] = 90
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.make_priority()
|
self.make_priority()
|
||||||
@ -65,10 +65,13 @@ class WifiConnect(MycroftSkill):
|
|||||||
self.monitoring = False
|
self.monitoring = False
|
||||||
|
|
||||||
def _watchdog(self):
|
def _watchdog(self):
|
||||||
|
try:
|
||||||
self.monitoring = True
|
self.monitoring = True
|
||||||
output = subprocess.check_output("nmcli connection show | grep wifi",
|
self.log.info("Wifi watchdog started")
|
||||||
|
output = subprocess.check_output("nmcli connection show",
|
||||||
shell=True).decode("utf-8")
|
shell=True).decode("utf-8")
|
||||||
if output.strip():
|
self.log.warning(output)
|
||||||
|
if "wifi" in output:
|
||||||
self.log.info("Detected previously configured wifi, starting "
|
self.log.info("Detected previously configured wifi, starting "
|
||||||
"grace period to allow it to connect")
|
"grace period to allow it to connect")
|
||||||
sleep(self.grace_period)
|
sleep(self.grace_period)
|
||||||
@ -87,14 +90,11 @@ class WifiConnect(MycroftSkill):
|
|||||||
self.log.exception(e)
|
self.log.exception(e)
|
||||||
else:
|
else:
|
||||||
self.log.warning("CONNECTED TO WIFI, BUT NO INTERNET!!")
|
self.log.warning("CONNECTED TO WIFI, BUT NO INTERNET!!")
|
||||||
elif not self.connected:
|
|
||||||
# once first connected to internet increase time between checks
|
|
||||||
self.connected = True
|
|
||||||
self.time_between_checks += self.settings["increase_timeout_on_internet"]
|
|
||||||
# stop watchdog on internet connection
|
|
||||||
if self.settings["stop_on_internet"]:
|
|
||||||
self.monitoring = False
|
|
||||||
sleep(self.time_between_checks)
|
sleep(self.time_between_checks)
|
||||||
|
except Exception as e:
|
||||||
|
self.log.error("Wifi watchdog crashed unexpectedly")
|
||||||
|
self.log.exception(e)
|
||||||
|
|
||||||
# wifi setup
|
# wifi setup
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -243,6 +243,12 @@ class WifiConnect(MycroftSkill):
|
|||||||
|
|
||||||
def report_setup_complete(self, message=None):
|
def report_setup_complete(self, message=None):
|
||||||
"""Wifi setup complete, network is connected."""
|
"""Wifi setup complete, network is connected."""
|
||||||
|
# once first connected to internet increase time between checks
|
||||||
|
self.connected = True
|
||||||
|
self.time_between_checks = self.settings["timeout_after_internet"]
|
||||||
|
# stop watchdog on internet connection
|
||||||
|
if self.settings["stop_on_internet"]:
|
||||||
|
self.monitoring = False
|
||||||
self.gui.remove_page("prompt.qml")
|
self.gui.remove_page("prompt.qml")
|
||||||
self.gui.clear()
|
self.gui.clear()
|
||||||
self.gui["icon"] = "check-circle.svg"
|
self.gui["icon"] = "check-circle.svg"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user