Skip to content

Commit f4a8f0e

Browse files
authored
Merge pull request #218 from pimoroni/patch-hostname
Make hostname unique per board.
2 parents f301af3 + 1754dfc commit f4a8f0e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

enviro/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def stop_activity_led():
153153
print(" - -- ---- -----=--==--=== hey enviro, let's go! ===--==--=----- ---- -- - ")
154154
print("")
155155

156-
def reconnect_wifi(ssid, password, country):
156+
def reconnect_wifi(ssid, password, country, hostname=None):
157157
import time
158158
import network
159159
import math
@@ -165,6 +165,11 @@ def reconnect_wifi(ssid, password, country):
165165
# Set country
166166
rp2.country(country)
167167

168+
# Set hostname
169+
if hostname is None:
170+
hostname = f"EnviroW-{helpers.uid()[-4:]}"
171+
network.hostname(hostname)
172+
168173
# Reference: https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf
169174
CYW43_LINK_DOWN = 0
170175
CYW43_LINK_JOIN = 1

0 commit comments

Comments
 (0)