ESPHome modbus Growatt ShineWiFi-S

For now I have managed just to read info from SPF5000ES. It is connected to port usb-A.
This is the adapter used:image

Hi.

Sorry for the late reply.

My config is:

substitutions:
  devicename: "esphome-growatt-01"
  upper_devicename: "ESPHome Growatt 01"

esphome:
  name: growatt

esp8266:
  board: esp07s

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:

ota:
  password: "fb53133b1e3dea138dfbbbee8d3e6653"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Growatt Fallback Hotspot"
    password: "sR4TFWhJzHBT"

  # Enable Web server
web_server:
  port: 80

captive_portal:
    
time:
  - platform: homeassistant
    id: homeassistant_time

output:
# Blue Led
  - id: light_bl
    platform: gpio
    pin: 16
# Green Led
  - id: light_gr
    platform: gpio
    pin: 0
# Red Led
  - id: light_rd
    platform: gpio
    pin: 2

uart:
  id: mod_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 115200
  
modbus:
  id: modbus1
  uart_id: mod_bus
  
modbus_controller:
  - id: growatt
    ## the Modbus device addr
    address: 0x1
    modbus_id: modbus1
    setup_priority: -10  


sensor:
  - platform: modbus_controller
    name: "${devicename} DcPowerPV1"
    address: 5
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} DcPowerPV2"
    address: 10
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} DcVoltage"
    address: 3
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} DcInputCurrent"
    address: 4
    register_type: "read"
    unit_of_measurement: A
    device_class: current
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} AcFrequency"
    address: 37
    register_type: "read"
    unit_of_measurement: Hz
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.01
  
  - platform: modbus_controller
    name: "${devicename} AcVoltage"
    address: 38
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  
  - platform: modbus_controller
    name: "${devicename} AcOutputCurrent"
    address: 39
    register_type: "read"
    unit_of_measurement: A
    device_class: current
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} AcPower"
    address: 40
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} EnergyToday"
    address: 53
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} EnergyTotal"
    address: 55
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

    
  - platform: modbus_controller
    name: "${devicename} Temperature"
    address: 3093
    register_type: "read"
    unit_of_measurement: C
    device_class: temperature
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

My history looks like this:


december

I really cant say what is causing this. -But my theory is that the inverter maybe switches between on-/offline a couple of times during the odd days which leads to an accumulating value? (My total production so far is only 97.4 kWh and my reading from the inverter seems correct and accumulating with no spikes).

17/12-22 EDIT: today it happended again. It seems to show exactly 4x the total production of my inverter when this occurs.

Manage to flash both my sticks S + X via VSCode with the PlatformIO plugin… The S was connected with a USB-TTL CP2102 converter, RX-TX needed NOT to be crossed and baudrate needed to be lowered to 115200.
Could not get them flashed with my MBPro M1, the device was found but timeout while flashing perhaps due to the USB-C to USB conversion? So I used a x86 Intel NUC with Ubuntu (again with VSCode) which worked fine. Both devices now show their graphs nicely when connecting to their IP.

I do have a question about the integration in HA, whenever I add the below to my configuration.yaml the configuration check hangs and it does not want to restart (I did not force it since it will probably not come up).
So am I missing some integration? some modbus support somewhere?

modbus:
  id: modbus1
  uart_id: mod_bus
  flow_control_pin: GPIO4

modbus_controller:
  - id: growatt
    address: 0x1
    modbus_id: modbus1
    setup_priority: -10

Would it be possible to re-flash the usb dongle, but still keep sending data to server.growatt.com?

That way the app still works. In case my home assistant hobby ends sooner than the inverter lifetime :slight_smile:

1 Like

(post deleted by author)

Please familiarise yourself with this and this.

I’m having trouble setting the powerfactor. I’ve got all sensors working and can even read holding address 3 with the powerfactor but the code below does not work.

<code language== “YAML” >
number:

  • platform: modbus_controller
    modbus_controller_id: growatt3000
    id: pv_powerfactor3000
    name: “PV inverter Power factor Growatt 3000”
    address: 0x3
    value_type: U_WORD
    lambda: "return x; "
    write_lambda: |-
    ESP_LOGD(“main”,“Modbus Number incoming value = %f”,x);
    uint16_t powerfactor = x ;
    payload.push_back(powerfactor);
    return x;

I get this response:

[13:23:54][D][number:054]: ‘PV inverter Power factor Growatt 3000’ - Setting number value
[13:23:54][D][number:113]: New number value: 99.000000
[13:23:54][D][main:070]: Modbus Number incoming value = 99.000000
[13:23:54][D][number:012]: ‘PV inverter Power factor Growatt 3000’: Sending state 99.000000
[13:23:55][D][modbus_controller:029]: Modbus command to device=1 register=0x00 countdown=0 no response received - removed from send queue
[13:23:56][D][text_sensor:067]: ‘Growatt3300 Status’: Sending state ‘Unknown’
[13:24:10][D][modbus.number:023]: Number new state : 100.00

And the number value goes back to 100 percent. What do I do wrong?

Hi,
First of all, thanks for all the hard work.
Question: I have a SPH-5000 inverter, connected to an SDM230-Modbus meter (connected by RJ45), in order to get house consumption data besides the production data. All the data us being sent by my Shine Wifi-S stick to growatt servers (with grott in the middle).
Using this method, will I be able to define sensors in ESPHome for all the data? I mean, not only for the production but also for the consumption data?

For anyone with SPH 10k-TL3 BH-UP here’s what worked for me for keeping the original USB stick and connections to the Growatt cloud and local updates every 10s. There are obviously far more values in the registers, I set up just what I was interested in…

HW:
ESP32
MAX3485 TTL/RS485

ESP32 pins tx/rx connected to the RS485 module, Pins 1 & 5 on the RS485-3 RJ-45 port on the inverter go to B & A on the RS485 module.

ESPHome config:

substitutions:
  devicename: Growatt
  esp_name: ESP Growatt #Device Name
  update_fast: 10s
  update_slow: 60s
  esp_hostname: "esp-growatt"
  ip_address: 192.168.5.104
  ip_gw: 192.168.5.1
  ip_netmask: 255.255.255.0


esphome:
  name: ${esp_hostname}

esp32:
  board: esp32dev
  framework:
    type: arduino

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: ${ip_address}
    gateway: ${ip_gw}
    subnet: ${ip_netmask}
  ap:
    ssid: "${esp_name} Fallback Hotspot"
    password: !secret ap_password

ota:
  password: !secret ota_password

# Enable logging
logger:
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_key

captive_portal:

web_server:
  port: 80
  include_internal: true  

uart:
  id: mod_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 9600
 
modbus:
  id: modbus1
  uart_id: mod_bus
  
modbus_controller:
  - id: growatt
    address: 0x1
    modbus_id: modbus1
    update_interval: ${update_fast}
    setup_priority: -10    

button:
  - platform: restart
    name: "${esp_name} Restart"

# Setup for Growatt SPH 10k-TL3 BH-UP
sensor:
  - platform: modbus_controller
    name: "${devicename} Inverter Status"
    address: 0
    register_type: "read"
    icon: mdi:home-lightning-bolt
    value_type: U_WORD

  - platform: modbus_controller
    name: "${devicename} Input Power"
    address: 1
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_WORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} PV1 Power"
    id: pv1_power
    address: 5
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 0
    internal: true    
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} PV2 Power"
    id: pv2_power    
    address: 9
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 0
    internal: true
    filters:
    - multiply: 0.1        

  - platform: template
    id: pv_power
    name: "${devicename} PV Power"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    accuracy_decimals: 0
    lambda: |-
      return float((id(pv1_power).state + id(pv2_power).state));
    update_interval: ${update_fast}

  - platform: modbus_controller
    name: "${devicename} Output Power"
    address: 35
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:home-lightning-bolt
    value_type: U_DWORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: pv1_energy_today
    name: "${devicename} PV1 Energy Today"
    address: 59
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 1
    internal: true    
    filters:
    - multiply: 0.1
  
  - platform: modbus_controller
    id: pv1_energy_total  
    name: "${devicename} PV1 Energy Total"
    address: 61
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 1
    internal: true    
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: pv2_energy_today
    name: "${devicename} PV2 Energy Today"
    address: 63
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 1
    internal: true    
    filters:
    - multiply: 0.1
  
  - platform: modbus_controller
    id: pv2_energy_total
    name: "${devicename} PV2 Energy Total"
    address: 65
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 1
    internal: true    
    filters:
    - multiply: 0.1

  - platform: template
    id: pv_energy_today
    name: "${devicename} PV Energy Today"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    icon: mdi:solar-power-variant
    accuracy_decimals: 1
    lambda: |-
      return float((id(pv1_energy_today).state + id(pv2_energy_today).state));
    update_interval: ${update_slow}

  - platform: template
    id: pv_energy_total
    name: "${devicename} PV Energy Total"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    icon: mdi:solar-power-variant
    accuracy_decimals: 1
    lambda: |-
      return float((id(pv1_energy_total).state + id(pv2_energy_total).state));
    update_interval: ${update_slow}

  - platform: modbus_controller
    name: "${devicename} Inverter Temperature"
    address: 93
    register_type: "read"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement    
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1  

  - platform: modbus_controller
    name: "${devicename} Battery Discharging Power"
    address: 1009
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:battery-arrow-down
    value_type: U_DWORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1    

  - platform: modbus_controller
    name: "${devicename} Battery Charging Power"
    address: 1011
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:battery-arrow-up-outline
    value_type: U_DWORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1 

  - platform: modbus_controller
    name: "${devicename} Battery SoC"
    address: 1014
    register_type: "read"
    unit_of_measurement: "%"
    icon: mdi:home-battery
    value_type: U_WORD
    accuracy_decimals: 0

  - platform: modbus_controller
    name: "${devicename} AC Power to User Total"
    address: 1021
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:transmission-tower-export
    value_type: U_DWORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} AC Power to Grid Total"
    address: 1029
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:transmission-tower-import
    value_type: U_DWORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} INV Power to Local Load Total"
    address: 1037
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement    
    icon: mdi:home-import-outline
    value_type: U_DWORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Battery Temperature"
    address: 1040
    register_type: "read"
    unit_of_measurement: °C
    device_class: temperature
    state_class: measurement    
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Battery State"
    address: 1041
    register_type: "read"
    icon: mdi:home-battery
    value_type: U_WORD

  - platform: modbus_controller
    name: "${devicename} Energy to User Today"
    address: 1044
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:transmission-tower-export
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} Energy to User Total"
    address: 1046
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:transmission-tower-export
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Energy to Grid Today"
    address: 1048
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:transmission-tower-import
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Energy to Grid Total"
    address: 1050
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:transmission-tower-import
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Battery Discharge Today"
    address: 1052
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:battery-arrow-down
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Battery Discharge Total"
    address: 1054
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:battery-arrow-down
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Battery Charge Today"
    address: 1056
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:battery-arrow-up-outline
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Battery Charge Total"
    address: 1058
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:battery-arrow-up-outline
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Local Load Today"
    address: 1060
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:home-import-outline
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "${devicename} Local Load Total"
    address: 1062
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:home-import-outline
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1  
4 Likes

Hi Plawa,
I have an exact configuration as you do: 10k Growatt inverter, ESP32 board and MAX 485/TTL module. Tried your esphome code but there are no readings received from the inverter. I’am not sure about the pins - eventhough 1 and 5 are mentioned in the documentation, If I measure the voltage on these pins (connected to RS485-3 port on the inverter) there is only 15 mV but should be like 200 mV. Strange. Could you please check the RS485 settings one the invertor? It is under Basic parameters/RS485 Adr/COM Address, you can get to the settings menu by long press of the OK button next to inverter display? I have 001 there, not sure if this is the right value.

Attaching the screenshot with the log.

Any help or advise is appreciated.

Ahoj Pavle :slight_smile:

I checked my inverter config, it’s set to 001, plus when I measure the voltage across the pins I’m using I get ~1.7V… from what I have read it can either be pin 1&5 or 4&5, see if that works for you.

Hodne stesti…

Hi Plawa, I tried pins 1&5 and 4&5, also tried two diffeent boards - ESP8266 and ESP32 with two different RS485/UART modules but with no success. Seems like there is no data coming from the RS485-3 connector. Maybe it must be enabled somewhere in the invertor settings but I have no clue of where to do it. Will investigate it a bit further. Thanks a lot. Pavel

Hi Plawa! I will like to see what model of RS 485 you have used. Can you post a picture with your setup?
Regarding HA Card, what card did you use? Is looking very nice. Thanks!

There is an on-screen menu for configuring the RS485. Hold down the OK button for a couple of seconds until it says “Basic Parameters”, and then you can navigate to RS485 settings. (SPH10000-TL3)

Hi Christoffer, yes, I am anware of this settings. We checked with Plawa in an offline communication that his settings is “unused” (other are ShineMaster, VPP and Meter2). For me having set “unused” does not help either. Will investigate furhter over the weekend but seems I am stuck with no ovious reason.

1 Like

Hello there, im going to buy a SPH3600, i can see that you have export to grid information, is that provided by the GroWatt inverser or dou you use something else?

Thanks

Hi, I got the first MAX3485 hit I got on Aliexpress (the red one with angled pins)…

The graph is just the custom mini graph lovelace card, nothing special

That is provided by my inverter but I can’t obviously guarantee it will be provided by yours…

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
4 Likes

So cool! Thanks for sharing.
I will give this a go. Is there no youtube tutorial about this? :slight_smile: