SAJ solar inverter (R5 family) - thoughts

Hi,

I now have a SAJ Solar inverter of the R5 family (based on pictures…) running in my home since a few days ago. I’ve plugged HA into it in 2 ways that are both limited and somewhat complementary. I thought I’d share what I found can be done and can’t be done (and ask what I’m missing!) for that model, after searching earlier posts and toying with the integrations.

So far as I’ve found, there are 2 ways to connect HA with the solar inverter (or to be specific, with something that gives statistics about the solar inverter…):
1- get limited data locally over WiFi with the standard component
2- get more data from the SAJ remote server with a custom component, in 5-minute intervals

Approach 1 - standard component

With this bit of configuration…

sensor:
  - platform: saj
    host: 192.168.1.xxx
    name: solar
    type: wifi
    username: [email protected]
    password: doesntmatter

…I can get some basic data. Something to note is that the access type wifi requires username and password for HA to accept it, but the device doesn’t seem to make any use for it. Opening the URL http://192.168.1.xxx/status/status.php I see some values, without having to specify authentication in the browser.
Now that data seems to be quite limited. Checking the code for the Python library behind the standard saj platform (pysaj I think it’s called) , there’s nothing provisioned to read for example the current consumption of the house; nor does any value in the raw CSV output from the URL seem to be related with that metric.
So basically, with this approach, I get more or less live power production from the panel via sensor.saj_solar_current_power but not much more (there are of course a few more metrics such as daily accumulated yield and panel temperature). In particular I don’t see the electricity I use or import; only what I produce.

Approach 2 - custom component

Through this custom component, I can connect to the SAJ remote portal. The configuration looks like:

  - platform: saj_esolar
    username: [email protected]
    password: RealPassword
    plant_id: 0
    sensors: saj_sec

This time the credentials matter, and we’re getting data back from the SAJ portal.
Upside: more data is available: electricity used, imported, produced, exported; and the corresponding daily and total aggregated amounts of energy.

Downside: it refreshes only every 5 minutes. The custom component is configured to fetch every 5 minutes, but no point in modifying that: this is how frequently the server pulls data from the installation itself. Pulling more frequently in HA only allows getting the update slightly faster, but there will still be a 5-minute gap between data points. This can be confirmed easily, too: the SAJ app it self has 5-minute intervals between updates. And it’s not an average (at least I think), but rather a snapshot of the situation when the data was pulled by SAJ. This means, if you turn on your coffee machine for a quick coffee and draw 1500W for 3 minutes, there might not be any kind of peak in the data you get from there.

Another downside: the data collection by SAJ is very crude. In the evening when night falls, the last update the local version will give me is usually for a production of 39W, then it stops refreshing as the device goes offline. But the data on SAJ side show that the device is still online and producing 39W steadily for 1 hour after dark. This “ghosting” even causes the daily production aggregate to keep increasing! Only after 1 hour does it decide that the production is now 0, and the device is offline. Another example of crude management: even though I’m still not exporting, I have about 1 instance daily of some electricity reported as exported (with as much as 900W power). And my dishwashed apparently can draw nearly 3000W from the wall plug. Feels like much :thinking:

For illustration, here’s a screenshot of the current version of my PV dashboard – lots to be done still – using both sources.

Does it get better?

With all that in mind I wonder if I’m missing a way to get the complete data (dataset from approach 2) locally. How does SAJ get so much data from the outside? Surely there must be a way to capture this data from within the LAN, too ?! I’m considering a future plan of reconnecting the SAJ box to a raspberry Pi wifi router to capture packets and see what’s happening. I might however not see more than encrypted data…
One thing I’ve noted is that there was not 1, but 2 new IP addresses in my network (which my DHCP server assigned with consecutive numbers, confirming they appeared at about the same time). One of them (the “latest” one) is the one I was able to pull data from with approach 1. The other has a MAC address from some WiFi adapter manufacturer, and has absolutely no port between 0 and 9999 open, from a quick scan. I’m wondering if that’s the device that’s in charge of creating a tunnel for SAJ. In any case I’m not sure how to get more data out of either.

I hope this captures the current situation for future users and/or invites people who have more ideas about getting more local data to comment!

Cheers
P.

1 Like

Hi!
I also have a R5 (which is rebranded as greenheiss, seems SAJ sells them as whitelabel).

I also tried both the scenarios you describe and ended up with the saj_esolar integration you are using.

I think I can explain a bit more how your setup probably works (assuming it is the same as mine).
The R5 inverter can only provide information on the solar production (since that’s what inverters do). The information and consumption comes from an additional appliance (that second IP you see in your network) which is the SAJ SEC Module kit. This kit is a two way electric meter (probably a CHINT) and the actual SAJ module, which read the information from both the meter and the inverter and sends it to SAJ portal.
This pdf explains it in more detail

Unfortunately the SAJ SEC module does not provide any API or any easy way to easily pull information on real time, so you are stuck with polling it through their site. It uses MQTT to send messages to SAJ, but they are unencrypted, so you might be able to hack your way around that.

On a different note, for me that integration ends up putting some readings in the wrong entity (see my bug on what is totalloadpower · Issue #41 · djansen1987/SAJeSolar · GitHub). Does this happen for you as well? I assumed it was because some people there were using the H1 (which supports battery) instead of the R5 but maybe it’s a different reason.

edit

answering a couple more things

it refreshes only every 5 minutes.

The module does support changing this configuration, but honestly I have been a little afraid of touching it. The instructions are not particularly good

This means, if you turn on your coffee machine for a quick coffee and draw 1500W for 3 minutes, there might not be any kind of peak in the data you get from there.

not entirely. you might not see the peak in the load, but the used energy used will be correctly reported. If you are ever without internet, you’ll see that all the unreported energy will appear as soon as it can report back to SAJ.

And my dishwashed apparently can draw nearly 3000W from the wall plug. Feels like much :thinking:

3000w does seem a bit too high. Mine reports 2200W but I mostly use “eco” modes, and it is not constant. It draws most of its power very early and in the end of the cycle.

If you needed real time readings, I suspect you would need to read the data directly from the CHINT meter (through modbus). For me that seems too much work, the SAJ portal so far has been enough for my needs.

Hola Santiago,

That explanation is super useful, thank you!

I think I want to try! I was thinking earlier of resetting the connectivity, via the app, to an ad hoc WiFi network handled by a Raspberry Pi, to eavesdrop on the traffic. Knowing it’s unencrypted gives me hope, as I was thinking it would probably be in vain with just HTTPS packets to be seen.
I’m now wondering though, because I found out that besides the extra new IP (with all the ports closed - would make sense if it only ever pushes messages to SAJ servers), there’s a new WiFi network as well called DTI-Inverter. But based on what you said, if it’s called inverter it probably isn’t linked to the SEC. Also what confuses me even more is that the wifi module is plugged onto the inverter (and the inverter to the SEC, I think, by cable - one that looks like RJ45 but isn’t). This is why I thought that the inverter was doing the sending.

I got confused by the labels too; it doesn’t help that I’m a complete idiot when it comes to electricity. What I see on my side by comparing with the app is that totalLoadPower is the consumption of the house, totalGridPower seems to be the export, totalPvgenPower confusingly is the import, and nowPower is the PV power. I’ve also noticed today, after setting the HA polling to every minute in order to have less delay with the actual times of measurement and avoid situations where I would get the measurements every 10 minutes instead of every 5 because the polling by HA was about the same time as the polling from SAJ, that even though there’s only one “last upload timestamp” , the nowPower metric isn’t always updated at the same time as the other ones, even if they all are spaced 5 minutes apart at a minimum. Lots of strange things.

Interesting. I was wondering if those would be reliable or be based on the 5-minute aggregation as well because calculated on SAJ side. I believe I’ve seen on some occasions that when the panels shut down because of nightfall, the SAJ app keeps seeing a “ghost” production of 30-40W for an hour, and during that time the daily total production keeps growing even though it’s completely dark by then. I will pay attention to this, because it would seem to contradict your statement (and I hope that you’re right!)

Actually I rounded up very liberally, I think, and included the “rest of the house”. I think 2200W may be realistic for just the dishwasher peak.

Thanks again for your insights!
Pierric.

I wasn’t crazy: by 18:00 clearly the real production must have been 0 but the aggregate for the day keeps growing until finally the ghost productions stops:

So I’m not so sure about the reliability of the aggregates…

where is that sensor getting the info from? it does not seem like the regular esolar integration

The top one is from the esolar integration (the one that connects to the remote SAJ server). It’s the todayElectricity entity, which for me at least is exactly identical to pvElec , that is, it’s the daily accumulated solar production curve.
The bottom one is from the other integration (the one that HA bundles in by default, which gets local data with a finer time resolution).

In other news, I’ve bought a cheap WiFi antenna with promiscuous mode support and tried to listen a bit on the Wifi traffic to and from the 2 devices. I’m not very good at that but it does look like both ship data out to SAJ servers, but both on a 5-minute interval – at least by default. I still don’t know if there’s more frequent communication between the inverter and SEC locally, but if there is it’s likely to happen on the RS-485 cable that joins them, and spying on that is out of my league I’m afraid. I’m probably stuck on that front until someone with better skills attempts the same!

Have either of you made any further progress on getting the full suite of real-time data into HA? I’m about to get an SAJ inverter installed and was hoping to be able to utilise all the consumption and production data in my dashboards

Not on my side, no, unfortunately. The opposite in fact, at the moment I’m not even getting the data at all, except for production, from the Saj portal. According to the company that installed it, my SEC might have died and they have to replace it. After one year. :man_shrugging:

That’s such a shame and disappointing to hear. I’m having doubts about my decision to go with the SAJ now. Will look into it a bit more and see if it’s worth trying to get it switched out for something else. Thanks for your update and fingers crossed you can get something sorted with your system

Hi,

firstable I’m sorry for my English.

I have a Greenheiis (in fact a SAJ R5 rebranded). At this moment I’m testing different systems. I have a power meter connected via mqtt to my Raspberry where I have hassio installed. And I am also using this integration SAJ Solar Inverter - Home Assistant the IP you have to use is the IP of the dongle connected to the inversor. It has a problem I can see how much energy I generate but I cant see how much energy I’m getting from the grid.

In my solar installation I also have a DSU (that meters how much energy I generate, I get and I put to the grid) and a eSolar Sec-c. It item has another IP and only has a port open the port is the 502/tcp form the service mbap (mbap Modbus application protocolo). It has to be the element that sends all the info to greenheiss servers and it has to have all the info we need

Hi there

I would like to share my thoughts about the PV-production data with you.

In my opinion, it is sufficient to have the current power in Watts from the inverter.
You can calculate the corresponding energy in HA directly and it would be accurate.
You just need a solution for this ghost power in the evening. Maybe you can sort this out with a template and some value comparison. When the new value is below 100 and the same as the last value, set the value to 0. Or something like this.

Cheers
Matt

I’m pretty sure it is the case, indeed. My SEC died a few weeks ago and now I only see one IP and can only get the production.
But can the info we need be accessed (with a SEC that works, that is)? I don’t know… I could be wrong or missing something important, but earlier I had tried to monitor the traffic from that IP, and I believe the SEC was pushing data every 5 minutes of its own initiative (there was no obvious way to “ask” for the data), and doing so over MQTT using TLS encryption (thankfully for privacy and security; unfortunately for our purposes here). Definitely let me know if you find a way! I’m getting a SEC replacement soon.

I have been thinking about something like this, I think it should work, reducing the “lack of precision” to a smaller window (i.e. whenever the production really is around 50W). But I never got around to doing it.
Also I’m a bit discouraged about optimising the measurements after seeing that the SAJ portal will sometimes go bonkers; in this first year I have one day when the daily accumulated production was reported as x1000, breaking the accumulative data I was gathering (I fixed it in my Grafana/Prometheus setup by deleting the data for that day; I’m not proficient enough with Prometheus to actually modify the data).

If data are encrypted I think we can do nothing.
If data are unencrypted, we have one posibility.

Yesterday, I started to try with Modbus - Home Assistant

modbus:
  - name: modbus_hub
    type: tcp # nmap says the port is tcp but I`m not sure if it is correcto
    host: 192.168.0.202 # IP of my SEC device
    port: 502 # Port where my SEC device is listening

    delay: 0
    message_wait_milliseconds: 30
    timeout: 5
    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

But I didn`t get anything