@@ -57,18 +57,24 @@ def user_task(client):
57
57
level = logging .DEBUG if args .debug else logging .INFO ,
58
58
)
59
59
60
+
60
61
# Create a client object to connect to the Arduino IoT cloud.
61
- # To use a secure element, set the token's "pin" and URI in "keyfile" and "certfile", and
62
- # the CA certificate (if any) in "ssl_params". Alternatively, a username and password can
63
- # be used to authenticate, for example:
64
- # client = ArduinoCloudClient(device_id=DEVICE_ID, username=DEVICE_ID, password=SECRET_KEY)
65
- client = ArduinoCloudClient (
66
- device_id = DEVICE_ID ,
67
- ssl_params = {
68
- "pin" : "1234" ,
69
- "keyfile" : KEY_PATH , "certfile" : CERT_PATH , "ca_certs" : CA_PATH , "cert_reqs" : ssl .CERT_REQUIRED
70
- },
71
- )
62
+ # The most basic authentication method uses a username and password. The username is the device
63
+ # ID, and the password is the secret key obtained from the IoT cloud when provisioning a device.
64
+ client = ArduinoCloudClient (device_id = DEVICE_ID , username = DEVICE_ID , password = SECRET_KEY )
65
+
66
+ # Alternatively, the client also supports key and certificate-based authentication. To use this
67
+ # mode, set "keyfile" and "certfile", and the CA certificate (if any) in "ssl_params".
68
+ # Furthermore, secure elements, which can be used to store the key and cert, are also supported.
69
+ # To secure elements, set "use_hsm" to True in "ssl_params" and set the token's "pin" if any.
70
+ #client = ArduinoCloudClient(
71
+ # device_id=DEVICE_ID,
72
+ # ssl_params={
73
+ # "use_hsm": True, "pin": "1234",
74
+ # "keyfile": KEY_PATH, "certfile": CERT_PATH, "cafile": CA_PATH,
75
+ # "verify_mode": ssl.CERT_REQUIRED, "server_hostname" : "iot.arduino.cc"
76
+ # },
77
+ #)
72
78
73
79
# Register cloud objects.
74
80
# Note: The following objects must be created first in the dashboard and linked to the device.
0 commit comments