Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

My Sunsynk 8Kw & data collection setup

Featured Replies

What sunsynk invertor do you have?

Card looks good :)

Maybe it just applies to the deye 12kw, I tested all the ports just incase when I did the excercise, only BMS had Comms.

Would be really nice to write now that Eskom se push has opened up API.

 

 

 

  • 3 weeks later...
  • Replies 657
  • Views 179k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • If you want to try this card in home assistant follow these steps. 1. Create a new directory under www/community/ and name it sunsynk-card. If you don't have HACS installed you can create directo

  • Hi all. Here is my version to get Sunsynk 8.8 Modbus metrics in Home Assistant: Required Hardware: ESP32 Development Board @R149.95 https://www.diyelectronics.co.za/store/espressif-iot/1495-

  • Thought I would also contribute with something small. Not as impressive as what some of the others here but a contribution nonetheless. The GUI for Sunsynk System Mode, or lack thereof, has reall

Posted Images

Can i suggest a "HALO" for the inverter image based on it's status from register 059 - Run State?

0x0000 - Standby - Blue

0x0001 - Self Test - Yellow

0x0002 - Normal - Green

0x0003 - Alarm - Orange

0x0004 - Fault - Red

Hi slipx

On the "DOT" to indicate the Inverter status - 👍

I have been struggling to get my values for "Essential" and "Non-Essential" to match what i know i am consuming.
After looking at the real-time data in MQTT Explorer and looking at other registers, i think i might have found the solution.
Essential Load = (175+167) - 166, I also saw that kellerza has this in his HA integration.
Non-Essential = 172-167, BUT... i had to change "inverter_load_grid_167" to register 178 for my loads to work.

So:

Essential Load = (175+178) - 166

Non-Essential = 172-178

I tested this with switching my geyser on/off.
I have two CBI Astute Smart Controllers connected to each of my geysers that is on the non-essential side. i might be a few watts off, but it seems to be working. 

Does this seem correct???

What i found is that during loadshedding, this does not work anymore...
Register 178, is then the same value as 175 instead of going to zero.

Edited by Zodiac69

4 hours ago, Zodiac69 said:

Hi slipx

On the "DOT" to indicate the Inverter status - 👍

I have been struggling to get my values for "Essential" and "Non-Essential" to match what i know i am consuming.
After looking at the real-time data in MQTT Explorer and looking at other registers, i think i might have found the solution.
Essential Load = (175+167) - 166, I also saw that kellerza has this in his HA integration.
Non-Essential = 172-167, BUT... i had to change "inverter_load_grid_167" to register 178 for my loads to work.

So:

Essential Load = (175+178) - 166

Non-Essential = 172-178

I tested this with switching my geyser on/off.
I have two CBI Astute Smart Controllers connected to each of my geysers that is on the non-essential side. i might be a few watts off, but it seems to be working. 

Does this seem correct???

What i found is that during loadshedding, this does not work anymore...
Register 178, is then the same value as 175 instead of going to zero.

Perhaps start by checking Inverter output power (175) and Grid (172). I also assume you have nothing connected to AUX so 166 will always be 0. Then check 167. Based on those 3 you should be able to work our essential and non-essential.

Here is an updated card that displays inverter status as a coloured dot. I've also added a red dot next to grid when load shedding is active  custom-sunsynk-configuration.txt

image.png.44af11561498762aaadb3d6aa2480670.png

 

and for the full card custom-sunsynk-configuration -full.txt

image.png.a031c55887b0884e7fe6925af670f984.png

Edited by slipx

Interesting so 169 is 167+168. Glad you got it working

167

L1

Grid side L1 power

R

 

1W

int Signed int

168

L2

Grid side L2 power

R

 

1W

int Signed int

169

L1L2

Total power of grid side L1L2

 

R

 

1W

int 00

Signed int

> 0 BUY

< 0 SELL

I have made some progress in writing settings values to the inverter.

There are probably multiple ways to do this.

For now, I've done this by creating an API service that can be called from Home Assistant.

To start, the service gets defined in the esphome yaml. 

My example.

api:
  services:
    - service: update_lowbatt
      variables:
        lowbatt_value: int
      then:
        - lambda: |-
            esphome::modbus_controller::ModbusController *controller = id(sunsynk);
            std::vector<uint16_t> lowbatt_data = {uint16_t((lowbatt_value))};
            esphome::modbus_controller::ModbusCommandItem set_lowbatt_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0x00DB, 0x0001, lowbatt_data);
            controller->queue_command(set_lowbatt_command);    
 
This service updates the Low Battery % setting (register 219 or 0x00DB). 

The service is then called from home assistant.
service: esphome.sunsynk_update_lowbatt
data_template: 
  lowbatt_value: "5"

I use this setting to set the minimum SOC of the battery before it starts using grid power. Normally I keep this as something very low (e.g. 5%), unless I need to maintain a higher minimum battery level in anticipation of a loadshedding period. I'm going to write an automation that manages this Low Battery % setting based on load shedding status and upcoming low shedding periods. But that's a job for another day.

I'm sure the code for this could be simplified by someone with more skill than me.

 

Edited by BrettC

I've also found another approach that works.

Instead of defining settings as "sensors", they can instead be defined as numbers (and probably also switches for binary sensors). Using the same code above, the setting's value updates when you change its value in home assistant.

Here is the ESPHome yaml code for a number component. Once again I'm sure this can be neatened up.

number:
# 219 Setting Low Battery %
  - platform: modbus_controller
    modbus_controller_id: sunsynk
    name: "Low Batt Percent Setting"
    id: sunsynk_setting_low_batt
    register_type: holding
    address: 219
    lambda: "return  x * 1.0; "
    write_lambda: |-
      esphome::modbus_controller::ModbusController *controller = id(sunsynk);
      std::vector<uint16_t> lowbatt_data = {uint16_t((x))};
      esphome::modbus_controller::ModbusCommandItem set_lowbatt_command = esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 0x00DB, 0x0001, lowbatt_data);
      controller->queue_command(set_lowbatt_command);
      return x;

BrettC you wizard!!!! Thank you for this. If it works as you say, this proves esphome can write back to the invertor, I need to try this! That mixed with the eskomsepush api into HA is a solution to automating this load shedding nonsense so we can avoid getting caught with our pants down if we haven't kept an eye on our batteries. Been manually changing it like a caveman up till now.

Wish I could help with the code but not strong on Dev, your the first to get writes to an invertor with esphome that I have seen

I only made this user to share this 🤣 Thanks all for the inspiration. 

Exactly as BrettC suggest, I made this in the weekend for my deye :) I have shared it with some hundreds other danish deye owners and waiting for more feedback.

The adresses i use is matching my 12kW 3 phase, low voltage hybrid deye inverter. I seems for me that the modbus adresses does not match your sunsync inverters(deye inverters).

github.com/klatremis/esphome-for-deye

 

Skærmbillede 2023-01-08 214449.png

esp32 rs485_bb.jpg

Edited by Klatremis

2 hours ago, Klatremis said:

I only made this user to share this 🤣 Thanks all for the inspiration. 

Exactly as BrettC suggest, I made this in the weekend for my deye :) I have shared it with some hundreds other danish deye owners and waiting for more feedback.

The adresses i use is matching my 12kW 3 phase, low voltage hybrid deye inverter. I seems for me that the modbus adresses does not match your sunsync inverters(deye inverters).

github.com/klatremis/esphome-for-deye

 

Skærmbillede 2023-01-08 214449.png

esp32 rs485_bb.jpg

This is great. The registers on the 8KW Sunsynk are definitely different. I've managed to toggle system timer, and grid charge per timezone, as well as set the SOC using the config below.

switch:
 - platform: modbus_controller  		# 248 Toggle System Timer
   use_write_multiple: true
   modbus_controller_id: sunsynk
   name: "Toggle System Timer" 
   id: sunsynk_esphome_toggle_Time_of_Use
   register_type: holding
   address: 248
   bitmask: 1
   entity_category: config
   icon: "mdi:toggle-switch"

 - platform: modbus_controller          # 274 Toggle Grid Charge Timezone1
   use_write_multiple: true
   modbus_controller_id: sunsynk
   name: "Toggle Grid Charge Timezone1"
   id: sunsynk_esphome_toggle_grid_charge_timezone1
   register_type: holding
   address: 274
   bitmask: 1
   entity_category: config
   icon: "mdi:toggle-switch"

 - platform: modbus_controller          # 275 Toggle Grid Charge Timezone2
   modbus_controller_id: sunsynk
   use_write_multiple: true
   name: "Toggle Grid Charge Timezone2"
   id: sunsynk_esphome_toggle_grid_charge_timezone2
   register_type: holding
   address: 275
   bitmask: 1
   entity_category: config
   icon: "mdi:toggle-switch"

 - platform: modbus_controller          # 276 Toggle Grid Charge Timezone3
   modbus_controller_id: sunsynk
   use_write_multiple: true
   name: "Toggle Grid Charge Timezone3"
   id: sunsynk_esphome_toggle_grid_charge_timezone3
   register_type: holding
   address: 276
   bitmask: 1
   entity_category: config
   icon: "mdi:toggle-switch"

 - platform: modbus_controller          # 277 Toggle Grid Charge Timezone4
   modbus_controller_id: sunsynk
   use_write_multiple: true
   name: "Toggle Grid Charge Timezone4"
   id: sunsynk_esphome_toggle_grid_charge_timezone4
   register_type: holding
   address: 277
   bitmask: 1
   entity_category: config
   icon: "mdi:toggle-switch"

 - platform: modbus_controller          # 278 Toggle Grid Charge Timezone5
   modbus_controller_id: sunsynk
   use_write_multiple: true
   name: "Toggle Grid Charge Timezone5"
   id: sunsynk_esphome_toggle_grid_charge_timezone5
   register_type: holding
   address: 278
   bitmask: 1
   entity_category: config
   icon: "mdi:toggle-switch"

 - platform: modbus_controller          # 279 Toggle Grid Charge Timezone6
   modbus_controller_id: sunsynk
   use_write_multiple: true
   name: "Toggle Grid Charge Timezone6"
   id: sunsynk_esphome_toggle_grid_charge_timezone6
   register_type: holding
   address: 279
   bitmask: 1
   entity_category: config
   icon: "mdi:toggle-switch"

number:
  - platform: modbus_controller         # 268 Settings SoC Timezone1
    use_write_multiple: true
    modbus_controller_id: sunsynk
    id: sunsynk_esphome_set_soc_timezone1
    name: "Set SoC Timezone1"
    unit_of_measurement: "%"
    address: 268
    min_value: 0
    max_value: 100
    step: 5
    value_type: U_WORD  

  - platform: modbus_controller         # 269 Settings SoC Timezone2
    use_write_multiple: true
    modbus_controller_id: sunsynk
    id: sunsynk_esphome_set_soc_timezone2
    name: "Set SoC Timezone2"
    unit_of_measurement: "%"
    address: 269
    min_value: 0
    max_value: 100
    step: 5
    value_type: U_WORD  

  - platform: modbus_controller         # 270 Settings SoC Timezone3
    use_write_multiple: true
    modbus_controller_id: sunsynk
    id: sunsynk_esphome_set_soc_timezone3
    name: "Set SoC Timezone3"
    unit_of_measurement: "%"
    address: 270
    min_value: 0
    max_value: 100
    step: 5
    value_type: U_WORD  

  - platform: modbus_controller         # 271 Settings SoC Timezone4
    use_write_multiple: true
    modbus_controller_id: sunsynk
    id: sunsynk_esphome_set_soc_timezone4
    name: "Set SoC Timezone4"
    unit_of_measurement: "%"
    address: 271
    min_value: 0
    max_value: 100
    step: 5
    value_type: U_WORD  

  - platform: modbus_controller         # 272 Settings SoC Timezone5
    use_write_multiple: true
    modbus_controller_id: sunsynk
    id: sunsynk_esphome_set_soc_timezone5
    name: "Set SoC Timezone5"
    unit_of_measurement: "%"
    address: 272
    min_value: 0
    max_value: 100
    step: 5
    value_type: U_WORD  

  - platform: modbus_controller         # 273 Settings SoC Timezone6
    use_write_multiple: true
    modbus_controller_id: sunsynk
    id: sunsynk_esphome_set_soc_timezone6
    name: "Set SoC Timezone6"
    unit_of_measurement: "%"
    address: 273
    min_value: 0
    max_value: 100
    step: 5
    value_type: U_WORD  

 

Hi everyone

Are the 12kW 3phase registers the same as the single phase inverters?

I doubt it, the the modbus document shared for load power shows for L1 and L2 and total (L1 +L2)

Help me if I am wrong or share with me possible registers for the 3 phase inverter please

 

2 minutes ago, FrikkieD said:

Hi everyone

Are the 12kW 3phase registers the same as the single phase inverters?

I doubt it, the the modbus document shared for load power shows for L1 and L2 and total (L1 +L2)

Help me if I am wrong or share with me possible registers for the 3 phase inverter please

 

Hi @FrikkieD - they are not the same. L1&L2 is not related to phases, but internal measurement points

A good descriptions of registers and other discussions around this can be found here: Compatibility with Sunsynk 12kw 3-phase inverter? · Issue #63 · kellerza/sunsynk (github.com)

My addon does not support the 12kW at the moment. Since it's not something I can easily test I'm a bit reluctant to do it.

5 hours ago, kellerza said:

Hi @FrikkieD - they are not the same. L1&L2 is not related to phases, but internal measurement points

A good descriptions of registers and other discussions around this can be found here: Compatibility with Sunsynk 12kw 3-phase inverter? · Issue #63 · kellerza/sunsynk (github.com)

My addon does not support the 12kW at the moment. Since it's not something I can easily test I'm a bit reluctant to do it.

Thanks, this will help

@Zodiac69 trying to understand what is different with your setup, you mentioned this worked:

Quote

Essential Load = (175+169) - 166
Non-Essential = 172-169

while this did not

Quote

Essential Load = (175+167) - 166, I also saw that kellerza has this in his HA integration.
Non-Essential = 172-167, BUT... i had to change "inverter_load_grid_167"

Or more specifically, I'm missing where L2 is being measured!

    Sensor(169, "Grid power", WATT, -1),  # L1(167) + L2(168)
    Sensor(167, "Grid LD power", WATT, -1),  # L1 seems to be LD
    Sensor(168, "Grid L2 power", WATT, -1),

Hi kellerza
Not sure why, but if i used the registers as shown here Sunsynk Mimic, my Non Essential was showing negative values, see message to slipx Wrong Values.
I looked at all the inverter "Grid" registers in node red, gauge for each one, and looked at the value during "Normal" operation and Load shedding and register 167 was not matching my system during loadshedding. Using register 169 and now i am no longer getting negative values when the battery charge.
Register 169 gave me values that were correct.

Battery Charging:

image.png.e45708b2b31d0716f448a21e0aa2e145.png

Battery Charged:

image.png.b659796755ec947126bfa27ecc00dd16.png

just a question regarding all of this. I have solar-assistant setup on a separate raspberry PI with the RS485 adapter. Solar-assistant then speak to HA via MQTT. Do i have to install another RS485 adapter and connect it directly to the RPI running HA? Is there no way to leverage off of the solar-assistant PI and get these dashboards setup? 

Once you have the data in Home Assistant you can use it in any dashboard, it does not matter if it comes from Solar Assistant or any of the other options.

In Home Assistant, go to Developer Tools -> States tab and then filter on the Attributes column for 'power' or 'energy' to see what sensors you have available.

 

 

Hi Guys, 

I have been trying for days now and I am simply not winning.

I get this

image.thumb.png.9a2bd90cfcacc254d870cfbdd85cc723.png

My Setup, Sunsynk 8.8kw.

 

Raspi 4 running Home Assistant, Core, Supervisor.

mosquito MQTT installed and running (for other devices as well)

Running Sunsynk Inverter Add-on.

 

First of I believe this is the setup I have

image.png.ace7590d2ffc6d0e6c6fca3aaeea46fc.png

 

I am unsure which Driver to use - I get this

image.thumb.png.97988e96f6a9830245b5a7a07e221a3f.png

image.thumb.png.ee67223bf12a721ea67d19796c8e34cd.png

and if I use

image.thumb.png.8f50f98cc2269941acb55f2d810d8ca6.png

image.png.043157a9e3f9ec52982731cbf3a205e2.png

currently using this as - USB to RS485 Converter - Micro Robotics

Currently My Rasp1 4 has everything on

I have this connected to the USB of the Pi4 - USB to RS485 Converter - Micro Robotics 

And cat5e running from there to the RS485 port ont he invertor, Short patch cable.

 

I have also tried another rs485 module

image.png.28bc183433a35ab501447798ea81c7c4.png

 

I am lost.

Any help would be great.

image.png

2 minutes ago, Decsus said:

Hi Guys, 

I have been trying for days now and I am simply not winning.

I get this

image.thumb.png.9a2bd90cfcacc254d870cfbdd85cc723.png

My Setup, Sunsynk 8.8kw.

 

Raspi 4 running Home Assistant, Core, Supervisor.

mosquito MQTT installed and running (for other devices as well)

Running Sunsynk Inverter Add-on.

 

First of I believe this is the setup I have

image.png.ace7590d2ffc6d0e6c6fca3aaeea46fc.png

 

I am unsure which Driver to use - I get this

image.thumb.png.97988e96f6a9830245b5a7a07e221a3f.png

image.thumb.png.ee67223bf12a721ea67d19796c8e34cd.png

and if I use

image.thumb.png.8f50f98cc2269941acb55f2d810d8ca6.png

image.png.043157a9e3f9ec52982731cbf3a205e2.png

currently using this as - USB to RS485 Converter - Micro Robotics

Currently My Rasp1 4 has everything on

I have this connected to the USB of the Pi4 - USB to RS485 Converter - Micro Robotics 

And cat5e running from there to the RS485 port ont he invertor, Short patch cable.

 

I have also tried another rs485 module

image.png.28bc183433a35ab501447798ea81c7c4.png

 

I am lost.

Any help would be great.

image.png

If you have a directly connected interface, try having a *blank* PORT and selecting your DEVICE...

Also try these kellerza/sunsynk: Sunsynk Inverter Python library and Home Assistant OS Addon (github.com)

I find the umodbus driver more reliable. By far the most reliable is the umodbus driver connected to mbusd via TCP, which connects to the usb port

7 minutes ago, Decsus said:

Hi Guys, 

I have been trying for days now and I am simply not winning.

I get this

image.thumb.png.9a2bd90cfcacc254d870cfbdd85cc723.png

My Setup, Sunsynk 8.8kw.

 

Raspi 4 running Home Assistant, Core, Supervisor.

mosquito MQTT installed and running (for other devices as well)

Running Sunsynk Inverter Add-on.

 

First of I believe this is the setup I have

image.png.ace7590d2ffc6d0e6c6fca3aaeea46fc.png

 

I am unsure which Driver to use - I get this

image.thumb.png.97988e96f6a9830245b5a7a07e221a3f.png

image.thumb.png.ee67223bf12a721ea67d19796c8e34cd.png

and if I use

image.thumb.png.8f50f98cc2269941acb55f2d810d8ca6.png

image.png.043157a9e3f9ec52982731cbf3a205e2.png

currently using this as - USB to RS485 Converter - Micro Robotics

Currently My Rasp1 4 has everything on

I have this connected to the USB of the Pi4 - USB to RS485 Converter - Micro Robotics 

And cat5e running from there to the RS485 port ont he invertor, Short patch cable.

 

I have also tried another rs485 module

image.png.28bc183433a35ab501447798ea81c7c4.png

 

I am lost.

Any help would be great.

image.png

check on inverter, advanced settings, if the inverter is set to "slave", if so, change to "master"

Awesome, I will stick to umodbus.

My advanced settings are/were correct.

Does a wrong serial number (not modbus SN) affect the connection at this stage, if so where do I get the correct one?

I have tried all of these, thus also a second USB-rs485 module

Can the mbusd also run on the same Raspi, or must i get a second device (pi or similar) to run that?

 

Also what does this mean? 

2023-01-20 12:55:37,640 ERROR   Read Error: (1,16,2) CRC validation failed.

Thanks guys

image.thumb.png.4c87b101c63f15b286a29d74abfda0de.png

Edited by Decsus

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.