hi.
This is the esphome code for Growatt SPF 5000 ES.
I’m using a d1 mini with a ttl converter.
This code allows changing the parameters of the inverter. BE CAREFUL !! (The worst thing that can happen is you have to configure the inverter again.)
The code has all the configurations that I was able to find, it doesn’t mean that they are all here.
The names are the factory names, I don’t change anything.
Thanks to all.
substitutions:
device_name: inv1
friendly_name: "inv1"
device_description: "Growatt SPF 5000 ES"
esphome:
name: '${device_name}'
comment: '${device_description}'
esp8266:
board: d1_mini
# Enable logging
logger:
baud_rate: 0
level: DEBUG
# Enable Home Assistant API
api:
encryption:
key: " your new api key " # https://esphome.io/components/api.html
ota:
safe_mode: true
reboot_timeout: 10min
num_attempts: 5
#web_server:
# port: 80
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
reboot_timeout: 2min
# Optional manual IP
# Enable fallback hotspot (captive portal) in case wifi connection fails
# ap:
# ssid: '${device_name}'
# password: !secret wifi_password
captive_portal:
time:
- platform: homeassistant
id: homeassistant_time
uart:
id: mod_bus
tx_pin: 1
rx_pin: 3
baud_rate: 9600
#baud_rate: 115200
debug:
direction: RX
dummy_receiver: false
after:
delimiter: "\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
modbus:
id: modbus1
uart_id: mod_bus
# flow_control_pin: GPIO4
modbus_controller:
- id: growatt
address: 0x1
modbus_id: modbus1
setup_priority: -10
# update_interval: 30s
text_sensor:
- platform: template
name: "${friendly_name} Status"
icon: mdi:eye
entity_category: diagnostic
lambda: |-
if ((id(status).state) == 1) {
return {"Normal"};
} else if ((id(status).state) == 0) {
return {"Standby"};
} else if ((id(status).state) == 2) {
return {"Discharge"};
} else if ((id(status).state) == 3) {
return {"Fault"};
} else if ((id(status).state) == 4) {
return {"Flash"};
} else if ((id(status).state) == 5) {
return {"PV Charging"};
} else if ((id(status).state) == 6) {
return {"AC Charging"};
} else if ((id(status).state) == 7) {
return {"Combined Charging"};
} else if ((id(status).state) == 8) {
return {"Combined Charging & Bypass"};
} else if ((id(status).state) == 9) {
return {"PV Charging & Bypass"};
} else if ((id(status).state) == 10) {
return {"AC Charging & Bypass"};
} else if ((id(status).state) == 11) {
return {"Bypass"};
} else if (id(status).state == 12) {
return {"PV Charge and Discharge"};
} else {
return {"Unknown"};
}
sensor:
- platform: wifi_signal
name: "WiFi Signal Sensor"
update_interval: 60s
- platform: modbus_controller
address: 0
register_type: "read"
internal: true
accuracy_decimals: 0
id: status
#### temp ###
- platform: modbus_controller
name: "${friendly_name} Inverter Temperature"
address: 25
register_type: "read"
unit_of_measurement: °C
device_class: temperature
entity_category: diagnostic
state_class: measurement
icon: mdi:thermometer
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} PV Temperature"
address: 32
register_type: "read"
unit_of_measurement: °C
device_class: temperature
state_class: measurement
entity_category: diagnostic
icon: mdi:thermometer
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} DC‐DC Temperature "
address: 26
register_type: "read"
unit_of_measurement: °C
device_class: temperature
entity_category: diagnostic
state_class: measurement
icon: mdi:thermometer
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
### ac input ###
- platform: modbus_controller
name: "${friendly_name} AC Input Hz"
address: 21
register_type: "read"
device_class: FREQUENCY
unit_of_measurement: Hz
entity_category: diagnostic
state_class: measurement
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.01
- platform: modbus_controller
name: "${friendly_name} AC Input Voltage"
address: 20
register_type: "read"
unit_of_measurement: V
device_class: VOLTAGE
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} AC Charge Current"
address: 68
register_type: "read"
unit_of_measurement: A
device_class: CURRENT
entity_category: diagnostic
state_class: measurement
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} AC charge watt (low) "
address: 14
register_type: "read"
unit_of_measurement: W
device_class: POWER
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} AC input watt (low) "
address: 37
register_type: "read"
unit_of_measurement: W
device_class: POWER
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} AC charge Energy today "
address: 57
register_type: "read"
unit_of_measurement: KW
device_class: POWER
state_class: total_increasing
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
## ac output ##
- platform: modbus_controller
name: "${friendly_name} Output active power (low) "
address: 10
register_type: "read"
unit_of_measurement: W
device_class: power
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} AC output Volt"
address: 22
register_type: "read"
unit_of_measurement: V
device_class: voltage
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} Output Current "
address: 34
register_type: "read"
unit_of_measurement: A
device_class: current
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} AC discharge watt (low) "
address: 70
register_type: "read"
unit_of_measurement: W
device_class: power
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
## solar ##
- platform: modbus_controller
name: "${friendly_name} PV1 charge power (high) "
address: 3
register_type: "read"
unit_of_measurement: Wh
device_class: power
state_class: measurement
icon: mdi:solar-power
value_type: U_DWORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} PV1 voltage "
address: 1
register_type: "read"
unit_of_measurement: V
device_class: voltage
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} Buck1 current"
address: 7
register_type: "read"
unit_of_measurement: A
device_class: current
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
name: "${friendly_name} Epv1_today H"
address: 48
register_type: "read"
unit_of_measurement: KW
state_class: total_increasing
device_class: energy
icon: mdi:solar-power
value_type: U_DWORD
accuracy_decimals: 1
filters:
- multiply: 0.1
## bat ##
- platform: modbus_controller
name: "${friendly_name} Battery volt (M3)"
address: 17
register_type: "read"
unit_of_measurement: V
device_class: voltage
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.01
- platform: modbus_controller
name: "${friendly_name} Bus Voltage"
address: 19
register_type: "read"
unit_of_measurement: V
device_class: voltage
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.01
- platform: modbus_controller
name: "${friendly_name} fan speed"
address: 82
register_type: "read"
unit_of_measurement: "%"
device_class: POWER_FACTOR
state_class: measurement
entity_category: diagnostic
icon: mdi:flash
value_type: U_WORD
accuracy_decimals: 0
filters:
- multiply: 1
#### TTL RS485 ####
select:
- platform: modbus_controller
name: "${friendly_name} Charge Source"
address: 01
value_type: U_WORD
optionsmap:
"Pv Priority": 0
"Pv&Uti": 1
"Only Pv": 2
- platform: modbus_controller
name: "${friendly_name} Output Source"
address: 02
value_type: U_WORD
optionsmap:
"Bat Priority": 0
"Pv Priority": 1
"Uti Priority": 2
"Pv&Uti Priority": 3
- platform: modbus_controller
name: "${friendly_name} Uti Output Start Time"
address: 03
value_type: U_WORD
optionsmap:
"0h": 0
"1h": 1
"2h": 2
"3h": 3
"4h": 4
"5h": 5
"6h": 6
"7h": 7
"8h": 8
"9h": 9
"10h": 10
"11h": 11
"12h": 12
"13h": 13
"14h": 14
"15h": 15
"16h": 16
"17h": 17
"18h": 18
"19h": 19
"20h": 20
"21h": 21
"22h": 22
"23h": 23
- platform: modbus_controller
name: "${friendly_name} Uti Output End Time"
address: 04
value_type: U_WORD
optionsmap:
"0h": 0
"1h": 1
"2h": 2
"3h": 3
"4h": 4
"5h": 5
"6h": 6
"7h": 7
"8h": 8
"9h": 9
"10h": 10
"11h": 11
"12h": 12
"13h": 13
"14h": 14
"15h": 15
"16h": 16
"17h": 17
"18h": 18
"19h": 19
"20h": 20
"21h": 21
"22h": 22
"23h": 23
- platform: modbus_controller
name: "${friendly_name} Uti Charge Start Time"
address: 05
value_type: U_WORD
optionsmap:
"0h": 0
"1h": 1
"2h": 2
"3h": 3
"4h": 4
"5h": 5
"6h": 6
"7h": 7
"8h": 8
"9h": 9
"10h": 10
"11h": 11
"12h": 12
"13h": 13
"14h": 14
"15h": 15
"16h": 16
"17h": 17
"18h": 18
"19h": 19
"20h": 20
"21h": 21
"22h": 22
"23h": 23
- platform: modbus_controller
name: "${friendly_name} Uti Charge End Time"
address: 06
value_type: U_WORD
optionsmap:
"0h": 0
"1h": 1
"2h": 2
"3h": 3
"4h": 4
"5h": 5
"6h": 6
"7h": 7
"8h": 8
"9h": 9
"10h": 10
"11h": 11
"12h": 12
"13h": 13
"14h": 14
"15h": 15
"16h": 16
"17h": 17
"18h": 18
"19h": 19
"20h": 20
"21h": 21
"22h": 22
"23h": 23
- platform: modbus_controller
name: "${friendly_name} PV Input Mode"
address: 07
value_type: U_WORD
optionsmap:
"Independent": 0
"Parallel": 1
- platform: modbus_controller
name: "${friendly_name} AC Input Mode"
address: 08
value_type: U_WORD
optionsmap:
"APL,90‐280VAC": 0
"UPS,170‐280VAC": 1
- platform: modbus_controller
name: "${friendly_name} Output Volt Type"
address: 18
value_type: U_WORD
optionsmap:
"208 VAC": 0
"230 VAC": 1
"240 VAC": 2
- platform: modbus_controller
name: "${friendly_name} Output Freq Type"
address: 19
value_type: U_WORD
optionsmap:
"50 Hz": 0
"60 Hz": 1
- platform: modbus_controller
name: "${friendly_name} Over Load Restart"
address: 20
value_type: U_WORD
optionsmap:
"Yes": 0
"No": 1
"Swith to UTI": 2
- platform: modbus_controller
name: "${friendly_name} Over Temperature Restart"
address: 21
value_type: U_WORD
optionsmap:
"Yes": 0
"No": 1
- platform: modbus_controller
name: "${friendly_name} Buzzer on/off enable"
address: 22
value_type: U_WORD
optionsmap:
"Enable": 0
"Disable": 1
- platform: modbus_controller
name: "${friendly_name} Maximum Ac Charge Current"
address: 38
value_type: U_WORD
optionsmap: # 0 - 99
"5": 5
"10": 10
"15": 15
"20": 20
"25": 25
"30": 30
"35": 35
"40": 40
"45": 45
"50": 50
"55": 55
"60": 60
"65": 65
"70": 70
"75": 75
"80": 80
"85": 85
"90": 90
"95": 95
- platform: modbus_controller
name: "${friendly_name} Bat Low Volt Switch To Uti"
address: 37
value_type: U_WORD
optionsmap: # check manual 44 - ??
"44,0": 440
"44,2": 442
"44,6": 446
"44,8": 448
"45,0": 450
"45,2": 452
"45,4": 454
"45,6": 456
"45,8": 458
"46,0": 460
"46,2": 462
# ... ... check the range in the manual
- platform: modbus_controller
name: "${friendly_name} Mains to battery operating point"
address: 95
value_type: U_WORD
optionsmap:
"48,0": 480
"48,2": 482
"48,4": 484
"48,6": 486
"49,0": 490
"49,2": 492
"49,4": 494
"49,6": 496
"49,8": 498
"50,0": 500
"51,0": 510
"52,0": 520
# ... ... check the range in the manual