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:
3737``` python
3838WIFI_SSID = " " # WiFi network SSID (for MicroPython)
3939WIFI_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.
4242```
4343
4444For 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__(
172172 self .thing_id = None
173173 self .keepalive = keepalive
174174 self .last_ping = timestamp ()
175- self .device_topic = b"/a/d/" + device_id + b"/e/i"
176175 self .senmlpack = SenmlPack ("" , self .senml_generic_callback )
177176 self .started = False
178177
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+
179188 # Update RTC from NTP server on MicroPython.
180189 self .update_systime (ntp_server , ntp_timeout )
181190
You can’t perform that action at this time.
0 commit comments