Sorry, your browser does not support JavaScript!

Do a simple experiment in the home assistant

Control the Sonoff relays in real-time according to the power value of the energy meter

Abstract: this experiment illustrates how to request the power value of the Wi-Fi energy meter (IAMMETER) from the modbus tcp sensor(Home assistant) in 1s/s (sample/second) and use this reading as the feedback value to control the SONOFF relay operate in real-time.

Request the data of energy meter in Home Assistant(Modbus/TCP) in 1s/s(sample/second) and trigger the Sonoff in real-time.

welcome to discuss this topic here

The video tutorial of this document

The basic wiring,include wifi energy meter(sensor), sonoff smart socket(Actuator),load,

Home Assistant`s Dashboard effect of this experiment

Home Assistant Setting

  1. Configuration the IAMMETER`s energy meter in Home Assistant

    Single phase energy meter WEM3080: [modbusTCP in Home Assistant](https://github.com/lewei50/Solar-PV-Monitoring/blob/master/Yaml in Home Assistant/ModbusTCP/modbus1.yaml)

    Three phase energy meter WEM3080T: [modbusTCP in Home Assistant](https://github.com/lewei50/Solar-PV-Monitoring/blob/master/Yaml in Home Assistant/ModbusTCP/modbus.yaml)

    To use this sensor in your installation, add the following to your configuration.yaml file(for example WEM3080):

    Please remember to add 'scan_interval: 1' after ' name: Modbus_Power' to make home assistant to refresh the power reading every 1 second.

    # Example configuration.yaml entry for multiple TCP connections
    modbus:
      - name: hub11
        type: tcp
        host: 192.168.1.6
        port: 502
        sensors:
          - name: Modbus_Voltage
            slave: 1
            address: 0
            input_type: holding
            unit_of_measurement: V
            device_class: voltage
            state_class: measurement
            count: 1
            scale: 0.01
            offset: 0
            precision: 1
            data_type: uint16
          - name: Modbus_Current
            slave: 1
            address: 1
            input_type: holding
            unit_of_measurement: A
            device_class: current
            state_class: measurement
            count: 1
            scale: 0.01
            offset: 0
            precision: 1
            data_type: uint16
          - name: Modbus_Power
            slave: 1
            address: 2
            input_type: holding
            unit_of_measurement: W
            device_class: power
            state_class: measurement
            count: 2
            scale: 1
            offset: 0
            precision: 0
            data_type: int32
            scan_interval: 1
          - name: Modbus_ImportEnergy
            slave: 1
            address: 4
            input_type: holding
            unit_of_measurement: kWh
            device_class: energy
            state_class: total_increasing
            count: 2
            scale: 0.0003125
            offset: 0
            precision: 3
            data_type: uint32
          - name: Modbus_ExportGrid
            slave: 1
            address: 6
            input_type: holding
            unit_of_measurement: kWh
            device_class: energy
            state_class: total_increasing
            count: 2
            scale: 0.0003125
            offset: 0
            precision: 3
            data_type: uint32
    

    Configuration.Yaml in Home Assistant

    add a Sonoff relay in Home Assistant

  2. Add the opensource relay or the smart socket(Esphome, Tasmota,etc ...) that supported in Home Assistant. What we used in this experiment is the sonoff (S26 ).

    select the device in Home Assistant step by step

    select the SonOff(tasmota) product in this experiment

  3. Add the Automations in Home Assistant:

    Add the automation operation in Home Assistant

    when the power is greater than 1000, turn on Sonoff S26:

    Create automation

    Add a trigger condition in the automation of home assistant

    Name this automation

    select the power reading from the modbus/tcp sensor as the trigger source

    image-20220715151504004

    Power<500 then Turn off Sonoff S26:

    add another trigger source in this automation

    If the power is less than 500W, than do the corresponding operation

    Turn off the sonoff relay when the power reading is less than 50w

    Turn on the automation in Home Assistant

The experiment effect

Use a Electric kettle to produce the load power.

do this experiment in the home assistant

At beginning ,the electric kettle is off,the load power is 0w, the sonoff smart socket is also off.

the sonoff is off when the load power is less than 500w

open the electric kettle, Modbus_Power=1596W > 1000W,then Sonoff S26 Relay turn on.

the sonoff is turned on when the load power is greater than 1000w

Ready to turn off the kettle.

do the automation experiment in home assistant

The electric kettle is off , Modbus_Power=64W < 500W,the Sonoff S26 Relay turn off.

the sonoff is off when the load power is less than 500w

The whole experiment effect is show in this video (the last 30 seconds of this video)

Request the data of energy meter in Home Assistant(modbus/tcp), trigger the Sonoff in realtime. - YouTube

Use IAMMETER`s product in the Home assistant

  1. Four methods available for integrating IAMMETER's energy meter into Home Assistant
  2. Summary: How to use IAMMETER`s energy meter in Home assistant
  3. Integrate the IAMMETER Wi-Fi energy meter(single phase and three-phase) into home assistant
  4. IAMMETER energy meter support Modbus TCP

System && Products && Solutions

Four ways to integrate the Electricity Usage Monitor (IAMMETER) into the home assistant

Monitor your solar PV system in Home Assistant

Control the EV charging power with regard to the solar PV output and grid power reading

Top