Skip to content

Commit d7ea3ea

Browse files
committed
Fix interface env var type
1 parent 19be199 commit d7ea3ea

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ If you need to disable this feature to allow the LED to be used for other purpos
5959

6060
## Endpoints
6161
### http://your-device:9090/v1/connect
62-
Connect to a nearby Wi-Fi access point.
62+
Connect to a nearby Wi-Fi access point. Once connected the device will automatically connect to the same network on next boot until you call the `/forget` endpoint.
6363

6464
#### POST
6565
````

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
#PWC_AC_PASSWORD: "your-password" # Optional. Must be 8 characters or more.
1818

1919
## Wi-Fi Interface ##
20-
# PWC_INTERFACE: 'wlan0' # When disabled interface is auto detected
20+
# PWC_INTERFACE: "wlan0" # When disabled interface is auto detected
2121

2222
## Enable/Disable LED interaction ##
2323
PWC_LED: "ON"

src/common/wifi.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,9 @@ def connect(conn_type=config.type_hotspot,
121121
Pnm.Settings.AddConnection(conn_dict)
122122
logger.info(f"Adding connection of type {conn_type}")
123123

124-
# Save the wi-fi device object to a variable
125-
dev = get_device()
126-
127124
# Connect
128125
Pnm.NetworkManager.ActivateConnection(get_connection_id(),
129-
dev,
126+
get_device(),
130127
"/")
131128

132129
# If not a hotspot, log the connection SSID being attempted
@@ -253,12 +250,9 @@ def list_access_points():
253250
logger.debug('Fetching Wi-Fi networks.')
254251

255252
try:
256-
# Fetch dictionary of devices
257-
dev = get_device()
258-
259253
# For each wi-fi connection in range, identify it's details
260254
compiled_ssids = [analyse_access_point(ap)
261-
for ap in dev.GetAccessPoints()]
255+
for ap in get_device().GetAccessPoints()]
262256
except Exception:
263257
logger.exception('Failed listing access points.')
264258
raise WifiNetworkManagerError

src/config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import json
21
import os
32

43
# Set default Wi-Fi SSID.
@@ -39,7 +38,7 @@
3938

4039
# Set default interface
4140
if "PWC_INTERFACE" in os.environ and \
42-
json.loads(os.environ['PWC_INTERFACE']) is not False:
41+
os.environ['PWC_INTERFACE'].lower() != 'false':
4342
interface = os.environ['PWC_INTERFACE']
4443
else:
4544
interface = False

0 commit comments

Comments
 (0)