@@ -22,7 +22,7 @@ class InvalidStateError(Exception):
22
22
try :
23
23
from arduino_iot_cloud ._version import __version__
24
24
except (ImportError , AttributeError ):
25
- __version__ = "1.3.0 "
25
+ __version__ = "1.3.1 "
26
26
27
27
# Server/port for basic auth.
28
28
_DEFAULT_SERVER = "iot.arduino.cc"
@@ -199,14 +199,6 @@ def __init__(
199
199
self .async_mode = not sync_mode
200
200
self .connected = False
201
201
202
- if "pin" in ssl_params :
203
- try :
204
- # Use M2Crypto to load key and cert from HSM.
205
- import M2Crypto # noqa
206
- except (ImportError , AttributeError ):
207
- logging .error ("The m2crypto module is required to use HSM." )
208
- sys .exit (1 )
209
-
210
202
# Convert args to bytes if they are passed as strings.
211
203
if isinstance (device_id , str ):
212
204
device_id = bytes (device_id , "utf-8" )
@@ -372,9 +364,11 @@ def poll_discovery(self, aiot=None):
372
364
self .mqtt .subscribe (self .create_topic ("shadow" , "i" ), qos = 1 )
373
365
self .mqtt .publish (self .create_topic ("shadow" , "o" ), self .senmlpack .to_cbor (), qos = 1 )
374
366
375
- # Push library version and mode.
376
- libv = "%s-%s" % (__version__ , "async" if self .async_mode else "sync" )
377
- self .mqtt .publish (self .command_topic , cbor2 .dumps (cbor2 .CBORTag (67328 , [libv ])), qos = 1 )
367
+ if hasattr (cbor2 , "dumps" ):
368
+ # Push library version and mode.
369
+ libv = "%s-%s" % (__version__ , "async" if self .async_mode else "sync" )
370
+ # Note we have to add the tag manually because python-ecosys's cbor2 doesn't suppor CBORTags.
371
+ self .mqtt .publish (self .command_topic , b"\xda \x00 \x01 \x07 \x00 " + cbor2 .dumps ([libv ]), qos = 1 )
378
372
logging .info ("Device configured via discovery protocol." )
379
373
if self .async_mode :
380
374
raise DoneException ()
0 commit comments