SAJ Solar inverter

@jock
Is this work in progress, or can this really be used already?

Hi,

I have a SAJ H1 5K inverter connected with a AIO3 Wifi module. What is the best approach to get this one in HA? I see so many info, but it looks like most of them is working when you can reach the Inverter directly on IP. In my case I can’t since it’s the AIO3 module that is used as communication tool.

Thanks for pointing me in the right direction.

You can use this custom integration to get data from the SAJ eSolar platform (where the AI03 Wifi module sends its data to):

If you want local data, you can probably use this custom integration with a modbus to wifi device (as explained in the readme of that integration).

I currently use both and they work fine on a SAJ R5

1 Like

Hmm, so the first link you gave me is in fact some sort of Scraper from the SAJ portal.
If I want live data from the Inverter there is no other way than going forward with the Modbus integration, right?

You can also try the mqtt way.
I’m trying it out right now, and it doesn’t require any hardware changes.
See SAJ Solar inverter - #177 by jock
I’m currently exploring the individual scripts to read the data. Afterwards I’m probably going to try the custom ha integration as well, which uses the same logic as the individual scripts.

Hi All,

I have a H2 10KW SAJ inverter and 30kW SAJ batteries. I installed the HACS custom component, and logged in fine. It detects 1 Entity for plant, but none of the sensors are showing. Is there something simple I can do to get it working? I’d like to be able to control the battery via home assistant, but just getting sensor values would be a good start.

I also tried using the guide by Jock, but when I try to go through one of the guides, it takes me to Google Play store and says link is invalid? Does anyone else have the same issues?

i have same problem with the google play link.
I need some help to configure : change the MQTT broker using eSAJ Home app (see this) to your local MQTT broker

I managed to work out the google link bit, I setup MQTT and managed to connect to the dongle/H2 unit with bluetooth, but I am unsure how to setup my router to re-route the MQTT messages, but I’ll look into it more and see how I go.

For those with H2 inverters, I managed to get the SAJ esolar HACS add-on connected, it logs in fine and finds the inverter, but doesn’t see anything else. It seems to find the API fine and some other basic info, so as my address, but I can’t get any actual system stats. e.,g. Solar power, battery level etc. I feel like some messing around with the plugin might get it pulling the right data?

Hello Hugo, I have bought a SAJ H1 Hybrid-inverter with 15kwh accumulator and will connect it with my iobroker home-automation. The ModBus-adapter from the iobroker need the adress in decimal-code. I dont know how to covert this. All converter give me a error-message because the letter G and H. Can you also send me file please? Or a disclaimer how to convert this hex-code. Thank you so lot.

Best regards

Norbert :slightly_smiling_face:

Man this is driving me mad. Got myself a W11 RS485 > Wifi adapter. Wired it up as per instructions and double checked my wiring, all good. Took wiring off and checked voltages. The RS485 +/- ports seems to be doing the right thing (pulsing 0-2.1v), but the power output is only 3.9V from the RS485 port. I checked all wires and nothing with any voltage over 3.9v. I have triple checked everything and no luck. Is it possible that it is not enabled in SAJ software?

Just to keep everyone updated here. I ended up connecting my oscilloscope to try and hunt down which wires are RS485. Nothing coming out of any of the ports or RS485 port on my H2 inverter resembles a RS485 or any serial comms, and there is no 7V power coming out of any of the wires, but the RS232 port coming out of the USB where the dongle usually goes is fine. My only thought is that the electrician disabled the ports as he has my other inverters feeding into the H2 inverter.

I will have to try and logon as a installer (not sure how to do this?) and see if something funny is going on with the port setups.

Hello,

I have an SAJ H2 inverter with AIO3. The Modbus port 502 is open. It is easy to read out the relevant registers for PV performance , Grid Power … in Home Assistant.

No RS232/TCP adapter is needed and you can continue to use the SAJ eSolar app.

Just test it with a port scanner to see if the AIO3 502 port is open. The firmware version of my AIO3 is v1.200.4.

1 Like

Hi Ben,
I recently got a saj inverter from the HS2 series, it seems like I need to use different addresses. Do you have any contact to some technical guys at saj to ask for documentation regarding the HS2 series modbus protocol/registers?
Kind Regards,
Koschi

See PM!

kind regards,

Ben

Hey,

Do you have some more information on how you do that?

AIO3 connecting with WiFi? Must we change somethings in the configuration of the AIO3.

Witch integration you use in Home Assistant?

Will,

Can you control gridcharging by home Assistant? Witch adresses you use?

AIO3 must, of course, be connected to the Wifi.

Check the router/Fritzbox for AIO3 and note the IP address.

I use the following code in HA to query the relevant values via Mobus:

PV power, battery power, grid, and house.

The data is displayed on an Energy Flow card.

I use a separate Config File modbus.yaml:

- name: modbus-saj
  type: tcp
  host: 192.168.178.76
  port: 502
  message_wait_milliseconds: 1000
  timeout: 5
  delay: 3
  
  sensors:
     - name: modbus_register_block
       slave: 1
       address: 16495  # Der Start des Registerblocks.
       count: 56  # Die Anzahl der Register im Block (16550 - 16495 + 1).
       data_type: custom
       structure: ">56h"  # Passt die Struktur an die Anzahl der Register und den Datentyp an.
       scan_interval: 10

in configuration.yaml:

modbus: !include modbus.yaml


template:
  - sensor:
      - name: modbus_total_pv_power
        unit_of_measurement: "W"
        device_class: power
        state: >
          {{ states('sensor.modbus_register_block').split(',')[54] }}

      - name: modbus_sys_total_load_watt
        unit_of_measurement: "W"
        device_class: power
        state: >
          {{ states('sensor.modbus_register_block').split(',')[49] }}

      - name: modbus_bat_power
        unit_of_measurement: "W"
        device_class: power
        state: >
          {{ states('sensor.modbus_register_block').split(',')[55] }}

      - name: modbus_bat_energy_percent
        unit_of_measurement: "%"
        device_class: battery
        state: >
          {{ states('sensor.modbus_register_block').split(',')[0] | float * 0.01 }}

      - name: modbus_total_grid_power_watt
        unit_of_measurement: "W"
        device_class: power
        state: >
          {{ states('sensor.modbus_register_block').split(',')[50] }}

Grid charging can also be controlled via AIO3.

However, this requires manually switching to “Time of Use” mode in the O&M App.

The registers for “Working Mode” and others are locked for R/W via AIO3.

BUT! The registers are writable for the start/end times of battery charging.

I use the following code to write the start and end times:

in scripts.yaml


  start_laden:
    sequence:
      - service: modbus.write_register
        data:
          hub: modbus-saj
          unit: 1
          address: 13831
          value: 5947   # 23:59 

  stop_laden:
    sequence:
      - service: modbus.write_register
        data:
          hub: modbus-saj
          unit: 1
          address: 13831
          value: 20   # 0:20 Uhr


in a Automation its possible to call the Script “Start Laden” and “Stop Laden”
the Start Time Register must set to “0” # 0 Uhr

or get the Start and Endtime from the cheap Price Window to a Variable and write via modbus to Inverter

This is my next Project when i can switch to Energy Provider “Tibber” in April 2024.

SAJ Modbus Protocol PDF 2020 Version https://t.me/saj_nooficialoriginal/8487

for H2 Inverter ! dont use older Versions for example 2017

Registers for Start/End Time begin from 3606H

3 Likes

Thanks for taking the time to put these instruction up. I tried this with my H2 but can’t get it to work. I can ping the AI03 successfully, and even connect to it via RealTerm (but not see any data), and nothing comes through on Home Assistant. I don’t get any error when HA starts, but at the same time can’t see any of the sensors you’ve put above :frowning: My RS232 > Wifi (W10a adapter) arrives tomorrow, so hopefully that fixes things.

Have you done a port scan? There are port scanner apps for Android/iOS

If port 502 is not open, it will not work.
Please check this. What firmware version does the AIO3 have? my AIO3 is 1.200.4

Then use a Modbus tool e.g. QModMaster download | SourceForge.net and read the registers manually.

Under Options: Modbus TCP set IP, Port 502

Modbus Mode: TCP , Slave 1
Function Code: Read Holding (0x03)

If this works, then it must also work in HA.

Managed to get it working, thanks for your help. It just suddenly showed up in HA as I was trying to setup my W10 (RS232-Wifi), I was restarting it and it came good. I had tried checking various ports and they were all fine, so not sure what made it suddenly work. I figure it just needed a proper restart or something. My Ai03 is the same firmware version as yours. I haven’t tried to battery control yet, just monitoring things to get a feel for it. I have live electricity pricing and I run a bunch or servers and crypto rigs on excess solar only or when the grid pricing is low, so will work out a few integrations for th efuture.

After spending all this money on a W11 and W10 serial > Wifi dongle, the standard AI03 work fine.

Surely someone can write a integration for this? I had also been in contact with SAJ and they seem keen to integrate local live pricing into their platform but not so much with these sort of integrations. I did mention to them that there is a large community out there that would love support in HA, but they just don’t seem interested.