multiple evolutions
This commit is contained in:
@@ -15,20 +15,21 @@ if CONNECTION_STRING == "":
|
||||
print("Provide a connection string for the Iot Hub before running the script!")
|
||||
exit(13)
|
||||
|
||||
SITE_NAME = "LIBERTY"
|
||||
SITE_NAME = "Bell"
|
||||
|
||||
|
||||
registry_manager = IoTHubRegistryManager.from_connection_string(CONNECTION_STRING)
|
||||
query_spec = QuerySpecification(query="SELECT * FROM devices WHERE IS_DEFINED(tags.site) AND tags.site = '" + SITE_NAME + "' AND capabilities.iotEdge = true")
|
||||
#query_spec = QuerySpecification(query="SELECT * FROM devices WHERE IS_DEFINED(tags.site) AND tags.site = '" + SITE_NAME + "' AND capabilities.iotEdge = true")
|
||||
query_spec = QuerySpecification(query="SELECT * FROM devices WHERE IS_DEFINED(tags.site) AND tags.site = '" + SITE_NAME + "' AND capabilities.iotEdge = false")
|
||||
|
||||
query_result = registry_manager.query_iot_hub(query_spec)
|
||||
|
||||
devices = []
|
||||
for item in query_result.items:
|
||||
deviceId = str(item.device_id)
|
||||
site = str(item.tags['site'])
|
||||
number = int(item.tags['number'])
|
||||
cloud_version = str(item.tags['version'])
|
||||
site = str(item.tags.get('site')) if item.tags.get('site') else None
|
||||
number = int(item.tags.get('number')) if item.tags.get('number') else None
|
||||
cloud_version = str(item.tags.get('version')) if item.tags.get('version') else None
|
||||
devices.append([deviceId, site, number, cloud_version])
|
||||
|
||||
ordered_devices = sorted(devices, key = lambda x: (x[1], x[2]))
|
||||
|
||||
Reference in New Issue
Block a user