PM1
The PM1 component handles electrical power metering capabilities. It uses PM1
as the RPC namespace and provides the methods:
PM1.SetConfig
to update the component's configurationPM1.GetConfig
to obtain the component's configurationPM1.GetStatus
to obtain the component's statusPM1.ResetCounters
to reset component's energy counters
PM1 components are identified with PM1:<id>
in objects containing multiple component payloads.
Methods
PM1.SetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the PM1 component instance |
| object | Configuration that the method takes |
Find more about the config properties in config section
PM1.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the PM1 component instance |
Find the PM1.GetConfig response properties in config section
PM1.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the PM1 component instance |
Find more about the status response properties in status section
PM1.ResetCounters
This method resets associated counters.
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Id of the PM1 component instance. Required |
| array of strings | Array of strings, selects which counter to reset Optional |
If no 'type' is provided, the method will reset all available counters.
Response
Attributes in the result:
Property | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
| object | Information about the active energy counter prior to reset
| ||||||
| object | Information about the returned active energy counter prior to reset
|
Configuration
The configuration of the PM1 component contains information about the id and name of the component.
Property | Type | Description |
---|---|---|
| number | Id of the PM1 component instance |
| string or null | Name of the PM1 instance |
| bool | Reverse measurement direction of active power and energy for the PM1 component. setting the reverse option requires restart |
Status
The status of the PM1 component contains information about the measured variables. To obtain the status of the PM1 component its id
must be specified.
Property | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the PM1 component instance | ||||||||||||
| number | Last measured voltage in Volts | ||||||||||||
| number | Last measured current in Amperes | ||||||||||||
| number | Last measured instantaneous active power (in Watts) delivered to the attached load | ||||||||||||
| number | Last measured instantaneous apparent power (in Volt-Amperes) delivered to the attached load (shown if applicable) | ||||||||||||
| number | Last measured power factor (shown if applicable) | ||||||||||||
| number | Last measured network frequency (shown if applicable) | ||||||||||||
| object | Information about the active energy counter
| ||||||||||||
| object | Information about the returned active energy counter
| ||||||||||||
| array of type string | Error conditions occurred. May contain |
Webhook Events
PM1 component supports conditional webhooks.
Events related to the PM1 component that can trigger webhooks:
voltage_change
- when the voltage has changed with at least 1V and 5% from the last reported value.voltage_change
event supports attributes, that can be used to compose conditional webhooks:Property Type Description voltage
number
New voltage in Volts
current_change
- when the current has changed with at least 0.05A and 5% from the last reported value.current_change
event supports attributes, that can be used to compose conditional webhooks:Property Type Description current
number
New current in Amps
apower_change
- when the active power has changed with at least 1W and 5% from the last reported value.apower_change
event supports attributes, that can be used to compose conditional webhooks:Property Type Description apower
number
New active power in Watts
Examples
PM1.SetConfig example
- PM1.SetConfig HTTP GET Request
- PM1.SetConfig Curl Request
- PM1.SetConfig Mos Request
http://192.168.33.1/rpc/PM1.SetConfig?id=0&config={"name":"Meter","reverse":true}
curl -X POST -d '{"id":1,"method":"PM1.SetConfig","params":{"id":0,"config":{"name":"Meter","reverse":true}}}' http://${SHELLY}/rpc
mos --port ${PORT} call PM1.SetConfig '{"id":0,"config":{"name":"Meter","reverse":true}}'
Response
- PM1.SetConfig HTTP GET Response
- PM1.SetConfig Curl Response
- PM1.SetConfig Mos Response
{
"restart_required": true
}
{
"id": 1,
"params": {
"restart_required": true
}
}
{
"restart_required": true
}
PM1.GetConfig example
- PM1.GetConfig HTTP GET Request
- PM1.GetConfig Curl Request
- PM1.GetConfig Mos Request
http://192.168.33.1/rpc/PM1.GetConfig?id=0
curl -X POST -d '{"id":1,"method":"PM1.GetConfig","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call PM1.GetConfig '{"id":0}'
Response
- PM1.GetConfig HTTP GET Response
- PM1.GetConfig Curl Response
- PM1.GetConfig Mos Response
{
"id": 0,
"name": "PM1device",
"reverse": false
}
{
"id": 1,
"params": {
"id": 0,
"name": "PM1device",
"reverse": false
}
}
{
"id": 0,
"name": "PM1device",
"reverse": false
}
PM1.GetStatus example
- PM1.GetStatus HTTP GET Request
- PM1.GetStatus Curl Request
- PM1.GetStatus Mos Request
http://192.168.33.1/rpc/PM1.GetStatus?id=0
curl -X POST -d '{"id":1,"method":"PM1.GetStatus","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call PM1.GetStatus '{"id":0}'
Response
- PM1.GetStatus HTTP GET Response
- PM1.GetStatus Curl Response
- PM1.GetStatus Mos Response
{
"id": 0,
"voltage": 225.9,
"current": 0,
"apower": 0,
"freq": 50,
"aenergy": {
"total": 11.679,
"by_minute": [
0,
0,
0
],
"minute_ts": 1654511972
},
"ret_aenergy": {
"total": 4.126,
"by_minute": [
0,
0,
0
],
"minute_ts": 1654511318
},
"errors": [
"power_meter_failure",
"out_of_range:voltage",
"out_of_range:current",
"out_of_range:apower",
"out_of_range:aprtpower"
]
}
{
"id": 1,
"src": "shellyplus1pm-441793ce3f08",
"params": {
"id": 0,
"voltage": 225.9,
"current": 0,
"apower": 0,
"freq": 50,
"aenergy": {
"total": 11.679,
"by_minute": [
0,
0,
0
],
"minute_ts": 1654511972
},
"ret_aenergy": {
"total": 4.126,
"by_minute": [
0,
0,
0
],
"minute_ts": 1654511318
},
"errors": [
"power_meter_failure",
"out_of_range:voltage",
"out_of_range:current",
"out_of_range:apower",
"out_of_range:aprtpower"
]
}
}
{
"id": 0,
"voltage": 225.9,
"current": 0,
"apower": 0,
"freq": 50,
"aenergy": {
"total": 11.679,
"by_minute": [
0,
0,
0
],
"minute_ts": 1654511972
},
"ret_aenergy": {
"total": 4.126,
"by_minute": [
0,
0,
0
],
"minute_ts": 1654511318
},
"errors": [
"power_meter_failure",
"out_of_range:voltage",
"out_of_range:current",
"out_of_range:apower",
"out_of_range:aprtpower"
]
}
PM1.ResetCounters example
- PM1.ResetCounters HTTP GET Request
- PM1.ResetCounters Curl Request
- PM1.ResetCounters Mos Request
http://192.168.33.1/rpc/PM1.ResetCounters?id=0&type=["aenergy","ret_aenergy"]
curl -X POST -d '{"id":1,"method":"PM1.ResetCounters","params":{"id":0,"type":["aenergy","ret_aenergy"]}}' http://${SHELLY}/rpc
mos --port ${PORT} call PM1.ResetCounters '{"id":0,"type":["aenergy","ret_aenergy"]}'
Response
- PM1.ResetCounters HTTP GET Response
- PM1.ResetCounters Curl Response
- PM1.ResetCounters Mos Response
{
"aenergy": {
"total": 11.679
},
"ret_aenergy": {
"total": 5.817
}
}
{
"id": 1,
"src": "shellypluspmmini-44179bf90f08",
"params": {
"aenergy": {
"total": 11.679
},
"ret_aenergy": {
"total": 5.817
}
}
}
{
"aenergy": {
"total": 11.679
},
"ret_aenergy": {
"total": 5.817
}
}