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

14 minutes ago, Sc00bs said:

@jacauc Would be nice to be able to not waste querying cycles to the inverter on values which do not change as quickly e.g. the Daily totals and spend more cycles on the values such as PV Power etc. 

I see in your example you aren't monitoring PV power.

Was thinking of putting together an example with all the Inverter values and people can just # out the ones they don't require

Do you think that we could write values back to the inverter using ESPhome as well? 

Yeah thought about that too, but I don't really know how to query it less frequently with esphome. Also... Does it really matter? 

I suppose we can make another modbus sensor with a less frequent scan rate, no idea if that would work though. 

 

I commented out the PV values because I don't have PV. (which is also why I have not tried writing values) 

If you want to add any more values to query, please feel free to add them into the code on GitHub with a pull request. Maybe we can somehow have a variable that can be set in the top of the script so that the irrelevant values are automatically ignored? 

 

  • 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

11 minutes ago, jacauc said:

I suppose we can make another modbus sensor with a less frequent scan rate, no idea if that would work though. 

 

I just tried this and seems to be easy enough. :) I uploaded the code to github

  • Author
1 hour ago, jacauc said:

Yeah thought about that too, but I don't really know how to query it less frequently with esphome. Also... Does it really matter? 

I suppose we can make another modbus sensor with a less frequent scan rate, no idea if that would work though. 

 

I commented out the PV values because I don't have PV. (which is also why I have not tried writing values) 

If you want to add any more values to query, please feel free to add them into the code on GitHub with a pull request. Maybe we can somehow have a variable that can be set in the top of the script so that the irrelevant values are automatically ignored? 

 

Thanks Jacauc, will do that and will add the PV Values etc. 

Do you think it will be possible to write the values as well for load shedding settings? 

11 minutes ago, Sc00bs said:

Thanks Jacauc, will do that and will add the PV Values etc. 

Do you think it will be possible to write the values as well for load shedding settings? 

I would imagine it's possible using the write_lambda function 

https://esphome.io/components/output/modbus_controller.html

 

Worthwhile to look at the node red flows @Bloubul7made for writing values to see how he did it and adapt it to lambda format. Let me know if you figure something out with this, I'll try it sometime, but have a busy few weeks ahead 

  • Author
On 2022/10/28 at 1:28 PM, jacauc said:

Instead of posting my esphome configs here, I'm uploading them to github (partly just for keeping for my own backup)

 

Recently added all the setting values

 

https://github.com/jacauc/SunsynkEsphome

Haven't worked with Github before so will see if I can work it out

I am sure it can't be that difficult and there must be a vide on it some where 🙂 

59 minutes ago, Sc00bs said:

Haven't worked with Github before so will see if I can work it out

I am sure it can't be that difficult and there must be a vide on it some where 🙂 

 

On 2022/10/29 at 8:37 AM, Sc00bs said:

@jacauc Would be nice to be able to not waste querying cycles to the inverter on values which do not change as quickly e.g. the Daily totals and spend more cycles on the values such as PV Power etc. 

I see in your example you aren't monitoring PV power.

Was thinking of putting together an example with all the Inverter values and people can just # out the ones they don't require

Do you think that we could write values back to the inverter using ESPhome as well? 

found a better way to skip updates for settings instead of creating another modbus component.

Updating github now and adding substitutions at the very top of the document

On 2022/10/29 at 8:15 AM, Sc00bs said:

Do you have an 8Kw inverter @slipx @sjlouw

Wondering if the removal of the R7 resistor is specific to the 8kw as mine would not connect with the resistor in place but some people do not seem to have that issue, most (all maybe) seem to be on the 5kw inverter. 

Yes its an 8KW. Working on a dashboard in homeassistant.

image.thumb.png.8006afb9546842008aff375719104a68.png

3 hours ago, system32 said:

The power flow card (Power Distribution) is what I use.

I was originally using that but prefer the Sunsynk system flow. I'm pretty happy with the card now. It supports HA themes and is built using SVG so scales on desktop and mobile.  

 

image.thumb.png.ab2900be8c25460eda54c52a7e2a7888.png

Edited by slipx

I am getting some weird spikes on  "172 Grid External Power" and "169 Grid Power" sensors. 

image.png.798c5b55cc811bf94113d00ac5aecc1e.png

Trying the following to filter them out which seems to be working:

 - platform: modbus_controller # 169 Grid Power
   modbus_controller_id: sunsynk
   name: "Grid Power"
   id: grid_power
   register_type: holding
   address: 169
   unit_of_measurement: "W"
   accuracy_decimals: 0
   device_class: power
   state_class: measurement
   filters:
    - lambda: |-
          float MAX_DIFFERENCE = 8000.0;  // adjust this!
          static float last_value_t = NAN;
          static int count_missed_t = 0;
          if (count_missed_t == 3) last_value_t = x;
          if (isnan(last_value_t) || std::abs(x - last_value_t) < MAX_DIFFERENCE) {
            count_missed_t = 0;
            return last_value_t = x;
          } else {
            count_missed_t += 1;
            return last_value_t;
            }

 

Reverted to this

 - platform: modbus_controller # 169 Grid Power
   modbus_controller_id: sunsynk
   name: "Grid Power"
   id: grid_power
   register_type: holding
   address: 169
   unit_of_measurement: "W"
   accuracy_decimals: 0
   device_class: power
   state_class: measurement
   filters:
    - lambda: |-
            float MIN_VALUE = -8000.0;
            float MAX_VALUE = 8000.0;
            if (MIN_VALUE <= x && x <= MAX_VALUE) return x;
            else return {};

Also added some labels to the card. 

image.png.b0a09a66dd7bff69b348e423cba8eebe.png

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 directory directly under www and reference in step 3 below.

2. Copy the attached sunsynkcard.js into the directory

3. Add the resource to your Dashboard 

image.png.396e8a43648955a134c6f5a5c95c4caf.png

4. Add the Custom: Sunsynk Card to your Dashboard view. Select Show Code editor

image.png.577345e230df6cc8b48d8157e8a93c07.png

5. Replace all the code with the contents from the card configuration file card configuration.txt

image.thumb.png.5fe04940446eb2b0acaa341c1c637267.png

6. Scroll down to bindings and replace the sensors with your own

bindings:
  - bind: return hass.states["sensor.pv1_power"].state + ' W'
    selector: '#pv1_power_186'
    type: html
  - bind: return hass.states["sensor.pv2_power"].state + ' W'
    selector: '#pv2_power_187'
    type: html
  - bind: return hass.states["sensor.sunsynk_totalsolar"].state + ' W'
    selector: '#pvtotal_power'
    type: html
  - bind: return hass.states["sensor.battery_voltage"].state + ' V'
    selector: '#battery_voltage_183'
    type: html
  - bind: return hass.states["sensor.battery_soc"].state + ' %'
    selector: '#battery_soc_184'
    type: html
  - bind: return hass.states["sensor.battery_output_power"].state + ' W'
    selector: '#battery_out_190'
    type: html
  - bind: return hass.states["sensor.inverter_output_power"].state + ' W'
    selector: '#inverter_out_175'
    type: html
  - bind: return hass.states["sensor.inverter_output_current"].state + ' A'
    selector: '#inverter_out_164'
    type: html
  - bind: return hass.states["sensor.aux_output_power"].state + ' W'
    selector: '#aux_power_166'
    type: html
  - bind: return hass.states["sensor.sunsynk_essential_load"].state + ' W'
    selector: '#ess_power'
    type: html
  - bind: return hass.states["sensor.grid_inverter_voltage"].state + ' V'
    selector: '#inverter_grid_voltage_154'
    type: html
  - bind: return hass.states["sensor.load_frequency"].state + ' Hz'
    selector: '#inverter_load_freq_192'
    type: html
  - bind: return hass.states["sensor.grid_inverter_load"].state + ' W'
    selector: '#inverter_load_grid_167'
    type: html
  - bind: return hass.states["sensor.grid_external_power"].state + ' W'
    selector: '#grid_external_power_172'
    type: html
  - bind: >-
      return parseInt(hass.states["sensor.grid_external_power"].state) -
      parseInt(hass.states["sensor.grid_inverter_load"].state) + ' W'
    selector: '#non_ess_power'
    type: html

Maybe someone smart can package this as a proper HACS frontend resource

  • 3 weeks later...

Hi, just reading through this thread and what you have achieve is brilliant :)

quick question though - is the RS485 connection active at the same time as the RS232 that is used by the supplied wifi dongle ? I want to replicate what you are doing and I really like having local control and not being dependant on distant cloud based services and so wondered if it was an 'either/or' or whether I can have my cake and eat it - and have both at the same time ?

Thanks

Mark

  • Author
1 hour ago, MarkR said:

Hi, just reading through this thread and what you have achieve is brilliant :)

quick question though - is the RS485 connection active at the same time as the RS232 that is used by the supplied wifi dongle ? I want to replicate what you are doing and I really like having local control and not being dependant on distant cloud based services and so wondered if it was an 'either/or' or whether I can have my cake and eat it - and have both at the same time ?

Thanks

Mark

Yes, dongle remain active and functional. 

sorry forgot to add you need to create the following template sensors as well

 

sensor:
  - platform: template
    sensors:
      sunsynk_totalsolar:
        friendly_name: "Total Solar Generation"
        value_template: "{{ (states('sensor.pv1_power') | float(0) + states('sensor.pv2_power') | float(0)) | round(0) }}"
        unit_of_measurement: 'W'
      sunsynk_solar_load:
        friendly_name: "Solar Load"
        value_template: "{{ (states('sensor.daily_pv_power_kwh') | float(0) - states('sensor.battery_charge_day') | float(0)) |round(1) }}"
        unit_of_measurement: 'kWh'
        device_class: energy
      sunsynk_essential_load:
        friendly_name: "Essential Load"
        value_template: "{{ (states('sensor.inverter_output_power') |float(0)  - (states('sensor.aux_output_power') |float(0) - states('sensor.grid_inverter_load') |float(0) )) | round(0)}}"
        unit_of_measurement: 'W'
        device_class: power

 

Edited by slipx

*NB changes on Deye firmware update from July 2022.

12kw Deye Hybrid 3 Phase (but could affect others, i dono)

I tried to get this working with an esp32, eventually gave up and went with Solar Assistant.

Solar assistant didnt work on the rs485 port or the meter port. But as per the instructions, the rs485 port does not comm anymore with the latest update, so in order to get communication working I had no choice but to connect to the BMS port.

Its a complete pain in the ass, because i had to buy a rj 45 Splitter which looks like this:

https://romtech.co.za/product/rj45-splitter-2/?utm_source=Google Shopping&utm_campaign=Google&utm_medium=cpc&utm_term=63300&gclid=Cj0KCQiAvqGcBhCJARIsAFQ5ke7_vQyNIhojrOo2LrEr_JKRqJQAqjhT1qq7w4i8h2HJrm8mqznc3TYaAoxVEALw_wcB

You can find this thing on takelot, but warning the build quality is total crap.

very flimsy, but got it to work after some frustration.

If you go to a china shop/mall you will be able to pick up one for R10, much cheaper than takealot, and better quality.

This needs to be a direct pin to pin, the black varient you find wont work.

If your pins on your bms are correct and using CAN for battery, it doesnt interfere with the rs485 as they use different pins.

I have both the pylontech bms cable and the Deye cable connected to the splitter then into the invertor BMS port, and then connected the invertor cable to the solar assistant pi. I also have the solar assistant pylontech console cable connected to the pi to pull in readings of the batteries, and able to view all the different packs individualy and get readings per battery. Im not sure if this update will affect other sunsynk/deye invertors but if you cant get comms, try the BMS port.

Now that i know this, i want to try my esp32 again.

Lastly, what is really nice about Solar Assistant is to be able to configure the battery schedule on the app,

pulled in all the metrics into home assistant, and can automate of sensors as well as write to the invertor.

Has anyone been able to do this with the ESP32 method?

 

 

Edited by roadkill

Interesting. I don't have this problem with the Sunsynk Firmware which was updated a few weeks ago. (SW Ver.M 6.0.2.2 / S  1.7.2.4 / C E.4.2.6)

Unfortunately I have not figured out how to write to the inverter using ESPHome. I'm sure it's possible though. 

I've also created a simpler version of the card for those that have everything on Essential and no AUX connection.

Attached SVG for those who want it sunsynk-comp.svg

 

image.png.774442bf9ccdaae2b6566bd4a452f8f0.png

Edited by slipx

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.