djansen1987 / SAJeSolar

SAJ eSolar Portal Sensors
GNU General Public License v3.0
21 stars 13 forks source link
esolar hacs home-assistant homeassistant intergration saj solar solar-system

hacs_badge made-with-python Donate

SAJ eSolar Sensor Component

This is a Custom Component for Home-Assistant (https://home-assistant.io) reads and displays sensor values from the SAJ eSolar Portal private API.

NOTE: This component is built upon a none public API and can change/break at any time.
Please go to the Supported devides part to see if your device is supported

πŸ€˜πŸ‘©β€πŸ’» Calling Python & REST API Enthusiasts for HA SAJ Solar!πŸ‘¨β€πŸ’»πŸ€˜

Do you use the SAJ solar monitoring project and have knowledge of Python scripting and REST APIs?

If so, we need YOU!

I created this repository for a family member but made it publicly available as I saw a wider need. Newer SAJ dongles lack local connections, making this project valuable for others. However, demand has grown, and a major change is coming with SAJ's new website i can't deal with those changes on my one.

Challenges & Opportunities

We're looking for a co-author to help maintain and improve the project, particularly with the upcoming website changes. If you have Python scripting and REST API experience, we'd love to hear from you!

Join the Effort!



Installation

HACS - Recommended

Note when updating from v1.0.0.4
- resources are renamed in de configuration, replace old ones. applies when updating v1.0.0.4 -> 1.0.0.5

#

Usage

To use this component in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry

sensor:
  - platform: saj_esolar
    username: aa@bb.cc
    password: abcd1234
    plant_id: 0 # Default is 0. Typically ordered in the same way as they are listed in the eSolar app
    resources:
      - nowPower
      - runningState
      - todayElectricity
      - monthElectricity
      - yearElectricity
      - totalElectricity # Energy -> Solar production
      - todayGridIncome
      - income
      - lastUploadTime
      - totalPlantTreeNum
      - totalReduceCo2
      - status
      - plantuid
      - currency
      - address
      - isOnline
      - peakPower
      - systemPower # Installed capacity


If you have a H1 device, add below Sensors and Resouces:

  - platform: saj_esolar
    username: aa@bb.cc
    password: abcd1234
    plant_id: 0 # Default is 0. Typically ordered in the same way as they are listed in the eSolar app
    sensors: h1
    resources:
      - nowPower
      - runningState
      - todayElectricity
      - monthElectricity
      - yearElectricity
      - totalElectricity # Energy -> Solar production
      - lastUploadTime
      - totalPlantTreeNum
      - totalReduceCo2
      - status
      - plantuid
      - currency
      - address
      - isOnline
      - devOnlineNum
      - selfUseRate
      - totalBuyElec # Energy -> Grid consumption
      - totalConsumpElec
      - totalSellElec # Energy -> Return to grid
      - chargeElec # Energy -> Home Battery Storage -> Energy going in to the battery (kWh)
      - dischargeElec # Energy -> Home Battery Storage -> Energy coming out of the battery (kWh)

      - pvElec
      - useElec
      - buyElec
      - sellElec
      - buyRate
      - sellRate
      - selfConsumedRate1
      - selfConsumedRate2
      - selfConsumedEnergy1
      - selfConsumedEnergy2
      - batCapcity
      - batCurr
      - batEnergyPercent
      - batteryDirection
      - batteryPower
      - gridDirection
      - gridPower
      - h1Online
      - outPower
      - outPutDirection
      - pvDirection
      - pvPower
      - solarPower
      - totalLoadPower


If you have a Saj Sec Module Add below sensor an resources:

  - platform: saj_esolar
    username: aa@bb.cc
    password: abcd1234
    plant_id: 0 # Default is 0. Typically ordered in the same way as they are listed in the eSolar app
    sensors: saj_sec # Optional will only work with SAJ Sec Module
    resources:
      - nowPower
      - runningState
      - todayElectricity
      - monthElectricity
      - yearElectricity
      - totalElectricity # Energy -> Solar production
      - todayGridIncome
      - income
      - lastUploadTime
      - totalPlantTreeNum
      - totalReduceCo2
      - status
      - plantuid
      - currency
      - address
      - isOnline
      - peakPower

      - pvElec
      - useElec
      - buyElec
      - sellElec
      - buyRate
      - sellRate
      - selfConsumedRate1
      - selfConsumedRate2
      - selfConsumedEnergy1
      - selfConsumedEnergy2
      - plantTreeNum
      - reduceCo2
      - totalGridPower
      - totalLoadPower
      - totalPvgenPower
      - totalPvEnergy
      - totalLoadEnergy # Energy -> Grid consumption
      - totalBuyEnergy
      - totalSellEnergy # Energy -> Return to grid



If you are a user of Solarprofit / Greenheiss
_note that there is an certification issue for the greenheiss portal which is currently not accepted by Home Assistant to fix this use the providerssl: False

Add below code to you

    provider_domain: inverters.resellerdomain.ext
    provider_path: cloud

for example for greenheissen:

  - platform: saj_esolar #greenheissen
    username: USERNAME
    password: Password123
    provider_domain: inversores-style.greenheiss.com
    provider_path: cloud
    provider_ssl: False
    resources:
      - nowPower
      - runningState
      - todayElectricity
      - monthElectricity
      - yearElectricity
      - totalElectricity # Energy -> Solar production
      - todayGridIncome
      - income
      - lastUploadTime
      - totalPlantTreeNum
      - totalReduceCo2
      - isAlarm # Yes / No
      - status
      - plantuid
      - currency
      - address
      - isOnline
      - peakPower
      - systemPower # Installed capacity


Configuration variables:

Supported Devices:


solar Inverter:

R5 -0.7-3K-S1
R5-3~8K-S2
R5-3-20K-T2
Sununo plus 4K-M-RD


eSolar Modules:

eSolar SEC-module
eSolar WiFi- D
eSolar 4G
AOI3


Storage Solar Inverter

H1-3~6K-S2
AS1-3KS-5.1 (use h1 sensors)


Greenheiss

GH-I 2M STYLE


Not Supported Devices: (create github discussion to request)


Commercial Solar Inverter

Suntrio Plus 25-60K


Storage Solar Inverter

B1-5.1-48 (not tested)



#

Screenshot

alt text alt text



Debugging

Add the relevant lines below to the configuration.yaml:

logger:
  default: info
  logs:
    custom_components.saj_esolar: debug



Credits

Credits to @cyberjunky. I got inspired by his source code which helped me a lot to creating this Custom Component. https://github.com/cyberjunky/home-assistant-toon_smartmeter/

Donation

Buy me a coffee:
Buymeacoffee

PayPal:
Donate
Donate