File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ Your `secrets.py` file should look like this:
37
37
``` python
38
38
WIFI_SSID = " " # WiFi network SSID (for MicroPython)
39
39
WIFI_PASS = " " # WiFi network key (for MicroPython)
40
- DEVICE_ID = b " " # Provided by Arduino cloud when creating a device.
41
- SECRET_KEY = b " " # Provided by Arduino cloud when creating a device.
40
+ DEVICE_ID = " " # Provided by Arduino cloud when creating a device.
41
+ SECRET_KEY = " " # Provided by Arduino cloud when creating a device.
42
42
```
43
43
44
44
For more detailed examples and advanced API features, please see the [ examples] ( https://github.com/arduino/arduino-iot-cloud-py/tree/main/examples ) .
Original file line number Diff line number Diff line change @@ -172,10 +172,19 @@ def __init__(
172
172
self .thing_id = None
173
173
self .keepalive = keepalive
174
174
self .last_ping = timestamp ()
175
- self .device_topic = b"/a/d/" + device_id + b"/e/i"
176
175
self .senmlpack = SenmlPack ("" , self .senml_generic_callback )
177
176
self .started = False
178
177
178
+ # Convert args to bytes if they are passed as strings.
179
+ if isinstance (device_id , str ):
180
+ device_id = bytes (device_id , "utf-8" )
181
+ if username is not None and isinstance (username , str ):
182
+ username = bytes (username , "utf-8" )
183
+ if password is not None and isinstance (password , str ):
184
+ password = bytes (password , "utf-8" )
185
+
186
+ self .device_topic = b"/a/d/" + device_id + b"/e/i"
187
+
179
188
# Update RTC from NTP server on MicroPython.
180
189
self .update_systime (ntp_server , ntp_timeout )
181
190
You can’t perform that action at this time.
0 commit comments