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.

Home Assistant Sunsynk modbus project

Featured Replies

  • Author

That module USR-DR302 is indeed reasonable from AliExpress (£10 GBP + £5 delivery)  . have you seen (or had a go yourself of course)   this being used on a SunSynk inverter ?  

Excellent Idea about using Slipx's yaml if it is Modbus over ethernet then it shouldn't care what device it's talking to (ie my adapter or an esp32)  as long as it conforms to the Modbus protocols.. I'll go and have a look at that.. 

 

that link didn't seem to do much. Where would go to see the yaml ?

thanks 

  • Replies 62
  • Views 13k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • It seems there are issues with that module https://kellerza.github.io/sunsynk/guide/wiring  

  • I have played with this converter that is working and cheap from micro robotics  https://www.robotics.org.za/communication-wireless-Industrial/serial-to-ethernet-converters/USR-DR302 You can

  • https://github.com/slipx06/Sunsynk-Home-Assistant-Dash/blob/main/ESPHome-1P-Sunsynk-Deye.yaml This is the single phase inverter yaml I was using it with this       Here is exa

Posted Images

  • Author

thanks Yuri.  I'll go and have a read.   I work away from home quite often so wont be able to fiddle again until the weekend..  I guess one of the differences between the approach I was thinking of and the esp32 project is the ESP does all the ModBus stuff and uses a web server to talk to Home Assistant where as using a dumb ModBus to rs485 converter the ModBus stuff is done in HA.   The register/addresses used in the esp32 yaml would be the same as the ones used in HA but I'm not sure where to stick them in HA so that it communicates with the ModBus slave..

If I understand correctly you want an ESP32 to talk to the inverter via Modbus and have the data sent to some entities in HA ?

If so I can assist with that. I can make you a "Skeleton" sketch with a function to post sensor data to HA.

 

 

Edited by MartinViljoen

  • Author

Wow thanks Martin.   I haven’t given up on using the wave share rs485 to Ethernet module yet but I am getting closer to dumping that idea and going the Esp32 route I’ve ordered one of these so I’m ready to go esp32  if need be so I may be back in touch.. thanks very much for the offer. 

8288F00E-FA83-4D69-A33A-EF45C882D057.png

  • Author

I found this YouTube thing.  https://youtu.be/Xuj2YFZ5zME?feature=shared Very good video nice and clear instructions.  I set my wave share exactly as per the video and the read light flashes so it’s doing something.  Can someone tell me what I should expect in HA for the entities if the end device isn’t connected ?  I can see the entities as defined in the modbus.yaml but with a red error next to them rather than a null or zero. Is this correct ? I’ve then replaced some of the sensor entries with text copied and pasted from Slipx06 script but no data showed. 
 

  • 2 weeks later...
  • Author

Managed to get a few hours to try and progress this.  Could someone point me in the right direction with the addresses please.

Looking at Slipx's yaml 

  - platform: modbus_controller
    modbus_controller_id: ${modbus_controller_id}
    name: "sun12k-PV1 Power"
    id: sun12k_PV1_Power
    register_type: holding
    address: 672
    unit_of_measurement: "W"
    state_class: "measurement"
    accuracy_decimals: 0
    value_type: U_WORD

The address for The PV input appears to be 672 . I understand this yaml is for the esp32 so need  converting to put it in to a ModBus.yaml in HA if I am going to read direct from the Waveshare so this is my complete yaml called modbus.yaml and included in my config.yaml 

modbus:
  - name: waveshare1
    type: tcp
    host: 192.168.1.250
    port: 502
    delay: 2
    timeout: 5
    sensor:
      - name: modpvin
        scan_interval: 10
        address: 672
        slave: 1
        input_type: holding
 
Also in the modbus pdf 672 is listed as temperature ?   Is the sun12k in slipx yaml referring to a 12kW inverter and thus the addresses may be different? 
image.png.6842daf07be49cb7d91fc1114ac49b61.png

 

  • Author

Hello I will eventually be looking for both PV strings power and inverter output but I'd be happy just seeing any for now.  The inverter model is SunSynk 3.6K-sg01lp1 

  • Author

@GVC I'll go and have a look at that , thanks.   

 

Just had a read and they are doing it via a USB I'm hoping to do it over my network so rs485 to TCP . 

 

Edited by Perfo

  • Author

@p_i Ah ok. those don't appear in the slipx yaml so maybe it is different to mine.. I have the additional annoyance that doing a check configuration just locks up my Pi-4 which is very Grring.. 

  • Author

Do you know where I can find out what type of input 186 is ? ie is it a holding in put ? I guess it isn't a coil due to it being a value rather than an on off .. 

That value IS in slipx's yaml:

  - platform: modbus_controller            # 186 PV1 Power
    modbus_controller_id: inverter
    name: "${friendly_name} PV1 Power"
    id: inverter_esphome_pv1_power
    register_type: holding
    address: 186
    unit_of_measurement: "W"
    accuracy_decimals: 0
    device_class: power
    state_class: measurement
    value_type: U_WORD

They're not in there in numerical order, so you have to search.

  • Author

@p_i hmmm I though It did search but yep I am wrong it is there. Which is encouraging ...Is value_type: U_WORD in and slipx esp32 yaml the same thing as input_type: U_WORD in ha yaml ?  

@GVC  ok off to read about modpoll and stuff..

 

  • Author

A bit tricky that modbus pool. They say to run it from command line but the example does seem to do anything. I notice you can also run it in windows but not sure what I'm doing. However I found I already had it installed as I used this to see if my modbus gadget could be seen on the network .. it can so just got to figure out how to send a fetch command to address 186 ... 

  • Author

I had to dump it again last night due to worldly pressures getting in the way of serious fiddling. Anyway fresh head this morning and modbus poll seems to be giving me a sensible  reading for address 186. For those that know what they are talking about ca\n you have a quick scan of my modbus set up ?  

modbuspoll.png.9a778769f0c79c6923550be477578500.png

I say this seems to work as line 6 which I assume is address 186 is a live reading and bar the delay on the sunsynk app appears to be tracking the solar input.. So a massive step forwards. I need to convert this in to a modbus entry in HA now and duplicate my results and I'm away.  

Modbuspoll_results.png.71b8bd1766a920ae4fadb615de386b5e.png

  • Author

The is HA business is very confusing... two config.yaml 's   The first one is a completely stripped out config.yaml. When I press check config this works and takes a couple of seconds to check..

confignomodbus.png.96c6fc5a36e69877d520d5705036a095.png

This second one crashes HA with no warnings or log entries that I can see it just hangs with the blue circle thing. 

configwithmodbu.png.72814ea64ac2b218941e3699efe94240.png

This happens even if I comment out all the entries in my modbus.yaml like below

Modbusyaml.png.bd2751117b0b90ff95fce69b3830ef0d.png

I've got too many learning curves happening at the same time here and none are converging ont he same spot 🙂  . Can anyone see what I'm doing wrong here ? it must be something pretty basic. 

 

  • Author
But this works fine ?   Yeahh.
 
# Loads default set of integrations. Do not remove.
default_config:
 
# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes
 
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#modbus: !include modbus.yaml
 
modbus:
  - name: waveshare
    type: tcp
    host: 192.168.1.250
    port: 502
    delay: 0
    timeout: 5
    sensors:
      - name: modpv
        address: 186
        input_type: holding
        scan_interval: 5
        slave: 1
  • Author

If anyone reading this is interested. A good clear source of addresses can be got from the excellant Sunsynk power flow card by SlipX. Install the cards then look at the code editor and they are all there nicely lined up: 

entities:
  inverter_voltage_154: sensor.solarsynk_2205129054_inverter_voltage
  load_frequency_192: sensor.solarsynk_2205129054_load_frequency
  inverter_current_164: sensor.solarsynk_2205129054_inverter_current
  inverter_power_175: sensor.solarsynk_2205129054_inverter_power
  inverter_status_59: sensor.solarsynk_2205129054_overall_state
  grid_power_169: sensor.solarsynk_2205129054_grid_power
  day_grid_export_77: sensor.solarsynk_2205129054_day_grid_export
  grid_ct_power_172: sensor.solarsynk_2205129054_grid_ct_power
  day_load_energy_84: sensor.solarsynk_2205129054_day_load_energy
  day_pv_energy_108: sensor.solarsynk_2205129054_day_pv_energy
  pv1_power_186: sensor.solarsynk_2205184086_battery_power1
  pv2_power_187: gym2pv2
  pv1_voltage_109: sensor.solarsynk_2205129054_pv1_voltage
  pv1_current_110: sensor.solarsynk_2205129054_pv1_current
  pv2_voltage_111: sensor.solarsynk_2205129054_pv2_voltage
  pv2_current_112: sensor.solarsynk_2205129054_pv2_current

  • Author

hmmm also just noticed the power supply I plugged it in to today is a 5v one and the docs state it'll run on 6v to 36v. It seems to run fine on the 5v as well.  Does anyone know if there is a 12v supply that can be picked up in the inverter somewhere there seems to be on other inverters ? 

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.