system.mes.equipment.saveEquipment
Description
Creates or updates an Equipment record in the system based on the provided parameters.
Permissions
This method requires the EQUIPMENT.WRITE.SAVE permission.
Syntax
system.mes.equipment.saveEquipment(**equipmentData)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
name | String | False | The name of the equipment. |
description | String | True | A description of the equipment. |
equipmentClassId | String (ULID) | False | The ULID of the equipment class this equipment belongs to. |
locationId | String (ULID) | True | The ULID of the location where this equipment is stationed. |
path | String | True | The path of the equipment. |
id | String (ULID) | True | The ULID of the equipment. Used when updating. |
notes | String | True | Notes related to the equipment. |
enabled | Boolean | True | Indicates if the equipment is active. Default value is true. |
spare1 | String | True | Additional field for user-defined context. |
spare2 | String | True | Additional field for user-defined context. |
spare3 | String | True | Additional field for user-defined context. |
Returns
Returns a JSON representation of the saved equipment.
Code Examples
newEquipment = system.mes.equipment.newEquipment()
newEquipment['name'] = 'Pump-101'
newEquipment['description'] = 'Primary feed pump for Line 1.'
newEquipment['equipmentClassId'] = system.mes.equipment.getEquipmentClass('Pumps/CentrifugalPumps')['id']
newEquipment['locationId'] = system.mes.location.getLocation('Plant1/Line1')['id']
savedEquipment = system.mes.equipment.saveEquipment(**newEquipment)
print(savedEquipment)