SAJ Solar inverter

I have integrated my SAJ H1 in home assistant 6 months ago and it works great. It would be nice if it updated the data more often but I understand that this depends on the manufacturer’s API, so 5 minutes works for me.
I’ve been trying for a while to integrate the measurements in the HA energy panel, but I can’t do it. I have also tried the tesla style card with the same result. It seems very intuitive to me to be able to see how the energy flows between the photovoltaic panels, the electrical network, the batteries and the consumption of the home.
I find the problem when configuring each section of the energy panel because the sensors I need do not appear, for example the instant measurement of photovoltaic production (esolar_nowpower).
I have realized that this happens because that sensor is device_class: power, when what the energy panel needs is device_class: energy.
I don’t know if there is any way to convert a sensor from one class to another.
In addition, in the section on batteries, you must indicate the sensor that marks the charge and the sensor that marks the discharge. The problem is that a single sensor measures this parameter and is complemented by another sensor that indicates whether it is charging or discharging.
I would appreciate if someone could help me to configure it correctly.

En Saj h1 sí funciona, pero los codigos de direccion son otros

Por los puertos del inversor he conseguido obtener datos a tiempo real

1 Like

has anyone the H2 trufase inverters of SAJ??

at this address I get nothing in browser

http://192.168.1.155/status/status.php

Podrías iluminarme sobre cómo hacerlo?

can you share the sensor and the graph code?

Hi! Is that the modbus definition of SAJ H1? I can’t believe it, I have been searching that info for months. Could you send me the complete document? Thank you!!

1 Like

Buenas, hemos hecho un grupo de telegram donde tratamos este tema y otros (mas abajo)
Por modbus, puerto rs232 usb del inversor y los codigos del potocolo de comunicacion modbus del año 2020, he conseguido sacar datos a tiempo real, de lectura y escritura. Bien con nodered, o desde el archivo de configuration.yaml:
modbus:

  • name: SAJ
    close_comm_on_error: true
    type: tcp
    timeout: 5
    host: 192.168.1.60
    port: 502
    sensors:
    • name: modbus_red
      unit_of_measurement: “W”
      slave: 1
      address: 16545
      count: 1
      precision: 0
      scale: 1
      data_type: int16
      device_class: power
      scan_interval: 10
      unique_id: modbus_red
    • name: modbus_pv
      unit_of_measurement: “W”
      slave: 1
      address: 16549
      count: 1
      precision: 0
      scale: 1
      data_type: uint16
      device_class: power
      scan_interval: 10
      unique_id: modbus_pv
    • name: modbus_consumo
      unit_of_measurement: “W”
      slave: 1
      address: 16544
      count: 1
      precision: 0
      scale: 1
      data_type: uint16
      device_class: power
      scan_interval: 10
      unique_id: modbus_consumo
    • name: modbus_bateria
      unit_of_measurement: “W”
      slave: 1
      address: 16550
      count: 1
      precision: 0
      scale: 1
      data_type: int16
      device_class: power
      scan_interval: 10
      unique_id: modbus_bateria
      y asi con muchas direcciones del protocolo, algunas son erroneas y otras no están.

mas abajo lo detallo

1 Like

Muchas gracias!! Me uno al grupo de Telegram

Hi,

I’ve been using a WiFi dongle for a while with my SAJ SunTrio inverter and I preferred the REST sensor over the SAJ integration. I recently switched to an Ethernet dongle, and this other dongle provides XML output for the live data, I had the idea to switch back to the SAJ integration. I’ve been struggling with the module first, because it wouldn’t have displayed any live data. After contacting SAJ support they updated the firmware remotely on the module and the SAJ integration complained about equipment_data.xml not being found, since this latest firmware from SAJ doesn’t include the device information page anymore.

So I ended up creating REST sensors from the real_time_data.xml, here it is if anyone is interested:
In the top level:

rest:
  - resource: http://192.168.0.243/real_time_data.xml
    sensor:
      - name: "SAJ"
        json_attributes_path: "$.real_time_data"
        value_template: "OK"
        json_attributes:
          - "state"
          - "Vac_l1"
          - "Vac_l2"
          - "Vac_l3"
          - "Iac_l1"
          - "Iac_l2"
          - "Iac_l3"
          - "Freq1"
          - "p-ac"
          - "temp"
          - "e-today"
          - "e-total"
          - "CO2"
          - "v-pv1"
          - "v-pv2"
          - "maxPower"
          - "i-pv11"
          - "i-pv21"
    scan_interval: 10

The rest under template sensors, I’m using some templating to keep my daily energy sensor visible on some dashboards after the inverter is offline:

  - platform: template
     sensors:
       today_power_generated:
       friendly_name: Inverter Today power generated
       unit_of_measurement: "kWh"
       device_class: "energy"
       value_template: >
          {% if states('sensor.saj') == "unavailable" %}
          {{states('sensor.today_power_generated') | float }}
          {% else %}
          {{ state_attr('sensor.saj', 'e-today') | float }}
          {% endif %}
     actual_power_generated:
        friendly_name: Inverter Grid-connected power
        value_template: "{{ state_attr('sensor.saj', 'p-ac') | float }}"
        unit_of_measurement: "W"
        device_class: "power"
        unique_id: saj_power
     inverter_temperature:
        value_template: "{{ state_attr('sensor.saj', 'temp') | float }}"
        friendly_name: Inverter temperature
        unit_of_measurement: "°C"
        device_class: "temperature"
        unique_id: saj_temperature
     co2_emission_reduction:
       friendly_name: CO2 emission reduction
       value_template: "{{ state_attr('sensor.saj', 'CO2') | float / 1000 }}"
       unit_of_measurement: "ton"
       device_class: "carbon_dioxide"
       unique_id: co2_emission
     voltage_pv1:
       friendly_name: Inverter PV1 String Voltage
       value_template: "{{ state_attr('sensor.saj', 'v-pv1') | float }}"
       unit_of_measurement: "V"
       device_class: "voltage"
       unique_id: voltage_pv1
     voltage_pv2:
       friendly_name: Inverter PV2 String Voltage
       value_template: "{{ state_attr('sensor.saj', 'v-pv2') | float }}"
       unit_of_measurement: "V"
       device_class: "voltage"
       unique_id: voltage_pv2
     amps_pv1:
       friendly_name: Inverter PV1 String Current
       value_template: "{{ state_attr('sensor.saj', 'i-pv11') | float }}"
       unit_of_measurement: "A"
       device_class: "current"
       unique_id: amps_pv1
     amps_pv2:
       friendly_name: Inverter PV2 String Current
       value_template: "{{ state_attr('sensor.saj', 'i-pv21') | float }}"
       unit_of_measurement: "A"
       device_class: "current"
       unique_id: amps_pv2
     voltage_l1:
       friendly_name: Inverter L1 Voltage
       value_template: "{{ state_attr('sensor.saj', 'Vac_l1') | float }}"
       unit_of_measurement: "V"
       device_class: "voltage"
       unique_id: voltage_l1
     voltage_l2:
       friendly_name: Inverter L2 Voltage
       value_template: "{{ state_attr('sensor.saj', 'Vac_l2') | float }}"
       unit_of_measurement: "V"
       device_class: "voltage"
       unique_id: voltage_l2
     voltage_l3:
       friendly_name: Inverter L3 Voltage
       value_template: "{{ state_attr('sensor.saj', 'Vac_l3') | float }}"
       unit_of_measurement: "V"
       device_class: "voltage"
       unique_id: voltage_l3
     amps_l1:
       friendly_name: Inverter L1 Current
       value_template: "{{ state_attr('sensor.saj', 'Iac_l1') | float }}"
       unit_of_measurement: "A"
       device_class: "current"
       unique_id: amps_l1
     amps_l2:
       friendly_name: Inverter L2 Current
       value_template: "{{ state_attr('sensor.saj', 'Iac_l2') | float }}"
       unit_of_measurement: "A"
       device_class: "current"
       unique_id: amps_l2
     amps_l3:
       friendly_name: Inverter L3 Current
       value_template: "{{ state_attr('sensor.saj', 'Iac_l3') | float }}"
       unit_of_measurement: "A"
       device_class: "current"
       unique_id: amps_l3
     inverter_freq:
       friendly_name: Inverter Line Frequency
       unique_id: inverter_freq
       value_template: "{{ state_attr('sensor.saj', 'Freq1') | float }}"
       unit_of_measurement: "Hz"
       device_class: "power"
     total_power_generated:
       friendly_name: Inverter Total power generated
       value_template: "{{ state_attr('sensor.saj', 'e-total') | float }}"
       unit_of_measurement: "kWh"
       device_class: "energy"

I hope it will help someone else too.

Hi!
My R5 SAJ Inverter has a Wifi module. The problem is that it seems to do Mac Address randomization, so when it happens to reset, the IP address that I manually set for its MAC address no longer works.
So I need to always scan my network to find the new IP.

This makes the configuration via the yaml file no longer working, because it tries to find info from the old address.

How do you handle this problem?

@BenV

Can you share please you setting which you have used in your PUSR modbus gateway?

Thanks, Frank

Exactly, for AS1 and BS1 this should work, for other SAJ protocols the address are most probably different…

hi Frank,

Please see below my modbus gateway settings:

Also please see after this link the modusprotocols (including baudrate etc needed) for the AS1 and BS1 modules (link)!

Good luck and let me know if it worked out!

Kind regards,

Ben

1 Like

Hi Klagio,

Please see the modbus.yaml as well as the card code below,:

Energy card:

type: custom:tesla-style-solar-power-card
name: Energie Vermeulen
grid_to_house_entity: sensor.gridconsumption
generation_to_grid_entity: sensor.gridfeedinfrompv
generation_to_house_entity: sensor.pvconsumptiontohouse
generation_to_battery_entity: sensor.batchargingfrompv
battery_to_house_entity: sensor.batconsumptiontohouse
battery_extra_entity: sensor.battery_soc
house_extra_entity: sensor.today_totalload_energy
grid_extra_entity: sensor.today_gridfeedinfrompv_energy
generation_extra_entity: sensor.today_pvenergy
grid_entity: sensor.gridfeedinfrompv
house_entity: sensor.systemtotalloadpower
generation_entity: sensor.pvtotalpower
battery_entity: sensor.totay_batdischargeenergy
show_w_not_kw: 1
generation_icon: mdi:solar-power
appliance1_consumption_entity: sensor.tasmota_zmai90_boilerverwarming_energy_power
appliance1_extra_entity: sensor.tasmota_zmai90_boilerverwarming_energy_today
appliance2_consumption_entity: sensor.tasmota_boilerweerstand_energy_power
appliance2_extra_entity: sensor.tasmota_boilerweerstand_energy_today
appliance1_icon: mdi:water-boiler
appliance2_icon: mdi:string-lights

Modbus.yaml

#################################################################
## Modbus
#################################################################

      ##########################################################
      ## SAJ converter
      ##########################################################

  - name: SAJ
    close_comm_on_error: true
    delay: 5
    type: tcp
    timeout: 5
    host: 192.168.8.134
    port: 23
    sensors:
      - name: display_board_error_message
        slave: 0
        address: 16389 
        count: 2
        scale: 1
        precision: 0
        data_type: uint32
        scan_interval: 10
      - name: display_controller_error_message
        slave: 0
        address: 16391 
        count: 2
        scale: 1
        precision: 0
        data_type: uint32
        scan_interval: 10
      - name: display_controller_error_message2
        slave: 0
        address: 16393 
        count: 2
        scale: 1
        precision: 0
        data_type: uint32
        scan_interval: 10
      - name: error_message_controller
        slave: 0
        address: 16395 
        count: 2
        scale: 1
        precision: 0
        data_type: uint32
        scan_interval: 10
      - name: error_message_controller2
        slave: 0
        address: 16397 
        count: 2
        scale: 1
        precision: 0
        data_type: uint32
        scan_interval: 10 
      - name: Inverter_working_mode
        slave: 0
        address: 16388 
        count: 1
        scale: 1
        precision: 0
        data_type: uint16
        scan_interval: 1
      - name: Grid_phase_voltage
        unit_of_measurement: "V"
        slave: 0
        address: 16433 
        count: 1
        scale: 100
        precision: 0
        data_type: uint16
        device_class: voltage
        scan_interval: 1
      - name: Grid_Phase_current
        unit_of_measurement: "A"
        slave: 0
        address: 16434 
        count: 1
        precision: 2
        scale: 0
        data_type: int16
        device_class: current
        scan_interval: 1
      - name: Battery_voltage
        unit_of_measurement: "V"
        slave: 0
        address: 16489 
        count: 1
        precision: 0
        scale: 1
        data_type: uint16
        device_class: voltage
        scan_interval: 1
      - name: Battery_current
        unit_of_measurement: "A"
        slave: 0
        address: 16490 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: current
      - name: Battery_power
        unit_of_measurement: "W"
        slave: 0
        address: 16493 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Battery_temperature
        unit_of_measurement: "C°"
        slave: 0
        address: 16493 
        count: 1
        precision: 1
        scale: 1
        data_type: int16
        scan_interval: 1
        device_class: temperature
      - name: Battery_SOC
        unit_of_measurement: "%"
        slave: 0
        address: 16495 
        count: 1
        precision: 0
        scale: 0.01
        data_type: uint16
        device_class: battery
        scan_interval: 1
      - name: Battery_direction
        slave: 0
        address: 16534 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        scan_interval: 1
      - name: Gridconsumption
        unit_of_measurement: "W"
        slave: 0
        address: 16538 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: PVconsumptiontohouse
        unit_of_measurement: "W"
        slave: 0
        address: 16537 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: GridfeedinfromPV
        unit_of_measurement: "W"
        slave: 0
        address: 16539 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Gridfeedinfrombattery
        unit_of_measurement: "W"
        slave: 0
        address: 16540 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Batconsumptiontohouse
        unit_of_measurement: "W"
        slave: 0
        address: 16541 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: BatchargingfromPV
        unit_of_measurement: "W"
        slave: 0
        address: 16542 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Batchargingfromgrid
        unit_of_measurement: "W"
        slave: 0
        address: 16543 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Systemtotalloadpower
        unit_of_measurement: "W"
        slave: 0
        address: 16544 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: PVtotalpower
        unit_of_measurement: "W"
        slave: 0
        address: 16549 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Batterytotalpower
        unit_of_measurement: "W"
        slave: 0
        address: 16549 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Gridtotalpower
        unit_of_measurement: "W"
        slave: 0
        address: 16550 
        count: 1
        precision: 0
        scale: 1
        data_type: int16
        device_class: power
        scan_interval: 1
      - name: Today_pvenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16575 
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Month_pvenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16577 
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Year_pvenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16579 
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Total_pvenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16581 
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Today_batenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16583
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Month_batenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16585
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: year_batenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16587
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: total_batenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16589
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: totay_batdischargeenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16591
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: month_batdischargeenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16593
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: year_batdischargeenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16595
        count: 2
        precision: 0
        scale: 0.01
        data_type: int32
        device_class: energy
        scan_interval: 100
      - name: total_batdischargeenergy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16597
        count: 2
        precision: 0
        scale: 0.01
        data_type: int32
        device_class: energy
        scan_interval: 100
      - name: today_pvconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16639
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Month_pvconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16641
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: Year_pvconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16643
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: Total_pvconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16645
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: Today_gridconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16647
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Month_gridconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16649
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: year_gridconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16651
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: total_gridconsumed_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16653
        count: 2
        precision: 0
        scale: 0.01
        data_type: int32
        device_class: energy
        scan_interval: 100
      - name: Today_gridfeedinfromPV_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16655
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Month_gridfeedinfromPV_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16657
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: year_gridfeedinfromPV_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16659
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: total_gridfeedinfromPV_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16661
        count: 2
        precision: 0
        scale: 0.01
        data_type: int32
        device_class: energy
        scan_interval: 100
      - name: Today_Totalload_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16607
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
        state_class: total_increasing
      - name: Month_Totalload_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16609
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: year_Totalload_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16611
        count: 2
        precision: 0
        scale: 0.01
        data_type: uint32
        device_class: energy
        scan_interval: 100
      - name: total_Totalload_energy
        unit_of_measurement: "kWh"
        slave: 0
        address: 16613
        count: 2
        precision: 0
        scale: 0.01
        data_type: int32
        device_class: energy
        scan_interval: 100
1 Like

Hi, I don’t understand this …

And I may have additional issue, I do have 2 inverters in parallel mode, so I will need to double the settings?

Perhaps then use this?

https://it.aliexpress.com/item/1005004682787796.html?spm=a2g0o.productlist.0.0.4bd06605gJfz1U&algo_pvid=7d96c7dc-600b-4031-8a7b-7d25a89d1dc3&algo_exp_id=7d96c7dc-600b-4031-8a7b-7d25a89d1dc3-17&pdp_ext_f={"sku_id"%3A"12000030086142217"}&pdp_npi=2%40dis!EUR!142.53!71.27!!!!!%400b0a0ac216680917281902833e4328!12000030086142217!sea&curPageLogUid=sHZO4aVdPMKT

whicxh model do you have? Mine H2-10K

@Ben:
Hi and thanks for sharing.
Will try it this weekend. Will also check the communication at the RS485 line to the smart meter.
There is the possibility, to merge more inverters in parallel mode:

So they need to communicate and do this on RS 485 bus.
I hope, to read the same modbus addresses on the RS 485 bus like on the RS232. The benefit would be keeping the AIO3 working. On RS 485, multiple devices can be present on the bus. On RS 232 the modbus TCP gateway OR the AIO3. Will keep you here informed.

Thanks again and best regrads, Frank

1 Like