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
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.