Last active
November 9, 2024 21:00
-
-
Save vladyspavlov/5ac21cb58923482eff8e7bbb2d0854b3 to your computer and use it in GitHub Desktop.
Must inverter ESPHome configuration for ESP32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
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}