Skip to main content
Version: V2 (Ignition 8.1)

system.mes.meter.newMeterConfiguration

Description

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

Permissions

This method does not require any permissions.

Syntax

system.mes.meter.newMeterConfiguration()

Parameters

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

Returns

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

KeyDefault Value
idnull
namenull
descriptionnull
equipmentIdnull
equipmentPathnull
locationPathnull
maxRecordDurationSeconds600
maxTimeBetweenExecutionsSeconds5
maxFlushIntervalSeconds30
pruneDaysnull
meterTypeIdnull
meterTypeNamenull
usageExpressionnull
overflowValuenull
costSourceSTATIC
costnull
costExpressionnull
usageUnitOfMeasureIdnull
usageUnitOfMeasureNamenull
usageUnitOfMeasureSymbolnull
costUnitOfMeasureIdnull
costUnitOfMeasureNamenull
costUnitOfMeasureSymbolnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples

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

# Set basic attributes for the new Meter Configuration
newMeterConfig['name'] = 'Main Panel kWh'
newMeterConfig['equipmentId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2D'
newMeterConfig['meterTypeId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2E'
newMeterConfig['usageExpression'] = '[.]Energy_kWh'
newMeterConfig['costSource'] = 'FROM_METER_TYPE'
# (You can continue setting other properties as needed here)

# Save the new Meter Configuration to the system
savedConfig = system.mes.meter.saveMeterConfiguration(**newMeterConfig)

# Output the JSON representation of the saved Meter Configuration
print(savedConfig)