Solis Inverter Modbus integration

@boydo any luck creating the sensors in HA again? Still no luck working for me :frowning:

@boydo I haven’t got that bit integrated to HA yet, everything else I’m feeding in through MQTT at the mo using the below, running stanalone on a separate raspberry pi due to my issues getting the rs485 usb stick with my synology nas. You may well be able to run it as a python script from within HA, certainly worth a go!

I’ve updated it since I first posted and all the control code is commented out at the bottom.

1 Like

I was playing around with it just now and got it working, no idea what I did wrong the last time :smiley:
Here’s the code in case it might help someone

modbus:
  - name: hub1
    type: serial
    baudrate: 9600
    bytesize: 8
    method: rtu
    parity: N
    port: /dev/ttyUSB0
    stopbits: 1
    sensors:
      - name: InverterTemp
        slave: 1
        address: 33093
        input_type: input
        count: 1
        scan_interval: 15
      - name: GenerationToday
        slave: 1
        address: 33035
        input_type: input
        count: 1
        scan_interval: 15
1 Like

Question I thought that setting precision: 1 is supposed to turn the 338 value into 33.8 but just changes it to 338.0
image
What’s the correct way to fix it inside of the sensor?

sensors:
      - name: InverterTemp
        slave: 1
        address: 33093
        unit_of_measurement: °C
        input_type: input
        count: 1
        precision: 1
        scan_interval: 15

Yeah looks like you got it :slight_smile:

This is mine so far. just trying to recreate what I had and try the mod time of charge again but this time set the “Storage control switch value” that might be what I missed last time!

modbus:
  - name: solis
    type: serial
    method: rtu
    port: /dev/ttyUSB0
    baudrate: 9600
    stopbits: 1
    bytesize: 8
    parity: N

- platform: modbus
  scan_interval: 5
  registers:    
  
    - name: solisinvertertemperature
      hub: solis
      unit_of_measurement: °C
      register: 33093
      register_type: input
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      scale: 0.1     
      
    - name: solisbattarysoc
      hub: solis
      unit_of_measurement: "%"
      register: 33139
      register_type: input
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      #scale: 0.1  
      
    - name: solisbatterychargecurrentlimitation
      hub: solis
      unit_of_measurement: A
      register: 33143
      register_type: input
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      scale: 0.1

    - name: solisbatterydischargecurrentlimitation
      hub: solis
      unit_of_measurement: A
      register: 33144
      register_type: input
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      scale: 0.1

    - name: solisbatterycurrent
      hub: solis
      unit_of_measurement: A
      register: 33134
      register_type: input
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      scale: 0.1

    - name: solisbatteryvoltage #U16
      hub: solis
      unit_of_measurement: V
      register: 33133
      register_type: input
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      scale: 0.1

    - name: solisbatteryminsoc #U16
      hub: solis
      unit_of_measurement: "%"
      register: 33214
      register_type: input
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      #scale: 0.1

    - name: Solis Storage control switch value #U16
      hub: solis
      #unit_of_measurement: "%"
      register: 43132
      register_type: holding
      count: 1
      slave: 1
      #precision: 1
      #data_type: uint
      #scale: 0.1

    - name: Solis Time-chargeing charge current
      hub: solis
      unit_of_measurement: "A"
      register: 43141
      register_type: holding
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      scale: 0.1

    - name: Solis Time-chargeing discharge current
      hub: solis
      unit_of_measurement: "A"
      register: 43142
      register_type: holding
      count: 1
      slave: 1
      precision: 1
      data_type: uint
      scale: 0.1


I use scale e.g.

      precision: 1
      data_type: uint
      scale: 0.1
1 Like

Thanks, that did the trick.
Since I have hooked up the modbus adapter earlier today, I am seeing the “generation” spike to crazy values:


I have both the wifi logger connected and the usb rs485 adapter together, I think they might trip over each other when reading the data at the same time?
I tried “slave: 2” but it only works with 1.
Any ideas?

How are you connecting for RS485? On my RAI-3K-5G I have to remove the WIFI to get the Modbus connection. Did you open the WIFI module and connect to that?

I think within the config for that sensor you might be able to add a max which might stop those?

Yes soldered new cable onto A/B/GND of that white connector inside, then the cable goes to the HA usb rs485 adapter
If I remove the wifi module then it will no longer log to cloud, I’d like to keep both, I think someone here did that, maybe @craigcurtin I believe (Craig you wanna help us?)
And that graph is from SolisCloud app so this is the logger itself sending bogus data, not HA sensors

1 Like

Yeah its a pain not having the wifi but I have developed YouGeneate.co.uk which I am getting data to from HA > emonCMS > YouGenerate portal. This means I have local as well as remote visibility. just need to be able to control it :wink:

I went and did it… yaaaaaaaaaa…

Was able to create a test automation which allowed me to write an array as below…

service: modbus.write_register
data:
  hub: solis
  unit: '1'
  address: '43143'
data_template:
  value: [00, 00, 0, 0, 21, 26, 21, 30]

Which means that it will discharge between 21:26 to 21:30.

If you try and write each individual registry to set the charge and discharge times the inverter dose not work e.g. the inverter dose not respond to the times set. HOWEVER if you set the times using an array in the example above the inverter acts on the times!

Once you have the times set it is then possible to change the charge and discharge rate to control flow as single registry updates.

As @Markg says you have to also set the “Storage control switch value” value to 35 to force charge mode e.g.

service: modbus.write_register
data_template:
  hub: solis
  unit: '1'
  address: '43110'
  value: '{{ trigger.to_state.state | int }}'

Thanks @Markg for pointing me in the right direction… would buy you a beer sir, if your ever in NI :beers: cheers

Amazing! Glad you got it going!

I think this happens if the times overlap, if you set the times overlapping in the array or even on the inverter itself the same happens from what I’ve seen.

I was a little lazy doing this, it’s actually BIT01 that triggers the timed charge mode, so changes between 33 and 35, might be worth keeping an eye on in any future firmware versions as there are a bunch of reserved values in the table. (Appendix VII in this document)

My TTL-RS485 board arrived yesterday so going to start playing with an ESP8266 controlling the inverter this week, it’ll be interesting to see what logic you come up with in HA that can be used for that too :grin:

1 Like

How does everyone else display their solar data in HA? Here’s my attempt at an energy dashboard. I added in the force charge/discharge switch last night as today’s predicted generation wasn’t great, used the scheduler card to control it until I work out the best way to use automations to decide when to charge.

2 Likes

does anybody know if its possible to stop discharge at 30%
and do discharge if power usage is over X watts?

back story, in belgium you will pay more on your bill if your peak usage (watts/15 minutes) is over 2400 watts

Just so you folks know…there’s a chap on ebay Germany selling a blank plug with instructions on how to make it suitable for rs485 modbus output.

I paid I think 13 euros for the plug…and he sends the instructions too.

2 Likes

Just so I am clear…will this allow us to get real-time data into home assistant?

Thanks for posting this. I had to actually 3d-print a connector for mine, but it’s not nearly as solid as this one. I’ve also read a few mentions that this is actually a standard aircraft DIN connector (and I’ve been meaning to go by the local airport and talk to one of the avionics installers, there, to see if this is the case).

They appear very similar to the 4-pin GX connector, I’ve got some here.
I also have the standard solis connector. When I try to connect them, they don’t quite fit, but you could possibly force it. Also the threaded sections are completely different sizes.

Also, I’m doing it the wrong way round here, with a female Solis connector and a male GX, but for this you’re looking to connect a female GX to the male solis connector on the inverter. If I can find one I’ll give it a try.


Hello all,

Looks like some great work here - has helped me out with getting info from my inverter. I also came across another integration by Stephan Joubert (for Solarman inverters, which all seem to use the same data loggers) - which was pretty much plug and play with my Wifi data logging stick. Entered the IP and it managed to pull data out of the inverter! Integrates very nicely with the Home Assistant Energy feature too. Seems that some of the data logging sticks already expose Modbus directly to TCP.

I’m now looking at what I can do to control the unit too. Having trouble setting the parameter number 43141 and 43412 for Timed Charge and Discharge rates. My inverter is already in timed mode, and has a valid timetable set, but when I send a 0x06 function code with a new value, I get a response which appears to have set it and the next read of that parameter appears to have set it, but the inverter doesn’t change its charge rate - any thoughts?

Update: Scratch that - it worked! Seems we can now remotely control these Solis inverters without any additional hardware!

2 Likes

This looks fantastic if it works (have to try tomorrow on my Solis 5G hybrid). @Gadgit83 you mention the control side of things (crossed out): I can’t see any code that suggests that GitHub custom component has anything other than sensors (e.g. readonly) - assuming it works for me at all - but are you using another technique to control your inverter?

I want my HA to control when it charges from grid etc