mirror of
https://github.com/OpenVoiceOS/OpenVoiceOS
synced 2025-02-03 12:07:46 +01:00
Bump wifi skill
This commit is contained in:
parent
2c6f69505a
commit
f06e49c20f
@ -16,10 +16,13 @@ class WifiConnect(MycroftSkill):
|
||||
# TODO skill settings
|
||||
self.ssid = "OVOS"
|
||||
self.pswd = None
|
||||
self.grace_period = 45
|
||||
self.time_between_checks = 30 # seconds
|
||||
self.wifi_command = "sudo /usr/local/sbin/wifi-connect --portal-ssid {ssid}"
|
||||
if self.pswd:
|
||||
self.wifi_command += " --portal-passphrase {pswd}"
|
||||
if "color" not in self.settings:
|
||||
self.settings["color"] = "#FF0000"
|
||||
|
||||
def initialize(self):
|
||||
self.make_priority()
|
||||
@ -58,6 +61,12 @@ class WifiConnect(MycroftSkill):
|
||||
|
||||
def _watchdog(self):
|
||||
self.monitoring = True
|
||||
output = subprocess.check_output("nmcli connection show | grep wifi",
|
||||
shell=True).decode("utf-8")
|
||||
if output.strip():
|
||||
self.log.info("Detected previously configured wifi, starting "
|
||||
"grace period to allow it to connect")
|
||||
sleep(self.grace_period)
|
||||
while self.monitoring:
|
||||
if self.in_setup:
|
||||
sleep(1) # let setup do it's thing
|
||||
@ -203,6 +212,7 @@ class WifiConnect(MycroftSkill):
|
||||
self.gui["phone_image"] = "1_phone_connect-to-ap.png"
|
||||
self.gui["prompt"] = "Connect to the \nWifi network"
|
||||
self.gui["highlight"] = self.ssid
|
||||
self.gui["color"] = self.settings["color"]
|
||||
self.gui.show_page("prompt.qml")
|
||||
# allow GUI to linger around for a bit, will block the wifi setup loop
|
||||
sleep(2)
|
||||
@ -214,6 +224,7 @@ class WifiConnect(MycroftSkill):
|
||||
self.gui["phone_image"] = "3_phone_choose-wifi.png"
|
||||
self.gui["prompt"] = "Choose the \nWifi network to \nconnect your \ndevice"
|
||||
self.gui["highlight"] = ""
|
||||
self.gui["color"] = self.settings["color"]
|
||||
self.gui.show_page("prompt.qml")
|
||||
# allow GUI to linger around for a bit, will block the wifi setup loop
|
||||
sleep(2)
|
||||
@ -275,3 +286,5 @@ class WifiConnect(MycroftSkill):
|
||||
|
||||
def create_skill():
|
||||
return WifiConnect()
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@ Mycroft.ProportionalDelegate {
|
||||
property var phone: sessionData.phone_image
|
||||
property var prompt: sessionData.prompt
|
||||
property var highlight: sessionData.highlight
|
||||
property var color: sessionData.color
|
||||
|
||||
Row {
|
||||
spacing: spacingUnit
|
||||
@ -70,7 +71,7 @@ Mycroft.ProportionalDelegate {
|
||||
font.weight: Font.Bold
|
||||
font.pixelSize: 36
|
||||
visible: !content.visible
|
||||
color: "#22a7f0"
|
||||
color: root.color
|
||||
text: highlight
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user