system.mes.meter.validateMeterType
Description
Validates the specified parameters for a Meter Type record and returns any validation errors. This only checks if the Meter Type 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.validateMeterType(**meterTypeData)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
id | String (ULID) | True | The ULID of the Meter Type (optional, for validating an update). |
name | String | False | Display name for this meter type. |
usageUnitOfMeasureId | String (ULID) | False | The ULID of the unit of measure for usage values. |
cost | Double | False | Default cost per unit of measure. |
costUnitOfMeasureId | String (ULID) | False | The ULID of the unit of measure for cost values. |
notes | String | True | Notes related to the meter type. |
enabled | Boolean | True | Indicates if the meter type 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 Type before saving
meterTypeData = system.mes.meter.newMeterType()
meterTypeData['name'] = 'Electricity'
meterTypeData['usageUnitOfMeasureId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2D'
meterTypeData['cost'] = 0.12
meterTypeData['costUnitOfMeasureId'] = '01J9YP3JBR-WQ8GWRR2-8Y879V2E'
violations = system.mes.meter.validateMeterType(**meterTypeData)
# Output any validation violations
print(violations)