Skip to main content
Version: V3 (Ignition 8.3)

system.mes.meter.newMeterType

Description​

Generates an empty non-persisted Meter Type object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveMeterType method in order to persist the record.

Permissions​

This method does not require any permissions.

Syntax​

system.mes.meter.newMeterType()

Parameters​

ParameterTypeNullableDescription
None--This method does not take any parameters.

Returns​

Returns a JSON representation of the newly created Meter Type object. The following is a list of keys and default values:

KeyDefault Value
idnull
namenull
usageUnitOfMeasureIdnull
usageUnitOfMeasureNamenull
usageUnitOfMeasureSymbolnull
cost0.0
costUnitOfMeasureIdnull
costUnitOfMeasureNamenull
costUnitOfMeasureSymbolnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples​

# Generate the object structure for a new Meter Type with no initial arguments
newMeterType = system.mes.meter.newMeterType()

# Set basic attributes for the new Meter Type
newMeterType['name'] = 'Electricity'
newMeterType['usageUnitOfMeasureId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2D'
newMeterType['cost'] = 0.12
newMeterType['costUnitOfMeasureId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2E'
# (You can continue setting other properties as needed here)

# Save the new Meter Type to the system
savedMeterType = system.mes.meter.saveMeterType(**newMeterType)

# Output the JSON representation of the saved Meter Type
print(savedMeterType)