Eastron SDM230 Modbus energy meter for Home Assistant

How to Connect an Eastron SDM230 to Home Assistant (Modbus RS485, Step by Step)

The short answer: the Eastron SDM230 connects to Home Assistant over two data wires. Wire its A and B terminals to a USB to RS485 adapter plugged into the machine running Home Assistant, add a short Modbus section to Home Assistant's configuration file, restart, and the meter's voltage, current, power and energy appear as sensors. The meter's import and export energy then go straight into Home Assistant's Energy dashboard. The whole job takes about half an hour once the meter is fitted.

What you need

  • An Eastron SDM230 Modbus meter, fitted in the circuit you want to measure.
  • A USB to RS485 adapter.
  • A computer running Home Assistant with a free USB port. A Raspberry Pi 4 is ideal.
  • A length of twisted-pair cable for the data connection, such as a spare pair in a Cat5 or Cat6 cable.

If you'd rather buy it all together from one UK supplier, OmniKit's Home Assistant Energy Monitoring Kit (£179.99) includes the Pi, the meter, the adapter, a power supply and a memory card with Home Assistant already installed.

Still choosing between this and a Wi-Fi clamp meter such as a Shelly? Read Shelly or Eastron for Home Assistant.

Step 1: fit the meter

The SDM230 connects to mains wiring, so it must be installed by a competent person to the current UK wiring regulations. It mounts on a standard 35mm DIN rail and measures one single-phase circuit up to 100A. If your supply is three phase, read Which Eastron meter do I need? first.

Step 2: connect the data wires

Run your twisted pair from the meter's RS485 terminals, marked A and B, to the matching A and B terminals on the adapter. That is the whole data connection: two wires, no power needed.

  • Keep the data cable away from mains cables where you can. Running them together down the same trunking is a common cause of lost readings.
  • For a short run, a few metres in the same room, nothing else is needed. On a long run, fit a 120-ohm resistor across A and B at the far end.

Step 3: check the meter's settings

A new SDM230 leaves Eastron's factory with these settings:

Setting Factory value
Modbus address 1
Baud rate 9600
Parity None
Data bits 8
Stop bits 1 or 2 (try 1 first)

If the meter has been set up before, check them in its own menu, because they may have been changed. Each one can be changed from the buttons on the front.

Step 4: find the adapter in Home Assistant

Plug the adapter into the Home Assistant machine. In Home Assistant, go to Settings, System, Hardware, open the three-dot menu and choose All hardware. Look for an entry starting /dev/serial/by-id/ that names your adapter, and copy that full path. Use this path rather than /dev/ttyUSB0, because it stays the same if you plug in another USB device later.

Step 5: add the Modbus section

Open Home Assistant's configuration.yaml file. The easiest way is the File editor add-on. Paste in the section below, replacing the port line with the path you copied in Step 4. Home Assistant's Modbus documentation lists every option.

modbus:
  - name: sdm230
    type: serial
    port: /dev/serial/by-id/PASTE-YOUR-ADAPTER-PATH-HERE
    baudrate: 9600
    bytesize: 8
    method: rtu
    parity: N
    stopbits: 1
    sensors:
      - name: SDM230 Voltage
        slave: 1
        address: 0
        input_type: input
        data_type: float32
        unit_of_measurement: V
        device_class: voltage
        state_class: measurement
        precision: 1
        scan_interval: 10
      - name: SDM230 Current
        slave: 1
        address: 6
        input_type: input
        data_type: float32
        unit_of_measurement: A
        device_class: current
        state_class: measurement
        precision: 2
        scan_interval: 10
      - name: SDM230 Power
        slave: 1
        address: 12
        input_type: input
        data_type: float32
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        precision: 0
        scan_interval: 10
      - name: SDM230 Frequency
        slave: 1
        address: 70
        input_type: input
        data_type: float32
        unit_of_measurement: Hz
        device_class: frequency
        state_class: measurement
        precision: 2
        scan_interval: 30
      - name: SDM230 Import Energy
        slave: 1
        address: 72
        input_type: input
        data_type: float32
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        precision: 2
        scan_interval: 30
      - name: SDM230 Export Energy
        slave: 1
        address: 74
        input_type: input
        data_type: float32
        unit_of_measurement: kWh
        device_class: energy
        state_class: total_increasing
        precision: 2
        scan_interval: 30

If you already have a modbus: section, add this as another entry under it rather than a second modbus: line. Then restart Home Assistant from Settings, System.

Step 6: check the readings

After the restart, go to Settings, Devices & services, Entities and search for "SDM230". You should see a voltage of around 230, a frequency of around 50, and power and energy figures that match the meter's own display. If they do, it's working.

Step 7: add it to the Energy dashboard

Open the Energy dashboard's settings. What you add depends on what the meter measures:

  • Your whole supply: add SDM230 Import Energy as grid consumption, and SDM230 Export Energy as energy returned to the grid if you have solar.
  • A solar inverter's output: add the import or export energy sensor, whichever rises when the panels generate, as solar production.
  • A single appliance or circuit, such as an EV charger or heat pump: add SDM230 Import Energy as an individual device.

The dashboard fills in from the next full hour.

If it doesn't work

Work through these in order:

  1. A and B the wrong way round. Swap them. It's the most common fix.
  2. Settings don't match. Check the address, baud rate and parity in the meter's menu against your configuration. If everything matches and there's still no reply, try stopbits: 2.
  3. Wrong adapter path. Check it again in All hardware, and make sure nothing else in Home Assistant is using the same adapter.
  4. Long cable with no termination. Fit a 120-ohm resistor across A and B at the far end.
  5. Data and mains cables run together. Separate them.

Home Assistant's own log, under Settings, System, Logs, will show Modbus errors such as "no response received", which tells you the problem is wiring or settings rather than the configuration file.

More readings

The SDM230 has more readings than the ones above. These are the most useful, taken from Eastron's protocol document. All are input registers, 32-bit floating point values, read with Modbus function code 04.

Reading Address to use in Home Assistant Unit
Voltage 0 V
Current 6 A
Active power 12 W
Apparent power 18 VA
Reactive power 24 VAr
Power factor 30 none
Frequency 70 Hz
Import active energy 72 kWh
Export active energy 74 kWh
Total active energy 342 kWh

Using ESPHome instead

If you'd rather put the meter on an ESP32 board with an RS485 module, ESPHome has a ready-made Eastron component that supports the SDM230. See the ESPHome Eastron SDM documentation. The meter settings in Step 3 are the same.

Common questions

Do I need an electrician?
For fitting the meter, yes. It connects to mains wiring. The data wiring and the Home Assistant setup you can do yourself.

Can I read more than one meter on the same adapter?
Yes. Give each meter its own Modbus address from its front menu, wire them all to the same A and B pair, and add a set of sensors for each one with its own slave number.

Will the readings match my electricity bill?
The SDM230 is MID approved and Class 1 accuracy, so its energy readings are accurate enough to bill against. See What does MID approved mean?

Is there a warranty?
Yes. The SDM230 comes with a one-year OmniKit warranty against faults, on top of your legal rights as a consumer.

Stuck? Email customersupport@omnikit.co.uk with what you've tried and any error from the Home Assistant log, and we'll help.

Back to blog