I am using ESP32dev board and an RS485 to UART converter. I have a Selec MFM384-R-C energy meter.
This is the user manual of the energy meter with address map https://www.selec.com/viewdocument/d8e1344e27a5b08cdfd5d027d9b8d6de.
In the logs I can see commands being sent but nothing is getting back. Have I configured anything wrong, perhaps the address?
Following is my esphome code:
esphome:
name: energy-meter
friendly_name: Energy Meter
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ota:
- platform: esphome
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
wifi:
ssid: !secret wifi_ssid2
password: !secret wifi_password2
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "xxxxxxxxxxxxxxxxxxxxxxx"
password: "xxxxxxxxxxxxxxxxxxxxx"
captive_portal:
uart:
id: mod_uart
tx_pin: GPIO17 # Replace with the correct TX pin
rx_pin: GPIO16 # Replace with the correct RX pin
baud_rate: 9600 # Set the correct baud rate for your Modbus device
modbus:
id: modbus1
uart_id: mod_uart
send_wait_time: 500ms
modbus_controller:
- id: energy_meter_modbus
address: 1
modbus_id: modbus1
update_interval: 30s
setup_priority: -10
sensor:
#VOLTAGE
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: voltage_r
address: 30000
name: "Voltage R"
unit_of_measurement: "V"
register_type: read # or input, depending on your device
value_type: FP32
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: voltage_y
address: 30002
name: "Voltage Y"
unit_of_measurement: "V"
register_type: read # or input, depending on your device
value_type: FP32
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: voltage_b
address: 30004
name: "Voltage B"
unit_of_measurement: "V"
register_type: read # or input, depending on your device
value_type: FP32
#CURRENT
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: current_r
address: 30016
name: "Current R"
unit_of_measurement: "A"
register_type: read # or input, depending on your device
value_type: FP32
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: current_y
address: 30018
name: "Current Y"
unit_of_measurement: "A"
register_type: read # or input, depending on your device
value_type: FP32
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: current_b
address: 30020
name: "Current B"
unit_of_measurement: "A"
register_type: read # or input, depending on your device
value_type: FP32
#POWER
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: power_r
address: 30024
name: "Power R"
unit_of_measurement: "W"
register_type: read # or input, depending on your device
value_type: FP32
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: power_y
address: 30026
name: "Power Y"
unit_of_measurement: "W"
register_type: read # or input, depending on your device
value_type: FP32
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: power_b
address: 30028
name: "Power B"
unit_of_measurement: "W"
register_type: read # or input, depending on your device
value_type: FP32
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: total_power
address: 30042
name: "Total Power"
unit_of_measurement: "W"
register_type: read # or input, depending on your device
value_type: FP32
#IMPORT ENERGY
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: total_import
device_class: energy
state_class: total_increasing
address: 30058
name: "Total Import Energy"
unit_of_measurement: "kWh"
register_type: read # or input, depending on your device
value_type: FP32
#EXPORT ENERGY
- platform: modbus_controller
modbus_controller_id: energy_meter_modbus
id: total_export
device_class: energy
state_class: total_increasing
address: 30074
name: "Total Export Energy"
unit_of_measurement: "kWh"
register_type: read # or input, depending on your device
value_type: FP32
Here is my log:
INFO ESPHome 2024.8.3
INFO Reading configuration /config/esphome/energy-meter.yaml...
INFO Starting log output from 192.168.1.184 using esphome API
INFO Successfully connected to energy-meter @ 192.168.1.184 in 0.094s
INFO Successful handshake with energy-meter @ 192.168.1.184 in 0.098s
[19:22:25][I][app:100]: ESPHome version 2024.8.3 compiled on Sep 6 2024, 19:11:06
[19:22:25][C][wifi:600]: WiFi:
[19:22:25][C][wifi:428]: Local MAC: xx:xx:xx:xx:xx:xx
[19:22:25][C][wifi:433]: SSID: 'xxxxxx'[redacted]
[19:22:25][C][wifi:436]: IP Address: 192.168.1.184
[19:22:25][C][wifi:440]: BSSID: xx:xx:xx:xx:xx:xx[redacted]
[19:22:25][C][wifi:441]: Hostname: 'energy-meter'
[19:22:25][C][wifi:443]: Signal strength: -63 dB ▂▄▆█
[19:22:25][C][wifi:447]: Channel: 6
[19:22:25][C][wifi:448]: Subnet: 255.255.255.0
[19:22:25][C][wifi:449]: Gateway: 192.168.1.1
[19:22:25][C][wifi:450]: DNS1: 1.1.1.1
[19:22:25][C][wifi:451]: DNS2: 1.0.0.1
[19:22:25][C][logger:185]: Logger:
[19:22:25][C][logger:186]: Level: DEBUG
[19:22:25][C][logger:188]: Log Baud Rate: 115200
[19:22:25][C][logger:189]: Hardware UART: UART0
[19:22:25][C][uart.arduino_esp32:151]: UART Bus 1:
[19:22:25][C][uart.arduino_esp32:152]: TX Pin: GPIO17
[19:22:25][C][uart.arduino_esp32:153]: RX Pin: GPIO16
[19:22:25][C][uart.arduino_esp32:155]: RX Buffer Size: 256
[19:22:25][C][uart.arduino_esp32:157]: Baud Rate: 9600 baud
[19:22:25][C][uart.arduino_esp32:158]: Data Bits: 8
[19:22:25][C][uart.arduino_esp32:159]: Parity: NONE
[19:22:25][C][uart.arduino_esp32:160]: Stop bits: 1
[19:22:25][C][modbus:152]: Modbus:
[19:22:25][C][modbus:154]: Send Wait Time: 500 ms
[19:22:25][C][modbus:155]: CRC Disabled: NO
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Voltage R'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'V'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Voltage Y'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'V'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Voltage B'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'V'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Current R'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'A'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Current Y'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'A'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Current B'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'A'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Power R'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'W'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Power Y'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'W'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Power B'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'W'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Power'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: ''
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'W'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Import Energy'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Device Class: 'energy'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: 'total_increasing'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'kWh'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Total Export Energy'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Device Class: 'energy'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor State Class: 'total_increasing'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Unit of Measurement: 'kWh'
[19:22:25][C][modbus_controller.sensor:010]: modbus_controller.sensor Accuracy Decimals: 0
[19:22:25][C][captive_portal:088]: Captive Portal:
[19:22:25][C][mdns:116]: mDNS:
[19:22:25][C][mdns:117]: Hostname: energy-meter
[19:22:25][C][esphome.ota:073]: Over-The-Air updates:
[19:22:25][C][esphome.ota:074]: Address: energy-meter.local:3232
[19:22:25][C][esphome.ota:075]: Version: 2
[19:22:25][C][esphome.ota:078]: Password configured
[19:22:25][C][safe_mode:018]: Safe Mode:
[19:22:25][C][safe_mode:020]: Boot considered successful after 60 seconds
[19:22:25][C][safe_mode:021]: Invoke after 10 boot attempts
[19:22:25][C][safe_mode:023]: Remain in safe mode for 300 seconds
[19:22:25][C][api:139]: API Server:
[19:22:25][C][api:140]: Address: energy-meter.local:6053
[19:22:25][C][api:142]: Using noise encryption: YES
[19:22:25][C][modbus_controller:345]: ModbusController:
[19:22:25][C][modbus_controller:346]: Address: 0x01
[19:22:27][D][modbus_controller:040]: Modbus command to device=1 register=0x755A countdown=0 no response received - removed from send queue
[19:22:30][D][modbus_controller:040]: Modbus command to device=1 register=0x756A countdown=0 no response received - removed from send queue
[19:22:32][D][modbus_controller:040]: Modbus command to device=1 register=0x757A countdown=0 no response received - removed from send queue