# How to create Equipment State Class using scripting in Ignition

**URL:** <https://forum.inductiveautomation.com/t/how-to-create-equipment-state-class-using-scripting-in-ignition/98556>\
**Category:** 3rd Party Modules\
**Tags:** sepasoft, scripting, perspective\
**Created:** [November 13, 2024, 9:52am UTC](https://forum.inductiveautomation.com/t/how-to-create-equipment-state-class-using-scripting-in-ignition/98556 "2024-11-13T09:52:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SOUBHAGYA\_PRUSTY](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@SOUBHAGYA\_PRUSTY](https://forum.inductiveautomation.com/u/SOUBHAGYA_PRUSTY)\
**Post date:** [November 13, 2024, 9:52am UTC](https://forum.inductiveautomation.com/t/how-to-create-equipment-state-class-using-scripting-in-ignition/98556/1 "2024-11-13T09:52:15Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/ef164966b261bfe87311ae9a09e39581b3d3a839.png)  
How to create equipment state class inside the "Equipment States" using scripting in sepasoft.

Above image is of Equipment Manager OEE State Class

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [November 13, 2024, 10:27am UTC](https://forum.inductiveautomation.com/t/how-to-create-equipment-state-class-using-scripting-in-ignition/98556/2 "2024-11-13T10:27:29Z")

</div>

Following example from Sepasoft user manual.  
[https://docs.sepasoft.com/articles/#!user-manual/mes-equipment-state/a/MESEquipmentState-eqstateObjectCreation](https://docs.sepasoft.com/articles/#!user-manual/mes-equipment-state/a/MESEquipmentState-eqstateObjectCreation)

```python
stateCls = system.mes.loadMESObject('YourStateClass','EquipmentStateClass')
#insert the name of your State Class here
name = 'YourStateName'
code = 12 #this is the state code provided by your PLC
state = system.mes.createMESObject('EquipmentState')
stateCls.addChild(state)
state.setPropertyValue('Name', name)
state.setPropertyValue('EquipmentStateCode', code)
state.setPropertyValue('EquipmentStateType', 'Unplanned Downtime')
#valid values for EquipmentStateType: "Running", "Idle", "Blocked", "Starved", "Planned Downtime", "Unplanned Downtime", "Disabled"
state.setPropertyValue('EquipmentStateOverride', 'Optional')
state.setPropertyValue('EquipmentStateOverrideScope', 'Detected Equipment State')
stateObjList = system.mes.object.list.createList()
stateObjList.add(stateCls)
stateObjList.add(state)
system.mes.saveMESObjects(stateObjList)

```

---

<div class="post-metadata">

**Author:** ![vpat0023](https://avatars.discourse-cdn.com/v4/letter/v/47e85d/32.png) [@vpat0023](https://forum.inductiveautomation.com/u/vpat0023)\
**Post date:** [May 31, 2026, 10:13pm UTC](https://forum.inductiveautomation.com/t/how-to-create-equipment-state-class-using-scripting-in-ignition/98556/3 "2026-05-31T22:13:36Z")

</div>

Was this successful for you guys?

`state.setPropertyValue('Name', name)`, is unable to set the name of the state because of which I can't even save it as an MES object.

Would appreciate any help as I have to add a lot of states and doing it using the UI is a pain.

Thanks.

---

<div class="post-metadata">

**Author:** ![Ujwal\_Wankhede](https://avatars.discourse-cdn.com/v4/letter/u/4af34b/32.png) [@Ujwal\_Wankhede](https://forum.inductiveautomation.com/u/Ujwal_Wankhede)\
**Post date:** [June 1, 2026, 4:32am UTC](https://forum.inductiveautomation.com/t/how-to-create-equipment-state-class-using-scripting-in-ignition/98556/4 "2026-06-01T04:32:59Z")

</div>

Yes. I implemented the exact code to import multiple states from a csv file.  
Can you share error description?
