If you want to monitor an electric car charging, it can be difficult to find some all-in-one devices to suit your needs.
Luckily that does not mean they don’t exist, they just require a bit more work before they are ready to use. After putting the work in, you are rewarded with a more flexible system, with the option of measuring exactly what you want.
The components used in this example are off the shelf devices, but they require some knowledge to wire up correct. You will be dealing with mains voltage, so if you are not sure what you are doing, get an electrician to wire it up for you.
This example is based on
There are other variants of the power meter, and also different manufacturers. You just need to make sure the one you get can communicate over modbus.
Between the modbus gateway and the power meter, you simply wire the A+ to A+ and B- to B-. If you keep the devices next to each other and the wires short, you probably don’t need to use a termination resistor.
After logging in on the modbus gateway head over to Serial Port Settings
. Here you need to set baud rate to the same as the device you want to communicate with, and in the bottom you need to set Protocol Settings
to Modbus
. Press submit in the bottom of the page and head over to Home Assistant.
In configuration.yaml you can insert this for the SDM120. Remember to change the host ip to the same ip as your modbus gateway. Restart Home Assistant, and that should be it.
modbus:
- name: "SDM120"
close_comm_on_error: true
delay: 5
timeout: 5
type: tcp
host: 10.0.3.111
port: 8899
sensors:
- name: SDM120 Voltage
scan_interval: 10 # seconds between requests
slave: 2
address: 0x0000
count: 2
input_type: input
precision: 1
data_type: float32
unit_of_measurement: V
device_class: voltage
state_class: measurement
- name: SDM120 Current
scan_interval: 5 # seconds between requests
slave: 2
address: 0x0006
count: 2
input_type: input
precision: 1
data_type: float32
unit_of_measurement: A
device_class: current
state_class: measurement
- name: SDM120 Power (Active)
scan_interval: 5 # seconds between requests
slave: 2
address: 0x000c
count: 2
input_type: input
precision: 1
data_type: float32
unit_of_measurement: W
device_class: power
state_class: measurement
- name: SDM120 Power Factor
scan_interval: 30 # seconds between requests
slave: 2
address: 0x001e
count: 2
input_type: input
precision: 1
data_type: float32
unit_of_measurement: '%'
device_class: power_factor
state_class: measurement
- name: SDM120 Frequency
scan_interval: 5 # seconds between requests
slave: 2
address: 0x0046
count: 2
input_type: input
precision: 2
data_type: float32
unit_of_measurement: Hz
device_class: frequency
state_class: measurement
- name: SDM120 Imported Energy (Active)
scan_interval: 5 # seconds between requests
slave: 2
address: 0x0048
count: 2
input_type: input
precision: 3
data_type: float32
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: SDM120 Exported Energy (Active)
scan_interval: 5 # seconds between requests
slave: 2
address: 0x004a
count: 2
input_type: input
precision: 3
data_type: float32
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
- name: SDM120 Total Demand Power (Active)
scan_interval: 5 # seconds between requests
slave: 2
address: 0x0054
count: 2
input_type: input
precision: 3
data_type: float32
unit_of_measurement: W
device_class: power
state_class: measurement
- name: SDM120 Total Energy (Active)
scan_interval: 5 # seconds between requests
slave: 2
address: 0x0056
count: 2
input_type: input
precision: 3
data_type: float32
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
For using a Carlo Gavazzi meter, the configuration looks like this
modbus:
- name: "Heatpump"
close_comm_on_error: true
delay: 5
timeout: 5
type: tcp
host: 10.0.3.111
port: 8899
sensors:
- name: Heatpump dining room volt
unit_of_measurement: V
slave: 1
address: 0
input_type: input
data_type: int32
scale: 0.1
precision: 2
swap: word
count: 2
device_class: voltage
- name: Heatpump dining room kWh
unit_of_measurement: kWh
slave: 1
address: 0x0500
data_type: int32
scale: 0.001
precision: 2
swap: word
device_class: energy
state_class: total
- name: Heatpump dining room watt
unit_of_measurement: W
slave: 1
address: 0x0004
data_type: int32
swap: word
scale: 0.1
precision: 2
device_class: power