Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication broken for SAJ API #10

Open
connornz opened this issue Jan 1, 2024 · 21 comments
Open

Authentication broken for SAJ API #10

connornz opened this issue Jan 1, 2024 · 21 comments

Comments

@connornz
Copy link

connornz commented Jan 1, 2024

Hi, trying to add my B2-HV system to HA but getting invalid credentials when trying to add the intergration. Is there a problem with the integration with the new API or is it me?

Screenshot 2024-01-01 at 4 08 28 pm
@davidjbwatson
Copy link

I am having same issue for a week now.

@faanskit
Copy link
Owner

faanskit commented Jan 2, 2024

I no longer have a SAJ inverter, but it looks like SAJ eSolar has changed login. The login link the integration use responds with 302.
image

It looks like they have moved the login and in the portal they seem to add CAPTCH for some market.

Likely this integration will no longer work due to this.

The other SAJ integration seems to have same/similar issue:
djansen1987/SAJeSolar#72

Please try it instead.

Since I don't have a SAJ inverter it is unlikely I will spend time on this...

Feel free to nominate someone to continue this work...

@davidjbwatson
Copy link

davidjbwatson commented Jan 3, 2024 via email

@davidjbwatson
Copy link

How do I find someone who could fix this issue?

@faanskit
Copy link
Owner

faanskit commented Jan 3, 2024

There are some forks made, check with the owners of the forks if they have a solution.
We use undocumented reverse engineered API's towards Saj in this integration, and Saj can change at any time (like they now did).

I noticed that they also started with CAPTCHA for some regions now, so likely soon it will completely break.

You can always ask Saj to publish API's...the more who asks, maybe one day they will support it. SolaX did it after community push.

@RobbieDemaegdt
Copy link
Collaborator

As SAJ is (partial) a chinese company, I think we can forget about a public API. My integration is currently still working, fingers crossed that it stays like this.
If mine ever breaks I might check to fix it but I'm not an expert in this program language.

@walkjivefly
Copy link

@robshot do you have a link for your integration?

@faanskit
Copy link
Owner

faanskit commented Jan 4, 2024

@robshot do you have a link for your integration?

It's in the first sentence of the README to this integration :-D

Here:
https://github.com/djansen1987/SAJeSolar

@RobbieDemaegdt
Copy link
Collaborator

I mean the integration in my HA, I'm using this intergration in my HA as I helped faanskit with debugging some things.

@walkjivefly
Copy link

ha ha, yeah, bit of a misunderstanding here. I thought @robshot was saying he had a separate HA integration (fork or whatever) that was still able to connect to the SAJ API.

@lucianor
Copy link
Collaborator

This is an old issue, but the API authentication is not broken. The problem is that SAJ provides two nodes:

image

This application defaults to the EU node, while the international node has different URLs.

I'm working on a fix and will submit a PR, but the easy hack is to go to your custom_components/saj_esolar_air folder and edit esolar.py lines 11 and 12 and replace it with:

BASE_URL = "https://intopapp.saj-electric.com/sajAppApi/api"
BASE_URL_WEB = "https://intop.saj-electric.com/saj"

Also remove the pycache folder under the same folder. Restart homeassistant and reconfigure it again. It worked just fine for me..

@faanskit
Copy link
Owner

@lucianor if you want to take over this repository, let me know and I´ll transfer it to you or make you an admin.
I am no longer using SAJ and will not maintain it.

@lucianor
Copy link
Collaborator

I just added a PR to fix the region switch problem, so this bug can be closed.
@faanskit please DM me and let's talk about your component. I would like to discuss some things you did before I take over.

@lucianor
Copy link
Collaborator

lucianor commented Jul 29, 2024

@djansen1987 is another good candidate to maintain this. It looks like he did not fork so now I'm trying to compare his repository with this, but his code structure is different. His field handling however is better. So I think we need to combine the two somehow. If @djansen1987 is game, so am I.

@djansen1987
Copy link
Collaborator

Hi for me goes the same, I only created the integration because of a family member. It currently does everything he needs. If some one wants to take over be my guest. Only requirement I have is it should be backwards compatible so the current 106 users won't lose their history data (longterm data which is held to the entity id)

@lucianor
Copy link
Collaborator

Fair point.. Will submit another PR to address that and defaults to EU region, since that is the default for this till now. If the sensor data changes from your fork and this, then there is a higher challenge, and maybe we will need to have two sensors with same data.

@djansen1987
Copy link
Collaborator

Something like that yes. Both integrations have nice features, hard part is to bring them together. Even nicer would be if the original integration in home assistant (official) could be updated so all users can benefit without having to install hacs, but this will cost some tike and effort. Also some migration documentation.

@lucianor
Copy link
Collaborator

There is where I'm heading next...
I have 3 SAJ M2 micro inverters which do not expose any XML or PHP page whatsoever - or any open port on nmap scan.
So cloud is the only way to go. It would be nice if the default configuration adds a cloud type, and add the possibility of adding directly from the UI - this code does that already, so it's just pushing it through.
I'm thinking about authoring a PR directly to homeassistant-core when I'm done with that.

@faanskit
Copy link
Owner

I just added a PR to fix the region switch problem, so this bug can be closed. @faanskit please DM me and let's talk about your component. I would like to discuss some things you did before I take over.

Contacted you via e-mail and made you a collaborator.

@faanskit
Copy link
Owner

faanskit commented Nov 9, 2024

Please see if pre-release V0.0.10 solves this. PR from @lucianor merged

@djansen1987
Copy link
Collaborator

@lucianor if you see any options in to merging this project and mine, you are welcome to have a chat about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants