|
@@ -41,7 +41,7 @@ class ChinaIOTClient(IOTObject):
|
|
|
}
|
|
|
return res
|
|
|
|
|
|
- def create_keys_and_certificate(self, uid):
|
|
|
+ def create_keys_and_certificate(self, uid, device_version):
|
|
|
result = self.client.create_keys_and_certificate(setAsActive=True)
|
|
|
res = {
|
|
|
'certificateId': result['certificateId'],
|
|
@@ -71,7 +71,9 @@ class ChinaIOTClient(IOTObject):
|
|
|
"Type": "AWS::IoT::Thing",
|
|
|
"Properties": {
|
|
|
"AttributePayload": {},
|
|
|
- "ThingGroups": [],
|
|
|
+ "ThingGroups": {
|
|
|
+ "Ref": "ThingGroups"
|
|
|
+ },
|
|
|
"ThingName": {
|
|
|
"Ref": "ThingName"
|
|
|
},
|
|
@@ -100,6 +102,7 @@ class ChinaIOTClient(IOTObject):
|
|
|
|
|
|
templateBody = json.dumps(templateBody)
|
|
|
parameters = {"ThingName": "Ansjer_Device_" + uid,
|
|
|
+ "ThingGroups": device_version,
|
|
|
"AWS::IoT::Certificate::Id": res['certificateId']}
|
|
|
self.client.register_thing(
|
|
|
templateBody=templateBody,
|
|
@@ -128,7 +131,7 @@ class AmericaIOTClient(IOTObject):
|
|
|
}
|
|
|
return res
|
|
|
|
|
|
- def create_keys_and_certificate(self, uid):
|
|
|
+ def create_keys_and_certificate(self, uid, device_version):
|
|
|
result = self.client.create_keys_and_certificate(setAsActive=True)
|
|
|
res = {
|
|
|
'certificateId': result['certificateId'],
|
|
@@ -158,7 +161,9 @@ class AmericaIOTClient(IOTObject):
|
|
|
"Type": "AWS::IoT::Thing",
|
|
|
"Properties": {
|
|
|
"AttributePayload": {},
|
|
|
- "ThingGroups": [],
|
|
|
+ "ThingGroups": {
|
|
|
+ "Ref": "ThingGroups"
|
|
|
+ },
|
|
|
"ThingName": {
|
|
|
"Ref": "ThingName"
|
|
|
},
|
|
@@ -187,6 +192,7 @@ class AmericaIOTClient(IOTObject):
|
|
|
|
|
|
templateBody = json.dumps(templateBody)
|
|
|
parameters = {"ThingName": "Ansjer_Device_" + uid,
|
|
|
+ "ThingGroups": device_version,
|
|
|
"AWS::IoT::Certificate::Id": res['certificateId']}
|
|
|
self.client.register_thing(
|
|
|
templateBody=templateBody,
|
|
@@ -214,7 +220,7 @@ class AsiaIOTClient(IOTObject):
|
|
|
}
|
|
|
return res
|
|
|
|
|
|
- def create_keys_and_certificate(self, uid):
|
|
|
+ def create_keys_and_certificate(self, uid, device_version):
|
|
|
result = self.client.create_keys_and_certificate(setAsActive=True)
|
|
|
res = {
|
|
|
'certificateId': result['certificateId'],
|
|
@@ -244,7 +250,9 @@ class AsiaIOTClient(IOTObject):
|
|
|
"Type": "AWS::IoT::Thing",
|
|
|
"Properties": {
|
|
|
"AttributePayload": {},
|
|
|
- "ThingGroups": [],
|
|
|
+ "ThingGroups": {
|
|
|
+ "Ref": "ThingGroups"
|
|
|
+ },
|
|
|
"ThingName": {
|
|
|
"Ref": "ThingName"
|
|
|
},
|
|
@@ -273,6 +281,7 @@ class AsiaIOTClient(IOTObject):
|
|
|
|
|
|
templateBody = json.dumps(templateBody)
|
|
|
parameters = {"ThingName": "Ansjer_Device_" + uid,
|
|
|
+ "ThingGroups": device_version,
|
|
|
"AWS::IoT::Certificate::Id": res['certificateId']}
|
|
|
self.client.register_thing(
|
|
|
templateBody=templateBody,
|
|
@@ -300,7 +309,7 @@ class EuropeIOTClient(IOTObject):
|
|
|
}
|
|
|
return res
|
|
|
|
|
|
- def create_keys_and_certificate(self, uid):
|
|
|
+ def create_keys_and_certificate(self, uid, device_version):
|
|
|
result = self.client.create_keys_and_certificate(setAsActive=True)
|
|
|
res = {
|
|
|
'certificateId': result['certificateId'],
|
|
@@ -330,7 +339,9 @@ class EuropeIOTClient(IOTObject):
|
|
|
"Type": "AWS::IoT::Thing",
|
|
|
"Properties": {
|
|
|
"AttributePayload": {},
|
|
|
- "ThingGroups": [],
|
|
|
+ "ThingGroups": {
|
|
|
+ "Ref": "ThingGroups"
|
|
|
+ },
|
|
|
"ThingName": {
|
|
|
"Ref": "ThingName"
|
|
|
},
|
|
@@ -359,6 +370,7 @@ class EuropeIOTClient(IOTObject):
|
|
|
|
|
|
templateBody = json.dumps(templateBody)
|
|
|
parameters = {"ThingName": "Ansjer_Device_" + uid,
|
|
|
+ "ThingGroups": device_version,
|
|
|
"AWS::IoT::Certificate::Id": res['certificateId']}
|
|
|
self.client.register_thing(
|
|
|
templateBody=templateBody,
|