system.mes.meter.validateMeterConfiguration
Description
Validates the specified parameters for a Meter Configuration record and returns any validation errors. This only checks if the Meter Configuration object can be saved based on the attributes given. It does not persist the record.
Permissions
This method requires the METERING.READ.VALIDATE permission.
Syntax
system.mes.meter.validateMeterConfiguration(**meterConfigData)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
id | String (ULID) | True | The ULID of the Meter Configuration (optional, for validating an update). |
name | String | False | Display name for this meter configuration. |
description | String | True | Optional description. |
equipmentId | String (ULID) | False | The ULID of the equipment this configuration is attached to. |
maxRecordDurationSeconds | Integer | False | Maximum record duration in seconds. Minimum value: 30. |
maxTimeBetweenExecutionsSeconds | Integer | False | Maximum seconds between data collection executions. Minimum value: 1. |
maxFlushIntervalSeconds | Integer | True | Maximum seconds between database flush operations. Minimum value: 10. |
pruneDays | Integer | True | Number of days to retain completed records before pruning. |
meterTypeId | String (ULID) | False | The ULID of the Meter Type being measured. |
usageExpression | String | False | Ignition expression returning the current usage counter value. |
overflowValue | Double | True | Maximum counter value before rollover. |
costSource | String | False | Source for cost calculation. One of: STATIC, FROM_METER_TYPE, EXPRESSION. |
cost | Double | True | Static cost per unit of measure. |
costExpression | String | True | Ignition expression returning cost per unit. |
costUnitOfMeasureId | String (ULID) | True | The ULID of the unit of measure for cost values. |
notes | String | True | Notes related to the meter configuration. |
enabled | Boolean | True | Indicates if the meter configuration is active and enabled. |
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 object where keys are field names and values are lists of validation violation messages. An empty object indicates no violations.
Code Examples
# Validate a Meter Configuration before saving
meterConfigData = system.mes.meter.newMeterConfiguration()
meterConfigData['name'] = 'Main Panel kWh'
meterConfigData['equipmentId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2D'
meterConfigData['meterTypeId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2E'
meterConfigData['usageExpression'] = '[.]Energy_kWh'
meterConfigData['costSource'] = 'FROM_METER_TYPE'
violations = system.mes.meter.validateMeterConfiguration(**meterConfigData)
# Output any validation violations
print(violations)