Skip to content

Instantly share code, notes, and snippets.

@vladyspavlov
Last active November 9, 2024 21:00
Show Gist options
  • Save vladyspavlov/5ac21cb58923482eff8e7bbb2d0854b3 to your computer and use it in GitHub Desktop.
Save vladyspavlov/5ac21cb58923482eff8e7bbb2d0854b3 to your computer and use it in GitHub Desktop.
Must inverter ESPHome configuration for ESP32
substitutions:
inverter_id: inverter
updates: 5s
api_key: xxx
ota_password: xxx
esphome:
name: inverter-monitor
comment: "Inverter monitor"
esp32:
board: esp32dev
framework:
type: esp-idf
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
logger:
level: DEBUG
api:
encryption:
key: ${api_key}
ota:
password: ${ota_password}
uart:
- id: uart_inverter
baud_rate: 19200
tx_pin: GPIO19
rx_pin: GPIO18
stop_bits: 1
parity: NONE
data_bits: 8
debug:
direction: BOTH
dummy_receiver: false
modbus:
- id: modbus_inverter
uart_id: uart_inverter
send_wait_time: 200ms
modbus_controller:
- id: must_inverter
address: 0x04
modbus_id: modbus_inverter
command_throttle: 200ms
setup_priority: -10
update_interval: ${updates}
sensor:
# charger sensors
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15201
name: "PV Charger Workstate"
register_type: holding
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15202
name: "PV Charger MPPT state"
register_type: holding
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15203
name: "PV Charger Charging state"
register_type: holding
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15205
name: "PV Charger Voltage"
register_type: holding
unit_of_measurement: "V"
accuracy_decimals: 1
icon: mdi:sine-wave
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15206
name: "PV Charger Battery voltage"
register_type: holding
unit_of_measurement: "V"
accuracy_decimals: 1
icon: mdi:sine-wave
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15207
name: "PV Charger Current"
register_type: holding
unit_of_measurement: "A"
accuracy_decimals: 1
icon: mdi:current-dc
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15208
register_type: holding
name: "PV Charger power"
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15209
register_type: holding
name: "PV Charger Radiator temp"
unit_of_measurement: "°C"
accuracy_decimals: 1
icon: mdi:temperature-celsius
# - platform: modbus_controller
# modbus_controller_id: must_inverter
# address: 15210
# register_type: holding
# name: "PV Charger External temp"
# unit_of_measurement: "°C"
# accuracy_decimals: 1
# icon: mdi:temperature-celsius
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15212
register_type: holding
name: "PV Relay"
icon: mdi:electric-switch
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15217
register_type: holding
id: charger_total_mwh
internal: true
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15218
register_type: holding
id: charger_total_kwh
internal: true
filters:
multiply: 0.1
- platform: template
name: "PV Charger Accumulated charger power"
unit_of_measurement: kWh
lambda: !lambda 'return (id(charger_total_mwh).state * 1000.0 + id(charger_total_kwh).state );'
accuracy_decimals: 1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15219
register_type: holding
name: "PV Charger Accumulated day"
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15220
register_type: holding
name: "PV Charger Accumulated hour"
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 15221
register_type: holding
name: "PV Charger Accumulated minute"
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
# inverter sensors
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25201
register_type: holding
name: "Inverter Work state"
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25205
name: "Inverter Battery Voltage"
register_type: holding
unit_of_measurement: "V"
accuracy_decimals: 1
icon: mdi:sine-wave
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25206
name: "Inverter Voltage"
register_type: holding
unit_of_measurement: "V"
accuracy_decimals: 1
icon: mdi:sine-wave
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25207
name: "Inverter Grid voltage"
register_type: holding
unit_of_measurement: "V"
accuracy_decimals: 1
icon: mdi:sine-wave
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25207
name: "Inverter Grid voltage"
register_type: holding
unit_of_measurement: "V"
accuracy_decimals: 1
icon: mdi:sine-wave
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25208
name: "Inverter BUS Voltage"
register_type: holding
unit_of_measurement: "V"
accuracy_decimals: 1
icon: mdi:sine-wave
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25209
name: "Inverter Control current"
register_type: holding
unit_of_measurement: "A"
accuracy_decimals: 1
icon: mdi:current-dc
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25210
name: "Inverter Current"
register_type: holding
unit_of_measurement: "A"
accuracy_decimals: 1
icon: mdi:current-dc
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25211
name: "Inverter Grid current"
register_type: holding
unit_of_measurement: "A"
accuracy_decimals: 1
icon: mdi:current-ac
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25212
name: "Inverter Load current"
register_type: holding
unit_of_measurement: "A"
accuracy_decimals: 1
icon: mdi:current-ac
filters:
multiply: 0.1
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25213
name: "Inverter Power"
register_type: holding
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25214
name: "Inverter Grid power"
register_type: holding
unit_of_measurement: "W"
accuracy_decimals: 1
value_type: S_WORD
icon: mdi:flash
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25215
name: "Inverter Load power"
register_type: holding
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25216
name: "Inverter System load"
register_type: holding
unit_of_measurement: "%"
accuracy_decimals: 1
icon: mdi:flash
# MOST INFO
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25233
register_type: holding
name: "Inverter AC radiator temp"
accuracy_decimals: 1
unit_of_measurement: "°C"
icon: mdi:temperature-celsius
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25234
register_type: holding
name: "Inverter Transformer temp"
unit_of_measurement: "°C"
accuracy_decimals: 1
icon: mdi:temperature-celsius
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25235
register_type: holding
name: "Inverter DC Radiator temp"
unit_of_measurement: "°C"
accuracy_decimals: 1
icon: mdi:temperature-celsius
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25237
register_type: holding
name: "Inverter Relay state"
icon: mdi:electric-switch
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25238
register_type: holding
name: "Inverter Relay state Grid"
icon: mdi:electric-switch
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25239
register_type: holding
name: "Inverter Relay state Load"
icon: mdi:electric-switch
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25240
register_type: holding
name: "Inverter Relay state NLine"
icon: mdi:electric-switch
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25241
register_type: holding
name: "Inverter Relay state DC"
icon: mdi:electric-switch
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25242
register_type: holding
name: "Inverter Relay state Earth"
icon: mdi:electric-switch
# Inverter Accumulated discharge power
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25247
register_type: holding
id: discharger_total_mwh
internal: true
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25248
register_type: holding
id: discharger_total_kwh
internal: true
filters:
multiply: 0.1
- platform: template
name: "Accumulated discharger power"
unit_of_measurement: kWh
accuracy_decimals: 1
lambda: !lambda 'return (id(discharger_total_mwh).state * 1000.0 + id(discharger_total_kwh).state);'
# Inverter Accumulated buy power
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25249
register_type: holding
id: buy_mwh
internal: true
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25250
register_type: holding
id: buy_kwh
internal: true
filters:
multiply: 0.1
- platform: template
name: "Accumulated buy power"
unit_of_measurement: kWh
lambda: |-
return (id(buy_mwh).state * 1000.0 + id(buy_kwh).state);
accuracy_decimals: 1
# Inverter Accumulated sell power
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25251
register_type: holding
id: sell_mwh
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25252
register_type: holding
id: sell_kwh
filters:
multiply: 0.1
- platform: template
name: "Accumulated sell power"
unit_of_measurement: kWh
accuracy_decimals: 1
lambda: !lambda return (id(sell_mwh).state * 1000.0 + id(sell_kwh).state);
# Inverter Accumulated load power
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25253
register_type: holding
id: load_mwh
internal: True
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25254
register_type: holding
id: load_kwh
internal: True
filters:
multiply: 0.1
- platform: template
name: "Accumulated load power"
unit_of_measurement: kWh
accuracy_decimals: 1
lambda: !lambda return (id(load_mwh).state * 1000.0 + id(load_kwh).state);
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25273
register_type: holding
value_type: S_WORD
name: "Inverter Battery power"
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25274
register_type: holding
value_type: S_WORD
name: "Inverter Battery current"
unit_of_measurement: "A"
accuracy_decimals: 1
icon: mdi:current-dc
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25275
register_type: holding
value_type: S_WORD
name: "Inverter Battery grade"
unit_of_measurement: "V"
icon: mdi:alpha-V
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 25277
register_type: holding
name: "Inverter Rated power"
unit_of_measurement: "W"
accuracy_decimals: 1
icon: mdi:flash
select:
- platform: modbus_controller
modbus_controller_id: must_inverter
id: energy_use_mode
name: "Inverter Energy use mode (parameter 00)"
address: 20109
optionsmap:
"SBU (Solar/battery/utility)": 1
"SUB (Solar/utility/battery)": 2
"UTI (Utility only)": 3
"SOL (Solar only)": 4
- platform: modbus_controller
modbus_controller_id: must_inverter
id: charger_source_priority
name: "Inverter Charger source priority (parameter 10)"
address: 20143
optionsmap:
"CSO (Solar first)": 0
"SNU (Solar and utility)": 2
"OSO (Solar only)": 3
- platform: modbus_controller
modbus_controller_id: must_inverter
address: 20111
id: inverter_ac_input_voltage_range
name: "Inverter AC input voltage range (02)"
optionsmap:
"VDE (184-253VAC)": 0
"UPS (170-280VAC)": 1
"APL (90-280VAC)": 2
"GEN (Generator)": 3
number:
- platform: modbus_controller
id: batt_float_voltage
name: "PV Charger Float voltage"
unit_of_measurement: "V"
address: 10103
value_type: U_WORD
multiply: 10
- platform: modbus_controller
id: batt_absorb_voltage
name: "PV Charger Absorb voltage"
unit_of_measurement: "V"
address: 10104
value_type: U_WORD
multiply: 10
- platform: modbus_controller
id: batt_stop_dischg
name: "Inverter Battery stop discharging voltage"
unit_of_measurement: "V"
address: 20118
value_type: U_WORD
lambda: "return x * 0.1; "
write_lambda: |-
return x * 10 ;
- platform: modbus_controller
id: batt_stop_chg
name: "Inverter Battery stop charging voltage"
unit_of_measurement: "V"
address: 20119
value_type: U_WORD
multiply: 10
- platform: modbus_controller
id: batt_low_voltage
name: "Inverter Battery low voltage"
unit_of_measurement: "V"
address: 20127
value_type: U_WORD
multiply: 10
- platform: modbus_controller
id: batt_high_voltage
name: "Inverter Battery high voltage"
unit_of_measurement: "V"
address: 20128
value_type: U_WORD
multiply: 10
- platform: modbus_controller
id: solar_charger_current
name: "Inverter Charger current"
unit_of_measurement: "A"
address: 20132
value_type: U_WORD
multiply: 10
@avfoto
Copy link

avfoto commented Dec 19, 2023

Ok, many thanks!!!

@omarmeleis
Copy link

I am getting this error,,

*** [.pioenvs/inverter-monitor/src/esphome/components/modbus_controller/text_sensor/modbus_textsensor.o] Source src/esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp' not found, needed by target .pioenvs/inverter-monitor/src/esphome/components/modbus_controller/text_sensor/modbus_textsensor.o'.

========================= [FAILED] Took 26.38 seconds =========================

any idea why ?

@vladyspavlov
Copy link
Author

I am getting this error,,

*** [.pioenvs/inverter-monitor/src/esphome/components/modbus_controller/text_sensor/modbus_textsensor.o] Source src/esphome/components/modbus_controller/text_sensor/modbus_textsensor.cpp' not found, needed by target .pioenvs/inverter-monitor/src/esphome/components/modbus_controller/text_sensor/modbus_textsensor.o'.

========================= [FAILED] Took 26.38 seconds =========================

any idea why ?

idk. Try to clean the build files if you changed something before.
Also, try to update ESPHome to the latest version. I used this configuration a few days ago, and it works without any issues.

@omarmeleis
Copy link

Thanks for the solution, i have tried clean build files and it worked :D

However now am unable to read any data and giving me the following error

[22:40:21][D][uart_debug:114]: >>> 04:03:3B:61:00:03:59:64
[22:40:21][D][uart_debug:114]: >>> 04:03:3B:61:00:03:59:64
[22:40:21][D][uart_debug:114]: >>> 04:03:3B:61:00:03:59:64
[22:40:22][D][uart_debug:114]: >>> 04:03:3B:61:00:03:59:64
[22:40:22][D][uart_debug:114]: >>> 04:03:3B:61:00:03:59:64
[22:40:22][D][modbus_controller:043]: Modbus command to device=4 register=0x3B61 countdown=0 no response received - removed from send queue
[22:40:22][D][uart_debug:114]: >>> 04:03:62:75:00:0C:4B:F8
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=10103 count=2
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=15205 count=5
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=15212 count=1
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=15217 count=5
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20109 count=1
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20111 count=1
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20118 count=2
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25205 count=12
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25233 count=3
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25237 count=6
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25247 count=8
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25273 count=3
[22:40:22][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25277 count=1
[22:40:22][W][component:214]: Component modbus_controller took a long time for an operation (0.08 s).
[22:40:22][W][component:215]: Components should block for at most 20-30ms.
[22:40:22][D][uart_debug:114]: >>> 04:03:62:75:00:0C:4B:F8
[22:40:23][D][uart_debug:114]: >>> 04:03:62:75:00:0C:4B:F8
[22:40:23][D][uart_debug:114]: >>> 04:03:62:75:00:0C:4B:F8
[22:40:23][D][uart_debug:114]: >>> 04:03:62:75:00:0C:4B:F8
[22:40:23][D][modbus_controller:043]: Modbus command to device=4 register=0x6275 countdown=0 no response received - removed from send queue
[22:40:23][D][uart_debug:114]: >>> 04:03:62:91:00:03:4B:CB
[22:40:23][D][uart_debug:114]: >>> 04:03:62:91:00:03:4B:CB
[22:40:24][D][uart_debug:114]: >>> 04:03:62:91:00:03:4B:CB
[22:40:24][D][uart_debug:114]: >>> 04:03:62:91:00:03:4B:CB
[22:40:24][D][uart_debug:114]: >>> 04:03:62:91:00:03:4B:CB
[22:40:24][D][modbus_controller:043]: Modbus command to device=4 register=0x6291 countdown=0 no response received - removed from send queue
[22:40:24][D][uart_debug:114]: >>> 04:03:62:95:00:06:CA:09
[22:40:25][D][uart_debug:114]: >>> 04:03:62:95:00:06:CA:09
[22:40:25][D][uart_debug:114]: >>> 04:03:62:95:00:06:CA:09
[22:40:25][D][uart_debug:114]: >>> 04:03:62:95:00:06:CA:09
[22:40:25][D][uart_debug:114]: >>> 04:03:62:95:00:06:CA:09
[22:40:25][D][modbus_controller:043]: Modbus command to device=4 register=0x6295 countdown=0 no response received - removed from send queue
[22:40:25][D][uart_debug:114]: >>> 04:03:62:9F:00:08:6B:CF
[22:40:26][D][uart_debug:114]: >>> 04:03:62:9F:00:08:6B:CF
[22:40:26][D][uart_debug:114]: >>> 04:03:62:9F:00:08:6B:CF
[22:40:26][D][uart_debug:114]: >>> 04:03:62:9F:00:08:6B:CF
[22:40:26][D][uart_debug:114]: >>> 04:03:62:9F:00:08:6B:CF
[22:40:26][D][modbus_controller:043]: Modbus command to device=4 register=0x629F countdown=0 no response received - removed from send queue
[22:40:26][D][uart_debug:114]: >>> 04:03:3B:65:00:05:98:A7
[22:40:27][D][uart_debug:114]: >>> 04:03:3B:65:00:05:98:A7
[22:40:27][D][uart_debug:114]: >>> 04:03:3B:65:00:05:98:A7
[22:40:27][D][uart_debug:114]: >>> 04:03:3B:65:00:05:98:A7
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=10103 count=2
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=15201 count=3
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=15205 count=5
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=15212 count=1
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=15217 count=5
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20109 count=1
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20111 count=1
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20118 count=2
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20127 count=2
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20132 count=1
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=20143 count=1
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25201 count=1
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25273 count=3
[22:40:27][W][modbus_controller:136]: Duplicate modbus command found: type=0x3 address=25277 count=1
[22:40:27][W][component:214]: Component modbus_controller took a long time for an operation (0.09 s).
[22:40:27][W][component:215]: Components should block for at most 20-30ms.
[22:40:27][D][uart_debug:114]: >>> 04:03:3B:65:00:05:98:A7
[22:40:27][D][modbus_controller:043]: Modbus command to device=4 register=0x3B65 countdown=0 no response received - removed from send queue
[22:40:28][D][uart_debug:114]: >>> 04:03:3B:6C:00:01:49:66
[22:40:28][D][uart_debug:114]: >>> 04:03:3B:6C:00:01:49:66
[22:40:28][D][uart_debug:114]: >>> 04:03:3B:6C:00:01:49:66
[22:40:28][D][uart_debug:114]: >>> 04:03:3B:6C:00:01:49:66
[22:40:28][D][uart_debug:114]: >>> 04:03:3B:6C:00:01:49:66
[22:40:28][D][modbus_controller:043]: Modbus command to device=4 register=0x3B6C countdown=0 no response received - removed from send queue

@vladyspavlov
Copy link
Author

@omarmeleis Try to swap RX/TX and/or A/B on the RS485 converter

@omarmeleis
Copy link

Already tried that,, i will try another RS485 to UART board and update

@vladyspavlov
Copy link
Author

Already tried that,, i will try another RS485 to UART board and update

I used this one, works ok:
https://www.aliexpress.com/item/1005001621746811.html

I also connected it to the USB port of the inverter. It uses the same RS485 (at least on the PV1800 series, as far as I know), but additionally has 5V to power the ESP and adapter, so you don't need to use an additional power supply.

So, in my case, 5V connected to the ESP, GND connected to the RS485 converter board GND and to the GND of the ESP, and middle USB pins to A/B (not sure which one is which, try to swap if it does not work). The 3.3V from the ESP connected to the other side of the RS485 converter board to the VCC, RX/TX to the ESP and swapped, and the ESP GND to the board GND.

@omarmeleis
Copy link

i am using this exact module :D as the one you are using,,,,, but getting my A/B wires not from the usb port but from the ethernet jack,, where pin 1 in B and pin 2 is A

I am using a 3k must Pv1800 series

I will try using the pins from the USB port now and update u

@youmax01
Copy link

amazing project!!!!, work like a charm thaaaaaaaaaaaaaaaaanks!!!

for add option to config:

switch: #RESET BOARD ON DEMAND

  • platform: restart
    name: "ESP32 Reset"

sensor:

  • platform: internal_temperature
    name: "ESP32 Internal Temperature"

  • platform: wifi_signal
    name: "ESP32 WiFi Signal Sensor"
    id: wifisignal
    update_interval: 60s

@LionBS76
Copy link

i am using this exact module :D as the one you are using,,,,, but getting my A/B wires not from the usb port but from the ethernet jack,, where pin 1 in B and pin 2 is A

I am using a 3k must Pv1800 series

I will try using the pins from the USB port now and update u

Hello!
And what the result ?

I'm in such situation. Have an ESP8266 with ESP-Link image (serial to wireless bridge) on it.
Connect the RS485-TTL board and connect it to inverter (Must PV1800) and trying to connect it ti Home Assistant.
Can't get it working (

@LionBS76
Copy link

Already tried that,, i will try another RS485 to UART board and update

I used this one, works ok: https://www.aliexpress.com/item/1005001621746811.html

I also connected it to the USB port of the inverter. It uses the same RS485 (at least on the PV1800 series, as far as I know), but additionally has 5V to power the ESP and adapter, so you don't need to use an additional power supply.

So, in my case, 5V connected to the ESP, GND connected to the RS485 converter board GND and to the GND of the ESP, and middle USB pins to A/B (not sure which one is which, try to swap if it does not work). The 3.3V from the ESP connected to the other side of the RS485 converter board to the VCC, RX/TX to the ESP and swapped, and the ESP GND to the board GND.

Вітаю!
Тобто ви підключили плату RS485 не до RJ-45 а до порта USB Type-A (позначений як USB WiFi) ?

@vladyspavlov
Copy link
Author

vladyspavlov commented Sep 21, 2024

Вітаю! Тобто ви підключили плату RS485 не до RJ-45 а до порта USB Type-A (позначений як USB WiFi) ?

Yes

@bigdigital
Copy link

bigdigital commented Sep 26, 2024

Already tried that,, i will try another RS485 to UART board and update

I used this one, works ok: https://www.aliexpress.com/item/1005001621746811.html
I also connected it to the USB port of the inverter. It uses the same RS485 (at least on the PV1800 series, as far as I know), but additionally has 5V to power the ESP and adapter, so you don't need to use an additional power supply.
So, in my case, 5V connected to the ESP, GND connected to the RS485 converter board GND and to the GND of the ESP, and middle USB pins to A/B (not sure which one is which, try to swap if it does not work). The 3.3V from the ESP connected to the other side of the RS485 converter board to the VCC, RX/TX to the ESP and swapped, and the ESP GND to the board GND.

Вітаю! Тобто ви підключили плату RS485 не до RJ-45 а до порта USB Type-A (позначений як USB WiFi) ?

Вітаю. Якраз на днях доробив проект для підтримки MUST PH/PV1800 softwarecrash/Solar2MQTT#131 на ESP через MQTT. Все чудово працює. Рекомендую. З приводу підключення RX/TX до USB , щось там наплутали. Так і спалить вихід можна. В середині інвертора до юсб підключений USB -> com перетворювач. Ніяких RX/TX там не отримать.

@bernstein7
Copy link

Already tried that,, i will try another RS485 to UART board and update

I used this one, works ok: https://www.aliexpress.com/item/1005001621746811.html
I also connected it to the USB port of the inverter. It uses the same RS485 (at least on the PV1800 series, as far as I know), but additionally has 5V to power the ESP and adapter, so you don't need to use an additional power supply.
So, in my case, 5V connected to the ESP, GND connected to the RS485 converter board GND and to the GND of the ESP, and middle USB pins to A/B (not sure which one is which, try to swap if it does not work). The 3.3V from the ESP connected to the other side of the RS485 converter board to the VCC, RX/TX to the ESP and swapped, and the ESP GND to the board GND.

Вітаю! Тобто ви підключили плату RS485 не до RJ-45 а до порта USB Type-A (позначений як USB WiFi) ?

Привіт. У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

@vladyspavlov
Copy link
Author

З приводу підключення RX/TX до USB , щось там наплутали. Так і спалить вихід можна. В середині інвертора до юсб підключений USB -> com перетворювач. Ніяких RX/TX там не отримать.

Я нічого не наплутав, у мене прямо зараз працює така схема. Перетворювач в самому usb-донглі, а не в порті.

@vladyspavlov
Copy link
Author

У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

Яка саме модель інвертора у вас?

@bernstein7
Copy link

У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

Яка саме модель інвертора у вас?

MUST pv18-5248 pro

@LionBS76
Copy link

LionBS76 commented Sep 30, 2024

Already tried that,, i will try another RS485 to UART board and update

I used this one, works ok: https://www.aliexpress.com/item/1005001621746811.html
I also connected it to the USB port of the inverter. It uses the same RS485 (at least on the PV1800 series, as far as I know), but additionally has 5V to power the ESP and adapter, so you don't need to use an additional power supply.
So, in my case, 5V connected to the ESP, GND connected to the RS485 converter board GND and to the GND of the ESP, and middle USB pins to A/B (not sure which one is which, try to swap if it does not work). The 3.3V from the ESP connected to the other side of the RS485 converter board to the VCC, RX/TX to the ESP and swapped, and the ESP GND to the board GND.

Вітаю! Тобто ви підключили плату RS485 не до RJ-45 а до порта USB Type-A (позначений як USB WiFi) ?

Привіт. У вас вийшло зробити комунікацію таким чином через USB WiFi порт? Я всі комбінації A+/B- та Rx/Tx спробував, не працює

якщо питання до мене, то так, у мене вийшло.
Поки до HomeAssistamt не підключив, але віддалено оригінальним софтом Solar Power Monitor від Must я підключився через WiFi (ESP + esp-link) до інвертора Must PV18-3224.

@vladyspavlov
Copy link
Author

vladyspavlov commented Sep 30, 2024

У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

Яка саме модель інвертора у вас?

MUST pv18-5248 pro

У мене такий же інвертор, все працює.

Video

В червоній термоусадці модуль RS485 - TTL, посилання кидав вище.

@kiberhim
Copy link

У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

Яка саме модель інвертора у вас?

MUST pv18-5248 pro

У мене такий же інвертор, все працює.

Video

В червоній термоусадці модуль RS485 - TTL, посилання кидав вище.

Доброї ночі. Щось я не зрозумів, у вас на ESP32 все базовано?

@vladyspavlov
Copy link
Author

vladyspavlov commented Sep 30, 2024

У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

Яка саме модель інвертора у вас?

MUST pv18-5248 pro

У мене такий же інвертор, все працює.
Video
В червоній термоусадці модуль RS485 - TTL, посилання кидав вище.

Доброї ночі. Щось я не зрозумів, у вас на ESP32 все базовано?

Так. Конкретно на відео - WT32, але поки що на вай-фаї

@gjury
Copy link

gjury commented Sep 30, 2024

Thanks for this file!. I confirm it is working perfectly fine in my MUST PV18-3024 VHM
You have a couple of additional registers missing although:
address: 25225
name: "Inverter frequency"
unit_of_measurement: "Hz"

address: 25226
name: "Grid frequency"

@kiberhim
Copy link

У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

Яка саме модель інвертора у вас?

MUST pv18-5248 pro

У мене такий же інвертор, все працює.
Video
В червоній термоусадці модуль RS485 - TTL, посилання кидав вище.

Доброї ночі. Щось я не зрозумів, у вас на ESP32 все базовано?

Так. Конкретно на відео - WT32, але поки що на вай-фаї

Тобто це така сама solar2mqtt? У мене так і не виходить одружити з моїм anenji. 6500вт 48в. У нього на борту 232 та 485 порти, я правильно зрозумів, 232 до вайфай, у мене він є та працює (заводський) але додтаок та сервери ... це мрак. У мене також є налаштований та працюючий home assistant. 485 для підключення фірмових батарей? Я тільки сьогодні побачив цей пост, допаяв до esp8266 (nodeMCU) все як у вас, ткнув в 485 - нема (перетворювач у мене э). 232 - так само, також э саморобний перетворювач на max232 та заводський. Байдуже, тиша. Можливо є якісь інші распіновки? але ж живлення та земля співпадають у мене 4й 12в, 8й - земля. Це я про 232. У вас є схема та бінарний файл для вашого девайсу? Можливо є для 8266?

@bernstein7
Copy link

bernstein7 commented Oct 1, 2024

У вас вийшло зробити комунікацію таким чином через USB WiFi порт?
Я всі комбінації A+/B- та Rx/Tx спробував, не працює

Яка саме модель інвертора у вас?

MUST pv18-5248 pro

У мене такий же інвертор, все працює.

Video

В червоній термоусадці модуль RS485 - TTL, посилання кидав вище.

Такий же інвертор, така сама RS485-TTL, на базі esp32 wroom32 (gpio 1/3 у якості tx/rx) - все перепробував, досі отримую

[21:33:24][D][modbus_controller:038]: Modbus command to device=4 register=0x6295 no response received - removed from send queue

для всіх каналів. Вже не знаю яку ще комбінацію спробувати.

UPD: ще отакий побачив ворнінг

[22:59:44][W][modbus_controller:027]: Modbus device=4 set offline

UPD: спробував інший rs-485-ttl та А/В брати з перших пінів RJ45, а не USB WiFi, результат такий самий

@LionBS76
Copy link

LionBS76 commented Oct 2, 2024

Такий же інвертор, така сама RS485-TTL, на базі esp32 wroom32 (gpio 1/3 у якості tx/rx) - все перепробував, досі отримую

[21:33:24][D][modbus_controller:038]: Modbus command to device=4 register=0x6295 no response received - removed from send queue

для всіх каналів. Вже не знаю яку ще комбінацію спробувати.

UPD: ще отакий побачив ворнінг

[22:59:44][W][modbus_controller:027]: Modbus device=4 set offline

UPD: спробував інший rs-485-ttl та А/В брати з перших пінів RJ45, а не USB WiFi, результат такий самий

Я не читав ще про Wroom плату, але у мене була схожа ситуація з NodeMCU (ESP8266). Проблема у тому, що на платі для розробок NodeMCU вже є модуль USB-UART і він під'єднаний до RX/TX контролера. І виявляється що він постійно тримає RX в стані HIGH. Тобто використовувати RX пін напряму майже не можливо.
Можливо з wroom платою така сама засада ?

@bernstein7
Copy link

Такий же інвертор, така сама RS485-TTL, на базі esp32 wroom32 (gpio 1/3 у якості tx/rx) - все перепробував, досі отримую

[21:33:24][D][modbus_controller:038]: Modbus command to device=4 register=0x6295 no response received - removed from send queue

для всіх каналів. Вже не знаю яку ще комбінацію спробувати.
UPD: ще отакий побачив ворнінг

[22:59:44][W][modbus_controller:027]: Modbus device=4 set offline

UPD: спробував інший rs-485-ttl та А/В брати з перших пінів RJ45, а не USB WiFi, результат такий самий

Я не читав ще про Wroom плату, але у мене була схожа ситуація з NodeMCU (ESP8266). Проблема у тому, що на платі для розробок NodeMCU вже є модуль USB-UART і він під'єднаний до RX/TX контролера. І виявляється що він постійно тримає RX в стані HIGH. Тобто використовувати RX пін напряму майже не можливо. Можливо з wroom платою така сама засада ?

Дійсно, перекинув на інші gpio піни які вміють UART і запрацювало.
Велика подяка вам і автору конфіга!

@LionBS76
Copy link

LionBS76 commented Oct 7, 2024

Hello!
Your config works for me only once :)

Now it logs out this:

21:46:07 | [E] | [json:041] | Could not allocate memory for JSON document! Requested 512 bytes, largest free heap block: 512 bytes
21:46:07 | [E] | [json:041] | Could not allocate memory for JSON document! Requested 512 bytes, largest free heap block: 512 bytes
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=10103 count=2
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20127 count=2
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20132 count=1
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20143 count=1
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25201 count=1
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25205 count=12
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25233 count=3
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25237 count=6
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25247 count=8
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25273 count=3
21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25277 count=1
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=15201 count=3
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=15205 count=5
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=15212 count=1
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=15217 count=5
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20109 count=1
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20111 count=1
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20118 count=2
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25233 count=3
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25237 count=6
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25247 count=8
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25273 count=3
21:46:24 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25277 count=1
21:46:29 | [I] | [safe_mode:041] | Boot seems successful; resetting boot loop counter
21:46:34 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=10103 count=2
21:46:34 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=15205 count=5
21:46:34 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=15212 count=1
21:46:34 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=15217 count=5

Do you know where is the problem ?

And thanks for you work !

@LionBS76
Copy link

LionBS76 commented Oct 8, 2024

Hello! Your config works for me only once :)

Now it logs out this:

21:46:07 | [E] | [json:041] | Could not allocate memory for JSON document! Requested 512 bytes, largest free heap block: 512 bytes 21:46:07 | [E] | [json:041] | Could not allocate memory for JSON document! Requested 512 bytes, largest free heap block: 512 bytes 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=10103 count=2 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20127 count=2 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20132 count=1 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=20143 count=1 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25201 count=1 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25205 count=12 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25233 count=3 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25237 count=6 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25247 count=8 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25273 count=3 21:46:14 | [W] | [modbus_controller:181] | Duplicate modbus command found: type=0x3 address=25277 count=1 21:46:24 | [W] | [modbus_controller:181] |

Do you know where is the problem ?

And thanks for you work !

Have additional experiments and results.
I use ESP-01 with latest ESPHome firmware + your YAML config. I chosed original RX/TX for communication with RS485 becouse ESP-01 have only this pins.
So , it works if I doesn't try to view LOGs from device.
If i try to view LOGs - Inverter are stuck and stop give parameters. And only one solution - restart Inverter.
So I suppose that LOG (Debug) use the same UART and thus stuck Inverter with flooded information.
I have changed UART for logging but withh no success ;(

I use such config, but only works if don't use LOG :)

esp8266:
board: esp01_1m

# Enable logging
logger:
level: DEBUG
hardware_uart: UART1
baud_rate: 0

uart:
- id: uart_inverter
baud_rate: 19200
tx_pin: GPIO01
rx_pin: GPIO03
stop_bits: 1
parity: NONE
data_bits: 8
debug:
direction: BOTH
dummy_receiver: false

modbus:
- id: modbus_inverter
uart_id: uart_inverter
send_wait_time: 300ms

modbus_controller:
- id: must_inverter
address: 0x04
modbus_id: modbus_inverter
command_throttle: 300ms
setup_priority: -10
update_interval: ${updates}

@alexsobolev1076
Copy link

alexsobolev1076 commented Nov 9, 2024

There is a mistake in the code probably, adress should be 0x4, not 0x04

modbus_controller:

  • id: must_inverter
    address: 0x04
    modbus_id: modbus_inverter
    command_throttle: 200ms
    setup_priority: -10
    update_interval: ${updates}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment