Skip to content

Commit 1879edd

Browse files
authored
Merge pull request #30 from bcmi-labs/fix_urls
ucloud: Fix default URL to work with Nina firmware.
2 parents 69b3773 + b47977b commit 1879edd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

arduino_iot_cloud/ucloud.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@
3333
from asyncio import CancelledError
3434
from asyncio import InvalidStateError
3535
except ImportError:
36+
import ntptime
3637
import ulogging as logging
3738
import uasyncio as asyncio
38-
from arduino_iot_cloud import ntptime
3939
from uasyncio.core import CancelledError
4040

4141
# MicroPython doesn't have this exception
4242
class InvalidStateError(Exception):
4343
pass
4444

4545
# Server/port for basic auth.
46-
_DEFAULT_UP_SERVER = ("mqtts-up.iot.arduino.cc", 8884)
46+
_DEFAULT_SERVER = "iot.arduino.cc"
4747

48-
# Default server/port for key/cert auth.
49-
_DEFAULT_SA_SERVER = ("mqtts-sa.iot.arduino.cc", 8883)
48+
# Default port for cert based auth and basic auth.
49+
_DEFAULT_PORT = (8883, 8884)
5050

5151

5252
def timestamp():
@@ -198,16 +198,17 @@ def __init__(
198198
if "certfile" in ssl_params and "der" in ssl_params["certfile"]:
199199
with open(ssl_params.pop("certfile"), "rb") as f:
200200
ssl_params["cert"] = f.read()
201+
201202
if "ca_certs" in ssl_params and "der" in ssl_params["ca_certs"]:
202203
with open(ssl_params.pop("ca_certs"), "rb") as f:
203204
ssl_params["cadata"] = f.read()
204205

205206
# If no server/port were passed in args, set the default server/port
206207
# based on authentication type.
207208
if server is None:
208-
server = _DEFAULT_SA_SERVER[0] if password is None else _DEFAULT_UP_SERVER[0]
209+
server = _DEFAULT_SERVER
209210
if port is None:
210-
port = _DEFAULT_SA_SERVER[1] if password is None else _DEFAULT_UP_SERVER[1]
211+
port = _DEFAULT_PORT[0] if password is None else _DEFAULT_PORT[1]
211212

212213
# Create MQTT client.
213214
self.mqtt = MQTTClient(

0 commit comments

Comments
 (0)