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
| Parameter | Type | Nullable | Description |
|---|---|---|---|
| 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:
| Key | Default Value |
|---|---|
id | null |
name | null |
description | null |
equipmentId | null |
equipmentPath | null |
locationPath | null |
maxRecordDurationSeconds | 600 |
maxTimeBetweenExecutionsSeconds | 5 |
maxFlushIntervalSeconds | 30 |
pruneDays | null |
meterTypeId | null |
meterTypeName | null |
usageExpression | null |
overflowValue | null |
costSource | STATIC |
cost | null |
costExpression | null |
usageUnitOfMeasureId | null |
usageUnitOfMeasureName | null |
usageUnitOfMeasureSymbol | null |
costUnitOfMeasureId | null |
costUnitOfMeasureName | null |
costUnitOfMeasureSymbol | null |
notes | null |
enabled | true |
spare1 | null |
spare2 | null |
spare3 | null |
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)