Thats because your USB to RS485 converter is not connected to this serial port. From home assistant web interface, go to settings, then hardware and when you open hardware there is a three-dot menu on the top right corner - choose All Hardware and you will be presented with a list of all hardware connected to the computer which runs home assistant. From this list search for an entry which starts with ttyUSB. If there is only one serial convertor connected to the computer’s USB ports it should be ttyUSB0
Thank you! The problem with the USB-Port is gone now.
Unfortunately there is still the problem, that the sensor does not deliver any data.
When I open the sensor Info there is not data and when I open the energy dashboard there is
the message:
statistics_not_defined
- sensor.smart_meter
- sensor.smart_meter
Entity not available
- sensor.smart_meter (unavailable)
- sensor.smart_meter (unavailable)
try with this config
modbus:
- name: meter
type: serial
baudrate: 9600
bytesize: 8
method: rtu
parity: N
port: /dev/ttyUSB0
stopbits: 1
sensors:
- name: sdm630_total_active_energy
address: 0x2012
input_type: input
count: 2
slave: 1
precision: 2
data_type: float
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
If it doesn’t work I cannot suggest anything else but to buy a meter that is known to work with HA!
Thank you!
I think I found the problem - it is the converter - it needs a ch340 driver installed to be seen…
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