Edit, please read first:
- The working ESPHome custom component can be found here.
- Additionally @Safs managed to get this working with a Elfin Module
Hello,
i’m trying to read out my Foxess Solar Inverter over Modbus with esphome.
Unfortunately I can’t get it to work and since this is the first time I’m using modbus I don’t know where to start troubleshooting or even interpret the log entries. Perhaps there is someone who can point me in the right direction.
Esphome YAML:
esphome:
name: wechselrichter
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
level: VERBOSE
# Enable Home Assistant API
api:
ota:
password: "****************************"
wifi:
ssid: "**************************"
password: "*******************************"
manual_ip:
static_ip: 192.168.178.61
gateway: 192.168.178.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wechselrichter Fallback Hotspot"
password: "*************************"
captive_portal:
uart:
id: mod_bus
tx_pin: 17
rx_pin: 16
baud_rate: 9600
stop_bits: 1
modbus:
#flow_control_pin: 5 #not needed since there is no writing to the inverter
id: mod_bus_foxess
#send_wait_time: 500ms
modbus_controller:
- id: foxess
address: 0x1
modbus_id: mod_bus_foxess
setup_priority: -10
sensor:
- platform: modbus_controller
modbus_controller_id: foxess
name: "PV1-Voltage"
id: pv1_voltage
register_type: read
address: 10800
unit_of_measurement: "V"
value_type: U_WORD
- platform: modbus_controller
modbus_controller_id: foxess
name: "PV1-Current"
id: pv1_current
register_type: "read"
address: 11001
unit_of_measurement: "A"
value_type: U_WORD
# - platform: modbus_controller
# modbus_controller_id: foxess
# name: "PV1-Power"
# id: pv1_power
# register_type: "read"
# address: 11002
# unit_of_measurement: "W"
# value_type: U_WORD
button:
- platform: restart
name: "Wechselrichter restart"
LOG (verbose):
[11:04:34][C][modbus_controller:276]: ModbusController:
[11:04:34][C][modbus_controller:277]: Address: 0x01
[11:04:34][C][modbus_controller:283]: Sensor type=4 start=0x2A30 offset=0x0 count=1 size=2
[11:04:34][C][modbus_controller:283]: Sensor type=4 start=0x2AF9 offset=0x0 count=1 size=2
[11:04:34][C][modbus_controller:288]: Range type=4 start=0x2A30 count=1 skip_updates=0
[11:04:34][C][modbus_controller:288]: Range type=4 start=0x2AF9 count=1 skip_updates=0
[11:05:08][V][modbus_controller:159]: Updating modbus component
[11:05:08][V][modbus_controller:126]: Range : 2A30 Size: 1 (4) skip: 0
[11:05:08][V][modbus_controller:126]: Range : 2AF9 Size: 1 (4) skip: 0
[11:05:08][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2A30 count 1
[11:05:08][V][modbus:184]: Modbus write: 01.04.2A.30.00.01.39.DD (8)
[11:05:08][V][modbus_controller:465]: Command sent 4 0x2A30 1
[11:05:08][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:08][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:08][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:08][V][modbus:058]: Modbus received Byte 48 (0X30)
[11:05:08][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:08][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:08][V][modbus:058]: Modbus received Byte 221 (0Xdd)
[11:05:09][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2A30 count 1
[11:05:09][V][modbus:184]: Modbus write: 01.04.2A.30.00.01.39.DD (8)
[11:05:09][V][modbus_controller:465]: Command sent 4 0x2A30 1
[11:05:09][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:09][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:09][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:09][V][modbus:058]: Modbus received Byte 48 (0X30)
[11:05:09][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:09][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:09][V][modbus:058]: Modbus received Byte 57 (0X39)
[11:05:09][V][modbus:058]: Modbus received Byte 221 (0Xdd)
[11:05:09][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2A30 count 1
[11:05:09][V][modbus:184]: Modbus write: 01.04.2A.30.00.01.39.DD (8)
[11:05:09][V][modbus_controller:465]: Command sent 4 0x2A30 1
[11:05:09][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:09][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:09][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:09][V][modbus:058]: Modbus received Byte 48 (0X30)
[11:05:09][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:09][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:09][V][modbus:058]: Modbus received Byte 57 (0X39)
[11:05:09][V][modbus:058]: Modbus received Byte 221 (0Xdd)
[11:05:09][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2A30 count 1
[11:05:09][V][modbus:184]: Modbus write: 01.04.2A.30.00.01.39.DD (8)
[11:05:09][V][modbus_controller:465]: Command sent 4 0x2A30 1
[11:05:09][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:09][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:09][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:09][V][modbus:058]: Modbus received Byte 48 (0X30)
[11:05:09][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:09][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:09][V][modbus:058]: Modbus received Byte 57 (0X39)
[11:05:09][V][modbus:058]: Modbus received Byte 221 (0Xdd)
[11:05:09][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2A30 count 1
[11:05:09][V][modbus:184]: Modbus write: 01.04.2A.30.00.01.39.DD (8)
[11:05:09][V][modbus_controller:465]: Command sent 4 0x2A30 1
[11:05:09][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:09][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:09][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:10][V][modbus:058]: Modbus received Byte 48 (0X30)
[11:05:10][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:10][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:10][V][modbus:058]: Modbus received Byte 57 (0X39)
[11:05:10][V][modbus:058]: Modbus received Byte 221 (0Xdd)
[11:05:10][D][modbus_controller:032]: Modbus command to device=1 register=0x2A30 countdown=0 no response received - removed from send queue
[11:05:10][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2AF9 count 1
[11:05:10][V][modbus:184]: Modbus write: 01.04.2A.F9.00.01.E9.E3 (8)
[11:05:10][V][modbus_controller:465]: Command sent 4 0x2AF9 1
[11:05:10][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:10][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:10][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:10][V][modbus:058]: Modbus received Byte 249 (0Xf9)
[11:05:10][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:10][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:10][V][modbus:058]: Modbus received Byte 233 (0Xe9)
[11:05:10][V][modbus:058]: Modbus received Byte 227 (0Xe3)
[11:05:10][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2AF9 count 1
[11:05:10][V][modbus:184]: Modbus write: 01.04.2A.F9.00.01.E9.E3 (8)
[11:05:10][V][modbus_controller:465]: Command sent 4 0x2AF9 1
[11:05:10][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:10][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:10][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:10][V][modbus:058]: Modbus received Byte 249 (0Xf9)
[11:05:10][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:10][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:10][V][modbus:058]: Modbus received Byte 233 (0Xe9)
[11:05:10][V][modbus:058]: Modbus received Byte 227 (0Xe3)
[11:05:10][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2AF9 count 1
[11:05:10][V][modbus:184]: Modbus write: 01.04.2A.F9.00.01.E9.E3 (8)
[11:05:10][V][modbus_controller:465]: Command sent 4 0x2AF9 1
[11:05:10][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:10][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:10][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:10][V][modbus:058]: Modbus received Byte 249 (0Xf9)
[11:05:10][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:10][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:10][V][modbus:058]: Modbus received Byte 233 (0Xe9)
[11:05:10][V][modbus:058]: Modbus received Byte 227 (0Xe3)
[11:05:11][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2AF9 count 1
[11:05:11][V][modbus:184]: Modbus write: 01.04.2A.F9.00.01.E9.E3 (8)
[11:05:11][V][modbus_controller:465]: Command sent 4 0x2AF9 1
[11:05:11][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:11][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:11][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:11][V][modbus:058]: Modbus received Byte 249 (0Xf9)
[11:05:11][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:11][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:11][V][modbus:058]: Modbus received Byte 233 (0Xe9)
[11:05:11][V][modbus:058]: Modbus received Byte 227 (0Xe3)
[11:05:11][V][modbus_controller:036]: Sending next modbus command to device 1 register 0x2AF9 count 1
[11:05:11][V][modbus:184]: Modbus write: 01.04.2A.F9.00.01.E9.E3 (8)
[11:05:11][V][modbus_controller:465]: Command sent 4 0x2AF9 1
[11:05:11][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:11][V][modbus:058]: Modbus received Byte 4 (0X4)
[11:05:11][V][modbus:058]: Modbus received Byte 42 (0X2a)
[11:05:11][V][modbus:058]: Modbus received Byte 249 (0Xf9)
[11:05:11][V][modbus:058]: Modbus received Byte 0 (0X0)
[11:05:11][V][modbus:058]: Modbus received Byte 1 (0X1)
[11:05:11][V][modbus:058]: Modbus received Byte 233 (0Xe9)
[11:05:11][V][modbus:058]: Modbus received Byte 227 (0Xe3)
[11:05:11][D][modbus_controller:032]: Modbus command to device=1 register=0x2AF9 countdown=0 no response received - removed from send queue
It seems this is the main error message
[11:05:11][D][modbus_controller:032]: Modbus command to device=1 register=0x2AF9 countdown=0
but I’m not sure what it means.
What I have tried so far:
- swap RX and TX
- add
send_wait_time: 500ms
- Tried different addresses, register types and valuetypes
Very thankfull to anyone with some more experience to help me out!