mirror of
				https://github.com/OpenVoiceOS/OpenVoiceOS
				synced 2025-06-05 22:19:21 +02:00 
			
		
		
		
	Bump wifi skill
This commit is contained in:
		| @@ -16,10 +16,13 @@ class WifiConnect(MycroftSkill): | |||||||
|         # TODO skill settings |         # TODO skill settings | ||||||
|         self.ssid = "OVOS" |         self.ssid = "OVOS" | ||||||
|         self.pswd = None |         self.pswd = None | ||||||
|  |         self.grace_period = 45 | ||||||
|         self.time_between_checks = 30  # seconds |         self.time_between_checks = 30  # seconds | ||||||
|         self.wifi_command = "sudo /usr/local/sbin/wifi-connect --portal-ssid {ssid}" |         self.wifi_command = "sudo /usr/local/sbin/wifi-connect --portal-ssid {ssid}" | ||||||
|         if self.pswd: |         if self.pswd: | ||||||
|             self.wifi_command += " --portal-passphrase {pswd}" |             self.wifi_command += " --portal-passphrase {pswd}" | ||||||
|  |         if "color" not in self.settings: | ||||||
|  |             self.settings["color"] = "#FF0000" | ||||||
|  |  | ||||||
|     def initialize(self): |     def initialize(self): | ||||||
|         self.make_priority() |         self.make_priority() | ||||||
| @@ -58,6 +61,12 @@ class WifiConnect(MycroftSkill): | |||||||
|  |  | ||||||
|     def _watchdog(self): |     def _watchdog(self): | ||||||
|         self.monitoring = True |         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: |         while self.monitoring: | ||||||
|             if self.in_setup: |             if self.in_setup: | ||||||
|                 sleep(1)  # let setup do it's thing |                 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["phone_image"] = "1_phone_connect-to-ap.png" | ||||||
|         self.gui["prompt"] = "Connect to the \nWifi network" |         self.gui["prompt"] = "Connect to the \nWifi network" | ||||||
|         self.gui["highlight"] = self.ssid |         self.gui["highlight"] = self.ssid | ||||||
|  |         self.gui["color"] = self.settings["color"] | ||||||
|         self.gui.show_page("prompt.qml") |         self.gui.show_page("prompt.qml") | ||||||
|         # allow GUI to linger around for a bit, will block the wifi setup loop |         # allow GUI to linger around for a bit, will block the wifi setup loop | ||||||
|         sleep(2) |         sleep(2) | ||||||
| @@ -214,6 +224,7 @@ class WifiConnect(MycroftSkill): | |||||||
|         self.gui["phone_image"] = "3_phone_choose-wifi.png" |         self.gui["phone_image"] = "3_phone_choose-wifi.png" | ||||||
|         self.gui["prompt"] = "Choose the \nWifi network to \nconnect your \ndevice" |         self.gui["prompt"] = "Choose the \nWifi network to \nconnect your \ndevice" | ||||||
|         self.gui["highlight"] = "" |         self.gui["highlight"] = "" | ||||||
|  |         self.gui["color"] = self.settings["color"] | ||||||
|         self.gui.show_page("prompt.qml") |         self.gui.show_page("prompt.qml") | ||||||
|         # allow GUI to linger around for a bit, will block the wifi setup loop |         # allow GUI to linger around for a bit, will block the wifi setup loop | ||||||
|         sleep(2) |         sleep(2) | ||||||
| @@ -275,3 +286,5 @@ class WifiConnect(MycroftSkill): | |||||||
|  |  | ||||||
| def create_skill(): | def create_skill(): | ||||||
|     return WifiConnect() |     return WifiConnect() | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ Mycroft.ProportionalDelegate { | |||||||
|     property var phone: sessionData.phone_image |     property var phone: sessionData.phone_image | ||||||
|     property var prompt: sessionData.prompt |     property var prompt: sessionData.prompt | ||||||
|     property var highlight: sessionData.highlight |     property var highlight: sessionData.highlight | ||||||
|  |     property var color: sessionData.color | ||||||
|  |  | ||||||
|     Row { |     Row { | ||||||
|         spacing: spacingUnit |         spacing: spacingUnit | ||||||
| @@ -70,7 +71,7 @@ Mycroft.ProportionalDelegate { | |||||||
|                 font.weight: Font.Bold |                 font.weight: Font.Bold | ||||||
|                 font.pixelSize: 36 |                 font.pixelSize: 36 | ||||||
|                 visible: !content.visible |                 visible: !content.visible | ||||||
|                 color: "#22a7f0" |                 color: root.color | ||||||
|                 text: highlight |                 text: highlight | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user