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
| Parameter | Type | Nullable | Description |
|---|---|---|---|
| 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:
| Key | Default Value |
|---|---|
id | null |
name | null |
usageUnitOfMeasureId | null |
usageUnitOfMeasureName | null |
usageUnitOfMeasureSymbol | null |
cost | 0.0 |
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 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)