EnergyMeter
Energy Meter component handles the data collection and processing from energy meter devices.
EM.SetConfigto update the component's configurationEM.GetConfigto obtain the component's configurationEM.GetStatusto obtain the component's statusEM.PhaseToPhaseCalibcalibrate a phase CT from another phase's CTEM.PhaseToPhaseCalibResetreset a user calibrated CT to factory defaults
Methods
EM.SetConfig
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the EM component instance |
| object | Configuration that the method takes |
Find more about the config properties in config section
EM.GetConfig
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the EM component instance |
Find the EM.GetConfig response properties in config section
EM.GetStatus
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the EM component instance |
Find more about the status response properties in status section
EM.PhaseToPhaseCalib
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the EM component instance |
| string | Select the phase from witch the calibration data is taken |
| string | Select the phase to witch the calibration is due |
Response:
restart_required:true on success; error if request can't be executed or failed
In order to be able to calibrate correctly the phase voltages need to be equal i.e. if we calibrate a CT from phase c to a
CT on phase a, the voltage of phase c and phase a needs to be the same (phases are connected on the same voltage line).
The minimum power allowed for the calibration to take place is 500W. The method takes around 5 seconds to complete, and the
response is delayed with the request answer - restart_required: true in case of success or error message in case of fail.
The reasons for the calibration to fail may be - deviation in measurement after calibration on the from and to phases
that indicating incorrect input phases setup, incorrect CTs or other problem.
EM.PhaseToPhaseCalibReset
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the EM component instance |
| string | Phase for which user calibration is going to be reset |
Response:
restart_required:true on success; error if request can't be executed or failed
Configuration
The configuration of the Energy Meter component shows the energy metering device's name,
blink mode selector, phase selector and phase sequence detection enabled.
To Get/Set the configuration of the EM component its id must be specified.
Name setting does not require restart however, setting blink_mode_selector and/or phase_selector requires restart.
Properties:
| Property | Type | Description |
|---|---|---|
| number | Id of the EM component instance |
| string or null | Name of the energy meter instance |
| string | Select the electrical quantity that drives the LED. Range of values: |
| string | Select witch phase controls the LED. Range of values: |
| boolean | Set this to show |
Webhook events
EM componnent supports conditional webhooks.
Events related to the EM component that can trigger webhooks:
voltage_change- when voltage has changed with at least 1V and 5% from the last reported value.voltage_changeevent supports attributes, that can be used to compose conditional webhooks:Property Type Description phasestring
Phase which generates the event, one of 'a', 'b' or 'c'.
voltagenumber
New phase voltage in Volts
current_change- when current has changed with at least 0.05A and 5% from the last reported value.current_changeevent supports attributes, that can be used to compose conditional webhooks:Property Type Description phasestring
Phase which generates the event, one of 'a', 'b', 'c' or 'n'.
currentnumber
New phase current in Amps
active_power_change- when active power has changed with at least 10W and 5% from the last reported value.active_power_changeevent supports attributes, that can be used to compose conditional webhooks:Property Type Description phasestring
Phase which generates the event, one of 'a', 'b' or 'c'.
act_powernumber
New phase active power in Watts
Status
The status of the Energy Meter Component contains information from the current measurements, for all active phase(es) of the device. To obtain information for the components status its id must be specified. The information for a phase contains information for:
The momentary values of the
currentinA(Amps),voltageinV(Volts),active_powerinW(Watts),apparent_powerinVA(Volt-Ampere),pf- power factor is dimensionless.neutralis the reporting for theneutralcurrent measurements.Property Type Description idnumber
Id of the EM component instance
a_currentnumber or null
Phase A current measurement value, [A]
a_voltagenumber or null
Phase A voltage measurement value, [V]
a_act_powernumber or null
Phase A active power measurement value, [W]
a_aprt_powernumber or null
Phase A apparent power measurement value, [VA]
a_pfnumber or null
Phase A power factor measurement value
a_errorsarray of type string
Phase A error conditions occurred. May contain
out_of_range:active_power,out_of_range:apparent_power,out_of_range:voltage,out_of_range:current,(shown if at least one error is present)b_currentnumber or null
Phase B current measurement value, [A]
b_voltagenumber or null
Phase B voltage measurement value, [V]
b_act_powernumber or null
Phase B active power measurement value, [W]
b_aprt_powernumber or null
Phase B apparent power measurement value, [VA]
b_pfnumber or null
Phase B power factor measurement value
b_errorsarray of type string
Phase B error conditions occurred. May contain
out_of_range:active_power,out_of_range:apparent_power,out_of_range:voltage,out_of_range:current,(shown if at least one error is present)c_currentnumber or null
Phase C current measurement value, [A]
c_voltagenumber or null
Phase C voltage measurement value, [V]
c_act_powernumber or null
Phase C active power measurement value, [W]
c_aprt_powernumber or null
Phase C apparent power measurement value, [VA]
c_pfnumber or null
Phase C power factor measurement value
c_errorsarray of type string
Phase C error conditions occurred. May contain
out_of_range:active_power,out_of_range:apparent_power,out_of_range:voltage,out_of_range:current,(shown if at least one error is present)n_currentnumber or null
Neutral current measurement value, [A] (if supported)
n_errorsarray of type string
Neutral error conditions occurred. May contain
out_of_range:current,(shown if error is present)total_currentnumber or null
Sum of the current on all phases(excluding neutral readings if available)
total_act_powernumber or null
Sum of the active power on all phases
total_aprt_powernumber or null
Sum of the apparent power on all phases
user_calibrated_phasearray of type string
Indicates which phase was user calibrated
errorsarray of type string
EM component error conditions. May contain
power_meter_failure,phase_sequenceorno_load. Present in status only if not empty.
* phase_sequence is an error indicating if the sequence of zero-crossing events is Phase A followed by Phase C followed by Phase B. The regular succession of these zero-crossing events is Phase A followed by Phase B followed by Phase C.
* no_load is an error indicating the power meter is in no load condition and isn't accumulating the registered energies, the measured values can be discarded.
Notifications
StatusChange
Statuschange notification on a regular interval and an error condition change.
Modbus registers
| Address | Type | Description |
|---|---|---|
| 31000 | uint32 | Timestamp of the last update |
| 31002 | boolean | Phase A meter error |
| 31003 | boolean | Phase B meter error |
| 31004 | boolean | Phase C meter error |
| 31005 | boolean | Neutral meter error |
| 31006 | boolean | Phase sequence error |
| 31007 | float | Neutral current, A |
| 31009 | boolean | Neutral current mismatch |
| 31010 | boolean | Neutral overcurrent error |
| 31011 | 9 registers reserved | |
| 31020 | float | Phase A voltage, V |
| 31022 | float | Phase A current, A |
| 31024 | float | Phase A active power, W |
| 31026 | float | Phase A apparent power, VA |
| 31028 | float | Phase A power factor |
| 31030 | boolean | Phase A overpower error |
| 31031 | boolean | Phase A overvoltage error |
| 31032 | boolean | Phase A overcurrent error |
| 31033 | 7 registers reserved | |
| 31040 | float | Phase B voltage, V |
| 31042 | float | Phase B current, A |
| 31044 | float | Phase B active power, W |
| 31046 | float | Phase B apparent power, VA |
| 31048 | float | Phase B power factor |
| 31050 | boolean | Phase B overpower error |
| 31051 | boolean | Phase B overvoltage error |
| 31052 | boolean | Phase B overcurrent error |
| 31053 | 7 registers reserved | |
| 31060 | float | Phase C voltage, V |
| 31062 | float | Phase C current, A |
| 31064 | float | Phase C active power, W |
| 31066 | float | Phase C apparent power, VA |
| 31068 | float | Phase C power factor |
| 31070 | boolean | Phase C overpower error |
| 31071 | boolean | Phase C overvoltage error |
| 31072 | boolean | Phase C overcurrent error |
| 31073 | 7 registers reserved | |
| 31080 | float | Total current, A * |
| 31082 | float | Total active power, W * |
| 31084 | float | Total apparent power, VA * |
| 31085 | 14 registers reserved |
If there is a second EM component on the device, its corresponding registers addresses are calculated by adding 100 to the address in the table above.
* sum of all available phases
Examples
EM.SetConfig example
Example:
- EM.SetConfig HTTP GET Request
- EM.SetConfig Curl Request
- EM.SetConfig Mos Request
http://192.168.33.1/rpc/EM.SetConfig?id=0&config={"name":"abc","blink_mode_selector":"apparent_energy","phase_selector":"all","monitor_phase_sequence":true}
curl -X POST -d '{"id":1,"method":"EM.SetConfig","params":{"id":0,"config":{"name":"abc","blink_mode_selector":"apparent_energy","phase_selector":"all","monitor_phase_sequence":true}}}' http://${SHELLY}/rpc
mos --port ${PORT} call EM.SetConfig '{"id":0,"config":{"name":"abc","blink_mode_selector":"apparent_energy","phase_selector":"all","monitor_phase_sequence":true}}'
Response
- EM.SetConfig HTTP GET Response
- EM.SetConfig Curl Response
- EM.SetConfig Mos Response
{
"restart_required": true
}
{
"id": 1,
"params": {
"restart_required": true
}
}
{
"restart_required": true
}
EM.GetConfig example
Example:
- EM.GetConfig HTTP GET Request
- EM.GetConfig Curl Request
- EM.GetConfig Mos Request
http://192.168.33.1/rpc/EM.GetConfig?id=0
curl -X POST -d '{"id":1,"method":"EM.GetConfig","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call EM.GetConfig '{"id":0}'
Response
- EM.GetConfig HTTP GET Response
- EM.GetConfig Curl Response
- EM.GetConfig Mos Response
{
"id": 0,
"name": null,
"blink_mode_selector": "active_energy",
"phase_selector": "a",
"monitor_phase_sequence": true
}
{
"id": 1,
"params": {
"id": 0,
"name": null,
"blink_mode_selector": "active_energy",
"phase_selector": "a",
"monitor_phase_sequence": true
}
}
{
"id": 0,
"name": null,
"blink_mode_selector": "active_energy",
"phase_selector": "a",
"monitor_phase_sequence": true
}
EM.GetStatus example
- EM.GetStatus HTTP GET Request
- EM.GetStatus Curl Request
- EM.GetStatus Mos Request
http://192.168.33.1/rpc/EM.GetStatus?id=0
curl -X POST -d '{"id":1,"method":"EM.GetStatus","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call EM.GetStatus '{"id":0}'
Response
- EM.GetStatus HTTP GET Response
- EM.GetStatus Curl Response
- EM.GetStatus Mos Response
{
"id": 0,
"a_current": 4.029,
"a_voltage": 236.1,
"a_act_power": 951.2,
"a_aprt_power": 951.9,
"a_pf": 1,
"b_current": 4.027,
"b_voltage": 236.201,
"b_act_power": 951.1,
"b_aprt_power": 951.8,
"b_pf": 1,
"c_current": 3.03,
"c_voltage": 236.402,
"c_active_power": 715.4,
"c_aprt_power": 716.2,
"c_pf": 1,
"n_current": 11.029,
"total_current": 11.083,
"total_act_power": 2484.782,
"total_aprt_power": 2486.7,
"user_calibrated_phase": [],
"errors": [
"phase_sequence"
]
}
{
"id": 1,
"params": {
"id": 0,
"a_current": 4.029,
"a_voltage": 236.1,
"a_act_power": 951.2,
"a_aprt_power": 951.9,
"a_pf": 1,
"b_current": 4.027,
"b_voltage": 236.201,
"b_act_power": 951.1,
"b_aprt_power": 951.8,
"b_pf": 1,
"c_current": 3.03,
"c_voltage": 236.402,
"c_active_power": 715.4,
"c_aprt_power": 716.2,
"c_pf": 1,
"n_current": 11.029,
"total_current": 11.083,
"total_act_power": 2484.782,
"total_aprt_power": 2486.7,
"user_calibrated_phase": [],
"errors": [
"phase_sequence"
]
}
}
{
"id": 0,
"a_current": 4.029,
"a_voltage": 236.1,
"a_act_power": 951.2,
"a_aprt_power": 951.9,
"a_pf": 1,
"b_current": 4.027,
"b_voltage": 236.201,
"b_act_power": 951.1,
"b_aprt_power": 951.8,
"b_pf": 1,
"c_current": 3.03,
"c_voltage": 236.402,
"c_active_power": 715.4,
"c_aprt_power": 716.2,
"c_pf": 1,
"n_current": 11.029,
"total_current": 11.083,
"total_act_power": 2484.782,
"total_aprt_power": 2486.7,
"user_calibrated_phase": [],
"errors": [
"phase_sequence"
]
}
EM.PhaseToPhaseCalib example
- EM.PhaseToPhaseCalib HTTP GET Request
- EM.PhaseToPhaseCalib Curl Request
- EM.PhaseToPhaseCalib Mos Request
http://192.168.33.1/rpc/EM.PhaseToPhaseCalib?id=0&from="a"&to="n"
curl -X POST -d '{"id":1,"method":"EM.PhaseToPhaseCalib","params":{"id":0,"from":"a","to":"n"}}' http://${SHELLY}/rpc
mos --port ${PORT} call EM.PhaseToPhaseCalib '{"id":0,"from":"a","to":"n"}'
Response
- EM.PhaseToPhaseCalib HTTP GET Response
- EM.PhaseToPhaseCalib Curl Response
- EM.PhaseToPhaseCalib Mos Response
{
"restart_required": true
}
{
"id": 1,
"params": {
"restart_required": true
}
}
{
"restart_required": true
}
EM.PhaseToPhaseCalibReset example
- EM.PhaseToPhaseCalibReset HTTP GET Request
- EM.PhaseToPhaseCalibReset Curl Request
- EM.PhaseToPhaseCalibReset Mos Request
http://192.168.33.1/rpc/EM.PhaseToPhaseCalibReset?id=0&phase="a"
curl -X POST -d '{"id":1,"method":"EM.PhaseToPhaseCalibReset","params":{"id":0,"phase":"a"}}' http://${SHELLY}/rpc
mos --port ${PORT} call EM.PhaseToPhaseCalibReset '{"id":0,"phase":"a"}'
Response
- EM.PhaseToPhaseCalibReset HTTP GET Response
- EM.PhaseToPhaseCalibReset Curl Response
- EM.PhaseToPhaseCalibReset Mos Response
{
"restart_required": true
}
{
"id": 1,
"params": {
"restart_required": true
}
}
{
"restart_required": true
}