Skip to main content

system.kanoa.asset.addAsset(assetInfo, userId)

Add a new asset. All assetInfo keys are required


Parameters

assetInfo Dictionary

- assetGroupIdIntegerId of asset group. Can be None
- assetNameStringName of asset
- assetTypeIdIntegerId of asset type. Required
- enabledBoolean
- oeeEnabledBooleanSet to True if state and count data will be collected for this asset
- parentIdIntegerId of parent asset. Can be None
- processTypeIdIntegerId of process type i.e. whether this asset is a discrete, continuous or batch process. Can be None
- sortOrderInteger
- timeZoneStringi.e 'Pacific Standard Time'. Only needed at the site level

userId Integer:Id of the user executing the function


Returns

assetId Integer
message String None if success


Example

userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
assetTypeId = system.kanoa.utilities.getFieldValue('assetTypeId', system.kanoa.asset.getAssetTypes({'assetTypeName': 'enterprise'}))
assetInfo = {
'assetName': 'New Enterprise',
'parentId': None,
'assetTypeId': 1,
'assetGroupId': None,
'oeeEnabled': False,
'processTypeId': None,
'sortOrder': 1,
'enabled': True,
'timeZone': None
}
assetId, msg = system.kanoa.asset.addAsset(assetInfo, userId)
print assetId, msg
>>> 2076, None