in src/modules/sitewise/sync-connector-lambda/importer.py [0:0]
def create_iottwinmaker_entities(workspace_id, j_data):
x_entities = all_results(iottwinmaker_client.list_entities,
{"workspaceId": workspace_id},
"entitySummaries")
for entity in j_data.get('entities'):
entity_id = entity.get('entity_id')
found = False
active = False
for x_entity in x_entities:
if x_entity.get("entityId") == entity_id:
found = True
status = x_entity.get("status")
if status:
if 'ACTIVE' == status.get("state"):
active = True
break
if not found:
resp = create_update_entity( True, workspace_id, entity)
elif active:
resp = create_update_entity( False, workspace_id, entity)
else: ## Found but not active
log(entity_id + " is not in active state to update")