I had the same problem. In my case I had to remove
unique_id: xxxx
to solve this problem.
@miroslavpetrov followed your example to connect to a Eastron SDM230 Modbus, using an 8266 D1 Mini + same RS485 (using MAX495 chip) as you. But keep getting lots of âModbus CRC Check failed!â errors. Are you encountering same ? Eventually (random) I get all values from the SDM230, rest of time is all errors. Dont think issue is with physical connections (using all jumper cables). Tried switching to the modbus_controller instead of sdm_meter and getting same results more or less. Ground from SDM230 is connected to the Ground of the esp8266 and then to the RS485. Tested using hardware and software UART pins on 8266 with same result. Saw some complaining of this issues coming after some ESPHome version, but all were on ESP32 not 8266 not sure if it affects also 8266. ESPHome version 2022.11.5 seems to work fine, but not sure how to revert to that version only for this esp8266. The phone symbol on SDM230 is blinking, this was not same when I had my inverter connected to SDM230.
I use the Modbus USB Stick
Works great with eastron kwh meter
This is my yaml file
âââ
- type: serial
method: rtu
port: /dev/ttyUSB2
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
name: eastron
sensors:- name: eastron
unique_id: eastronkwh
address: 12
scan_interval: 1
input_type: input
count: 2
slave: 2
precision: 2
data_type: float32
device_class: energy
state_class: total_increasing
unit_of_measurement: âWâ
âââ
- name: eastron
Hello @miroslavpetrov . Sorry for jumping in here. But I was hoping you might be able to help me with something.
I have a daisy-chain of 1x Eastron SDM230 and 3x Eastron SDM120 all connecting to a USB/RS485 converter.
I know it all works as I had them working well with an Open Energy Monitor (emonCMS) setup. But Iâm now moving away from that to solely HA.
Iâm waning to create a modbus.yaml which contains sensors for the read-only values on each of the Eastrons. But, being a novice, Iâm struggling, especially with the addresses to read on teh Eastrons.
Would you be kind enough to share your specific sections of your modbus setup for reading the Eastrons (if youâre still using those)?
Any help is greatly appreciated.
Thanks in advance.
@smoketabs
First you should set different addresses of the two meters, but you should know that since you got them working before. This example should work for you if one of the meters is with address 1 and the other address 2. Change the value of slave: accordingly if your values are different.
Thanks. And yes, the IDs are unique.
Are you pulling any other data from the meters? For example, current, volts, PF, etc.?
I was hoping to build out a list of possible sensors for reading instantaneous readings, and then as youâve got in your code, cumulative kWh.
In my emonCMS config, I had the following. But Iâm not sure how best to represent these in HA, and also the addresses to read:
[[[[[sdm230a]]]]]
address = 010
registers = 0,6,12,18,30,70,72,74,76
names = V,I,P,VA,PF,FR,EI,EE,RI
precision = 2,3,1,1,3,3,3,3,3
[[[[[sdm120a]]]]]
address = 011
registers = 0,6,12,18,30,70,72,74,76
names = V,I,P,VA,PF,FR,EI,EE,RI
precision = 2,3,1,1,3,3,3,3
Again, any help is greatly received.
Best.
Roland.
Sorry for the mistake in my previous post, the value of the address for active energy is wrong because I was helping another person.
I am giving you my config for SDM630 which is a 3 phase meter, so you need to remove the lines for phase 2 and 3.
modbus:
- name: hub1
type: serial
baudrate: 9600
bytesize: 8
method: rtu
parity: N
port: /dev/ttyUSB0
stopbits: 1
sensors:
- name: sdm630_total_active_energy
address: 342
input_type: input
count: 2
slave: 1
precision: 2
data_type: float
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: sdm630_p1_voltage
slave: 1
address: 0
input_type: input
count: 2
precision: 2
data_type: float
unit_of_measurement: V
device_class: voltage
- name: sdm630_p2_voltage
slave: 1
address: 2
input_type: input
count: 2
precision: 2
data_type: float
unit_of_measurement: V
device_class: voltage
- name: sdm630_p3_voltage
slave: 1
address: 4
input_type: input
count: 2
precision: 2
data_type: float
unit_of_measurement: V
device_class: voltage
- name: sdm630_p1_current
slave: 1
address: 6
input_type: input
count: 2
precision: 3
data_type: float
unit_of_measurement: A
device_class: current
- name: sdm630_p2_current
slave: 1
address: 8
input_type: input
count: 2
precision: 3
data_type: float
unit_of_measurement: A
device_class: current
- name: sdm630_p3_current
slave: 1
address: 10
input_type: input
count: 2
precision: 3
data_type: float
unit_of_measurement: A
device_class: current
- name: sdm630_p1_active_power
slave: 1
address: 12
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float
unit_of_measurement: kW
device_class: power
- name: sdm630_p2_active_power
slave: 1
address: 14
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float
unit_of_measurement: kW
device_class: power
- name: sdm630_p3_active_power
slave: 1
address: 16
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float
unit_of_measurement: kW
device_class: power
- name: sdm630_sum_current
slave: 1
address: 48
input_type: input
count: 2
precision: 3
data_type: float
unit_of_measurement: A
device_class: current
- name: sdm630_sum_active_power
slave: 1
address: 52
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float
unit_of_measurement: kW
device_class: power
- name: sdm630_sum_apparant_power
slave: 1
address: 56
input_type: input
count: 2
precision: 2
data_type: float
unit_of_measurement: VA
device_class: power
- name: sdm630_sum_reactive_power
slave: 1
address: 60
input_type: input
count: 2
precision: 2
data_type: float
unit_of_measurement: VAr
device_class: power
- name: sdm630_sum_pf
slave: 1
address: 62
input_type: input
count: 2
precision: 2
data_type: float
unit_of_measurement: cosŃ
device_class: power_factor
here is also a table with the addresses of the registers. I see that voltage is missing but its â0â.
https://www.aggsoft.com/serial-data-logger/tutorials/modbus-data-logging/eastron-sdm230.htm
hope this helps.
Thanks @miroslavpetrov - greatly appreciated.
Iâve lifted just one for now, and tried it. It doesnât like the âfloatâ data_type. The check config says this:
âInvalid config for [modbus]: value must be one of [<DataType.CUSTOM: âcustomâ>, <DataType.FLOAT16: âfloat16â>, <DataType.FLOAT32: âfloat32â>, <DataType.FLOAT64: âfloat64â>, <DataType.INT16: âint16â>, <DataType.INT32: âint32â>, <DataType.INT64: âint64â>, <DataType.INT8: âint8â>, <DataType.STRING: âstringâ>, <DataType.STRING: âstringâ>, <DataType.UINT16: âuint16â>, <DataType.UINT32: âuint32â>, <DataType.UINT64: âuint64â>, <DataType.UINT8: âuint8â>] for dictionary value @ data[âmodbusâ][0][âsensorsâ][0][âdata_typeâ]. Got âfloatâ.â
Sorry to be a pain. Any help would be welcome.
But thank you, all the same.
Roland.
Just checked it out, its because there was a breaking change in version 2022.4 I think. You need to change float to float32 and it should be fine. I am no longer using this config because I am now reading my Eastron meters using ESPHome and I have not updated my archives
Thanks @miroslavpetrov. Thatâs fixed it. I can now see voltage from one of my SDM120s.
Thanks again - greatly appreciated.
For everyone elseâs benefit, Iâll paste my working code when Iâve completed testing.
Thanks again,
Roland.
Hello all.
With the help of @miroslavpetrov Iâve got my Eastrons working as I hoped. So as promised, hereâs a copy of my modbus config for all those others out there who are ânewâ to this.
My setup:
1x Eastron SDM230
3x Eastron SDM120
1x Industrial Modbus RS485 to USB Adaptor
1x IntelNUC (i5; 8Gb RAM; 128Gb SSD) flashed for HA only
- Daisy-chained using a single pair taken from a CAT6 cable.
- No GND cable
- No Terminating resistor
- My configuration.yaml calls a separate file in the same directory as the config.yaml called âmodbusUSB.yamlâ.
modbus: !include modbusUSB.yaml
- contents of âmodbusUSB.yamlâ.
Iâm able to read the following data on all of the individual meters:
- Active Energy (kWh)
- Voltage (V)
- Current (A)
- Active Power (W)
- Power Factor
- name: HomeModbus1
type: serial
baudrate: 9600
bytesize: 8
method: rtu
parity: N
port: /dev/ttyACM0
stopbits: 1
sensors:
- name: "EPS Active Energy"
unique_id: eps_active_energy
address: 342
input_type: input
count: 2
slave: 200
precision: 2
data_type: float32
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: "EPS Voltage"
unique_id: eps_voltage
slave: 200
address: 0
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: V
device_class: voltage
- name: "EPS Current"
unique_id: eps_current
slave: 200
address: 6
input_type: input
count: 2
precision: 3
data_type: float32
unit_of_measurement: A
device_class: current
- name: "EPS Active Power"
unique_id: eps_active_power
slave: 200
address: 12
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float32
unit_of_measurement: kW
device_class: power
- name: "EPS Power Factor"
unique_id: eps_power_factor
slave: 200
address: 30
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: cosŃ
device_class: power_factor
- name: "Non-EPS Active Energy"
unique_id: non_eps_active_energy
address: 342
input_type: input
count: 2
slave: 100
precision: 2
data_type: float32
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: "Non-EPS Voltage"
unique_id: non_eps_voltage
slave: 100
address: 0
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: V
device_class: voltage
- name: "Non-EPS Current"
unique_id: non_eps_current
slave: 100
address: 6
input_type: input
count: 2
precision: 3
data_type: float32
unit_of_measurement: A
device_class: current
- name: "Non-EPS Active Power"
unique_id: non_eps_active_power
slave: 100
address: 12
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float32
unit_of_measurement: kW
device_class: power
- name: "Non-EPS Power Factor"
unique_id: non_eps_power_factor
slave: 100
address: 30
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: cosŃ
device_class: power_factor
- name: "Hob Active Energy"
unique_id: hob_active_energy
address: 342
input_type: input
count: 2
slave: 101
precision: 2
data_type: float32
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: "Hob Voltage"
unique_id: hob_voltage
slave: 101
address: 0
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: V
device_class: voltage
- name: "Hob Current"
unique_id: hob_current
slave: 101
address: 6
input_type: input
count: 2
precision: 3
data_type: float32
unit_of_measurement: A
device_class: current
- name: "Hob Active Power"
unique_id: hob_active_power
slave: 101
address: 12
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float32
unit_of_measurement: kW
device_class: power
- name: "Hob Power Factor"
unique_id: hob_power_factor
slave: 101
address: 30
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: cosŃ
device_class: power_factor
- name: "Immersion Active Energy"
unique_id: immersion_active_energy
address: 342
input_type: input
count: 2
slave: 102
precision: 2
data_type: float32
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: "Immersion Voltage"
unique_id: immersion_voltage
slave: 102
address: 0
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: V
device_class: voltage
- name: "Immersion Current"
unique_id: immersion_current
slave: 102
address: 6
input_type: input
count: 2
precision: 3
data_type: float32
unit_of_measurement: A
device_class: current
- name: "Immersion Active Power"
unique_id: immersion_active_power
slave: 102
address: 12
input_type: input
count: 2
precision: 3
scale: 0.001
data_type: float32
unit_of_measurement: kW
device_class: power
- name: "Immersion Power Factor"
unique_id: immersion_power_factor
slave: 102
address: 30
input_type: input
count: 2
precision: 2
data_type: float32
unit_of_measurement: cosŃ
device_class: power_factor
With the above, Iâm able to get kWh (Active Energy) from each meter, so no need to write script to change power to energy.
These meters are not placed to monitor import/export - Iâll be using a solar inverter (Fox-ESS H1 6kW) for that.
I will also be adding further Eastrons over time.
I also pull in other energy data from various Shelly plus1PMs and a Shelly Pro4PM.
I also have a Hildebrand GLOW In House Display (IHD) reading my SMETS2 and sending data via MQTT to my HA instance. This allows me to track tariff rates and import/export consumption at the boundary line. (This is a UK setup).
Hope the above is of use to someone out there.
Thanks.
Roland.
hi. i have inverter connected to DTSU666 via RS485 to logger. could i connect to the same connector another rs485 to ttl converter in parallel so i could integrate power meter data it to home assistant with ESPhome?
Hi, I am getting the same issue with the float error on checking the config.
modbus:
- name: modhub1
type: serial
baudrate: 9600
bytesize: 8
method: rtu
parity: N
port: /dev/ttyUSB1
stopbits: 1
sensors:
- name: "sdm230_active_power"
unique_id: sdm230_active_power
slave: 1
address: 12
input_type: input
count: 2
precision: 4
data_type: float32
unit_of_measurement: W
device_class: power
I am on OS 12.2 and Core 2024.4.4
Configuration warnings
Invalid config for âmodbusâ at configuration.yaml, line 186: sdm230_active_power: count
illegal with data_type: float32
âmodbus->0->sensors->0â, got {ânameâ: âsdm230_active_powerâ, âunique_idâ: âsdm230_active_powerâ, âslaveâ: 1, âaddressâ: 12, âinput_typeâ: âinputâ, âcountâ: 2, âprecisionâ: 4, âdata_typeâ: âfloat32â, âunit_of_measurementâ: âWâ, âdevice_classâ: âpowerâ}
Any idea whatâs wrong? I have tried float, float16 and float32
I managed to fix it by removing count: 2 and am getting now getting readings. But they seem much less frequent that how often the meter itself changes - and it goes unavailable every so often too.
Hi I have used your example and corrected a new parameters (I will share soon) but I have come across and issue with a missing device_class called âreactive_energyâ. I have opened an enhacement request, could you vote/comment on it if needed:
Once i have something with this fix I will share my complete config.
Thanks!
I have the same question