SAJ Solar inverter

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.

nice to hear that it works
always important to restart HA after changes.

There is an addon on github SAJ eSolar Sensor. Uses the web data which is sent to SAJ. Also works with H2 Inverter

SAJ has started to integrate dynamic battery charging prices into its app (eSAJ Home and web version https://eop.saj-electric.com/).

Tibber, a German provider of dynamic electricity prices, uses ENTSOE prices as a source.

In SAJ Home app you can set AI dynamic charging. But has nothing to do with AI :slight_smile:

I have not been able to do it in the web version because the price template is still buggy.

Still a bit beta stage, but things are slowly moving in this direction

Cheers, yeah I was trying the AI charging and was chatting with SAJ and they were working to add my electricity provider. I think doing it manually in HA and having some parameters to set i.e. leave a certain minimum charge in the battery etc etc will be better.

I managed to get the grid charging script working fine too. Are there certain Modbus registers I can write to to enable/disable the battery discharging to the Home or Grid, or the amount of power it can discharge to home or grid? As I am on a wholesale live price account, it is quite often that the solar feed in tariff is negative i.e. you pay if you are producing excess solar, so I usually just setup some of my Servers or water pumps to run when there is excess solar, but unfortunately that also drains the battery so I’d like to be able to automate that in HA.

In the SAJ O&M app, you can activate/deactivate the feeding of power from the battery into the grid.
Is deactivated by default

it is possible to write the register for “Grid Feed Power Limit” with Elfin TCP/Modbus Adapter (but I don’t have an adapter, a friend uses Adaper and it seems to be possible to address all registers - but be careful!)

or set the “Application Mode” to “Self-Use/Time-of-Use/Backup”

Test the backup mode to see if excess PV energy is fed into the grid

i can send you the 2020 PDF Procotol - which you can also find in the Spanish Telegram group (see post above) Important only the 2020 version for H2

I’m demoralized. everything worked flawlessly until September, Saj updated the inverter and from that moment the modbus registers are all different. I’m in contact with Saj and they naturally deny that anything has changed, but if that hasn’t been the case I had no reason to complain. I bought both the ew11 and ew10 but I don’t have the data with that either. Saj can’t do a firmware downgrade it seems. what a disappointment.

I have this inverter:

Model:
H1-6K-S2
PC Code:
1020001700EN056800
Display Board:
v3.019
Ctrl. Boards:
v1.362
Module SN:
M5400J2231097856
Module PC
1030001100016100
Module version
v1.202

Does anyone else have the same version and maybe it works for them?

Before I didn’t trust Saj very much, in fact I had integrated with mqtt precisely to prevent them from somehow entering and causing damage, now I no longer trust it. Then I haven’t had an answer since September and this makes me very angry

let me know

Thank you

I’m having a H1-5K-S2 inverter with the same versions as you.
You might want to try out this: GitHub - paolosabatino/saj-mqtt-ha: Home Assistant integrator for SAJ H1 inverters

I’m running this and I’m able to get the realtime data. (Check the discussions on github on how to setup the mqtt bridging)

I own a saj H2 3 phase inverter. Does anyone have any documentation concerning the modbus registers?

Hi Ben, could you share SAJ technical contact details to me as well?
Thx!

I saw you got contact details from Ben for SAJ technical guys.
Were you able to contact them?
I suppose not, since you are requesting for modbus register documentation for your 3-phase inverter?

I use the WiFi one which seems to work fine but the morning after I installed the integration, my inverter stopped sending data (or was sending it with very long, irregular intervals). Could be a coincidence of course but I was wondering if this has happened to anyone else?

Yes, you are right, I mailed Ben two times, but got no answer (yet).