Skip to main content
Version: 1.0

EM1

EM1 component handles the data collection and processing from energy meter devices like the ShellyProEM.

Methods

EM1.SetConfig

Properties:

PropertyTypeDescription

id

number

Id of the EM component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

EM1.GetConfig

Properties:

PropertyTypeDescription

id

number

Id of the EM1 component instance

Find the EM1.GetConfig response properties in config section

EM1.GetStatus

Properties:

PropertyTypeDescription

id

number

Id of the EM1 component instance

Find more about the status response properties in status section

EM1.CalibrateFrom

This method calibrates(aligns the measurements of) an instance of EM1 component to another EM1 component.

Request

Parameters:

PropertyTypeDescription

id

number

Id of the EM1 component instance which is going to be calibrated

other_id

number

Id of the EM1 component from witch the calibration data is taken

Response:

restart_required:true on success; error if request can't be executed or failed

info

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 an 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 EM1 components that indicate incorrect CTs or other problems.

EM1.RevertToFactoryCalibration

This method resets a user-calibrated EM1 component to its factory defaults.

Request

Parameters:

PropertyTypeDescription

id

number

Id of the EM1 component instance to reset to factory defaults

Response:

restart_required:true on success; error if request can't be executed or failed

Configuration

The configuration of the EM1 component shows the energy metering device's name. To Get/Set the configuration of the EM1 component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the EM1 component instance

name

string or null

Name of the EM1 instance

reverse

bool

Reverse CT measurement direction of active power and energy for the EM1 component. setting the reverse option requires restart

Webhook events

EM1 component supports conditional webhooks.

Events related to the EM1 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:
      PropertyTypeDescription

      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:
      PropertyTypeDescription

      current

      number

      New current in Amps

  • active_power_change - when the active power has changed with at least 10W and 5% from the last reported value.
    • active_power_change event supports attributes, that can be used to compose conditional webhooks:
      PropertyTypeDescription

      act_power

      number

      New active power in Watts

Status

The status of the EM1 Component contains information from the current measurements. To obtain information on the component's status its id must be specified. The status contains information for:

  • The momentary values of the current in A (Amps), voltage in V (Volts), act_power in W (Watts), aprt_power in VA (Volt-Ampere), pf - power factor is dimensionless, freq - network frequency in Hz.

    PropertyTypeDescription

    id

    number

    Id of the EM1 component instance

    current

    number or null

    Current measurement value, [A]

    voltage

    number or null

    Voltage measurement value, [V]

    act_power

    number or null

    Active power measurement value, [W]

    aprt_power

    number or null

    Apparent power measurement value, [VA]

    pf

    number or null

    Power factor measurement value

    freq

    number or null

    Network frequency measurement value

    calibration

    string

    Indicates factory calibration or which EM1:id is the source for calibration

    errors

    array of type string

    EM1 component error conditions. May contain power_meter_failure, out_of_range:act_power, out_of_range:aprt_power, out_of_range:voltage or out_of_range:current. Present in status only if not empty.

Notifications

StatusChange

Statuschange notification on a regular interval and an error condition change.

Modbus registers

AddressTypeDescription
32000uint32Timestamp of the last update
32002booleanEM1 error
32003floatVoltage, V
32005floatCurrent, A
32007floatActive power, W
32009floatApparent power, VA
32011floatPower factor
32013booleanOverpower error
32014booleanOvervoltage error
32015booleanOvercurrent error
320164 registers reserved

If there are more than one EM1 component on the device, every next component's register block start address is calculated by adding 20 to the start address of the previous component. For example, EM1:1 will start at 32020.

Examples

EM1.SetConfig example

Example:

http://192.168.33.1/rpc/EM1.SetConfig?id=0&config={"name":"abc"}

Response

{
"restart_required": false
}

EM1.GetConfig example

Example:

http://192.168.33.1/rpc/EM1.GetConfig?id=0

Response

{
"id": 0,
"name": null,
"reverse": false
}

EM1.GetStatus example

http://192.168.33.1/rpc/EM1.GetStatus?id=0

Response

{
"id": 0,
"voltage": 236.1,
"current": 4.029,
"act_power": 951.2,
"aprt_power": 951.9,
"pf": 1,
"freq": 50,
"calibration": "factory",
"errors": [
"out_of_range:current"
]
}

EM1.CalibrateFrom example

http://192.168.33.1/rpc/EM1.CalibrateFrom?id=0&other_id=1

Response

{
"restart_required": true
}

EM1.RevertToFactoryCalibration example

http://192.168.33.1/rpc/EM1.RevertToFactoryCalibration?id=0

Response

{
"restart_required": true
}