home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70k stars 29.08k forks source link

No Connection with SMA Integration / SMA Integration Login failed #67953

Open Jogiarea opened 2 years ago

Jogiarea commented 2 years ago

The problem

Hello Have a problem with the SMA integration, I can not log in. I have already gone through all log invariants, always "Unexpected error". Have also already changed the system password without success, always brings errors. 3fail

My installation: 1

Modbus is on 2mod

Plant location DE Both inverters have a static IP Speedwire encryption is off Inverter with the latest firmware

Have tried to log in for half a year again and again but without success

Do someone have any Idea what I ve done wrong?

With Modbus i can connect to the Inverter but not to the Battery-Inverter

What version of Home Assistant Core has the issue?

2022.3.2 and other

What was the last working version of Home Assistant Core?

2022.3.2

What type of installation are you running?

Home Assistant Container

Integration causing the issue

SMA

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sma/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

henne49 commented 1 year ago

Upgraded to latest 2022.11.0, problem still exists

henne49 commented 1 year ago

Problem solved, somehow Firewall blocked the communication, not sure why. Do you use any connectivity to this url: https://www.sma-solar.com ?

janningnetworks commented 1 year ago

Today i talked to SMA support. Not all Inverters do have a webinterface. For example my Sunny Tripower STP 20000TL hasn´t. So maybe this is the reason, why many people cannot connect through SMA integration. SMA Support told me, that i need to use modbus, if i want to connect directly to the inverter.

ghoethe commented 1 year ago

Same here.

Home Assistant 2022.12.1 Supervisor 2022.11.2 Operating System 9.3 Frontend 20221208.0 - latest

Sunny Island 4.4M-13 <<-- works Sunny Tripower 8.0 <<-- can't connect, like the first post

Both devices in the same configuration in communication

xzaz commented 1 year ago

@ghoethe What Can you reach the device in the browser with 80 or 443?

ghoethe commented 1 year ago

Login through the Browser port80 works on both devices

rklomp commented 1 year ago

Can you share debug logging of the SMA integration and pysma when this happens?

Turn on debug in the configuration.yaml and than restart HA.

logger:
  default: info
  logs:
    homeassistant.components.sma: debug
    pysma: debug

Make sure you remove credentials etc. from the logs.

ghoethe commented 1 year ago

Logger: frontend.js.latest.202212080 Source: components/system_log/init.py:256 First occurred: 15:51:45 (1 occurrences) Last logged: 15:51:45

:0:0 Script error.


full log

2022-12-11 16:15:46.451 ERROR (MainThread) [frontend.js.latest.202212080] :0:0 Script error.

Did i have to install something before? pysma-libary? how? Or is the only one, the "SMA service"?

nielswinters123 commented 1 year ago

The password for the User needs to be between 8 and 12 characters. This resolved the issue for me. :)

ghoethe commented 1 year ago

With special character or without?

nielswinters123 commented 1 year ago

I only have upper and lower case characters and numbers in my password, no special characters.

ghoethe commented 1 year ago

i have with special character and with the Sunny Island it works. On the other side, I can't change the password: it says I have to use a special character, 8-12 characters. 1 big and 1 small character and a number, these are the password-guidelines.

gjesch commented 1 year ago

I have the same issue since months (beginning of the year?).

System: Home Assistant 2022.12.8 Supervisor 2022.12.1 Operating System 9.4 Frontend 20221213.1 - latest

User password is 12 characters only, with or without SSL, check certificate etc. ... => It makes no difference.

Interesting enough: connection fails, but the integration delivers the values I need in the dashboard cards. How come?

grafik

mvanimpe commented 1 year ago

Same problem over here 'Can't connect' How do I know if I'm user or installer? I have an emailadress and login for the sunnyportal but cant find if I'm installer or user. I used the password 'to login tot the sunnyportal website' for the integration but looks like it doesnt work... Any tips? Scherm­afbeelding 2023-01-12 om 08 23 16

gjesch commented 1 year ago

used the password 'to login tot the sunnyportal website' for the integration but looks like it doesnt work...

The sunnyportal has access to your converter but HA has not access to sunnyportal, HA connects to the converter over the IP you type in.

I'm not totally sure anymore but I think it makes no difference if you use "user" or "installer". You should have gotten the credentials from the SMA installer (the technician doing the work in your house). Maybe only for "user", because for the "installer", they were reluctant to hand over the pwd.

But I was right to insist for 2 reasons: 1st, it is my hardware, I am the owner 2nd, the pwd they had chosen for the "installer" was embarrassingly stupid and simple.

If you happen to get hands on the "installer" pwd and login into the converter over a browser (same IP as above), be very careful and don't change any settings, you can mess up everything.

But important message at the end of this post: I have the correct pwd for both, but the HA SMA add-on fails to login.

DaveBurst commented 1 year ago

Hi, I tried the login with same error on SUNNY TRIPOWER 10.0 SE, after checking Webconnect, saw it was disabled. After enabling it, it's working now. Firmware-Version: 3.1.9.R

image

driedee commented 1 year ago

hello, I experienced the same problems from installation. Tried it again yesterday and it works. All possible updates were done. Just as a user with the user password, which the installer hopefully has noted in the manual. Perhaps this will encourage other users that it can work.

SMA STP6.0-3AV-40 428 Firmware Version: 3.11.3.R webconnect 1.5.2.R ON TCP and UDP OFF HA 2023.2.2 2023-02-08 12_27_17-werkende instelling jpg ‎- Foto's host name or IPadres is both working

pascal08 commented 1 year ago

@driedee Same here. I just entered the IP address as listed in the web interface. I checked "Uses an SSL certificate" (I left the "Verify SSL certificate" checkbox unchecked). I then selected "user" and entered the same password as needed to sign in at the web interface of SMA Solar.

Sl0thie commented 1 year ago

Was pulling my hair out, end up here and reduced my password length while making sure I had logged out of the SMA website and the website on the device, and it worked. Thank you all for providing a workaround. Hair is a precious commodity at my age.

cedricdelecole commented 1 year ago

Same issue in here, can not integrate SMA SunnyBoy SB 5.0, getting Connection error :

image

I have tried changing the user password on the device, logged out everywhere, all possible combinations, no luck. I can obviously access its web interface via 192.168.1.15, using either the user or installer login.

Here is my SMA inverter configuration :

image

image

... no luck ;-(

tobik176 commented 1 year ago

I was able to set up my Sunny Island Inverter to get battery data but I am not able to set up my additional Energy Meter that measures my PV power.

I can open the Web UI from my additional Energy Meter via IP but HA Integration doesn't let me add the Energy Meter...

cedricdelecole commented 1 year ago

what a mess - nobody seems to be able to connect decently ;-(

gjesch commented 1 year ago

Hi desperate guys from the last days.

Use a password not longer than 12 characters

Have you made sure to use a password not longer than 12 characters? The crazy things is that I had initially created a password of 20 characters! SMA accepted this in the login registration screen (html front-end) and truncated it by itself to 12 characters without making the user aware of it.

I use KeePass for managing all my passwords (creation and storage of passwords). Guess what happens: copy&paste 20 characters from KeePass into the SMA front-end login screen => successful login, because SMA uses again the first 12 characters only - and you keep believing, the 20-character password is fine.

Proof: I used the first 12 characters of the original password in the SMA Integration => successfully logged in! This worked for user and installer, with and without SSL etc.

Shame on SMA for this "silent" truncation of the password. Absolutely bad programming style.

tobik176 commented 1 year ago

I used now the HACS Addon to get the other relevant data from the Energy Meter. But it's really bad that you have to use several different methods to get all relevant data.

cedricdelecole commented 1 year ago

Hi desperate guys from the last days.

Use a password not longer than 12 characters

Have you made sure to use a password not longer than 12 characters? The crazy things is that I had initially created a password of 20 characters! SMA accepted this in the login registration screen (html front-end) and truncated it by itself to 12 characters without making the user aware of it.

I use KeePass for managing all my passwords (creation and storage of passwords). Guess what happens: copy&paste 20 characters from KeePass into the SMA front-end login screen => successful login, because SMA uses again the first 12 characters only - and you keep believing, the 20-character password is fine.

Proof: I used the first 12 characters of the original password in the SMA Integration => successfully logged in! This worked for user and installer, with and without SSL etc.

Shame on SMA for this "silent" truncation of the password. Absolutely bad programming style.

This is correct, I remember that issue with password length on SMA ... but my passwords are less than 12 characters, and I have tried different combinations numerical / special characters / up and lowercases etc ....

... no luck ;-(

garyr2w commented 1 year ago

Having same login issues. In my case I think it might be due to the ancient Sunny Webbox I have (circa 2012). I tried sending the contents of the POST from pysma shown in the log directly to the Webbox through curl. Using the "dyn/login.json" URL does not work. Using the URL that the Webbox web page connection uses (culture/login) does seem to work. Not sure if this helps anybody but thought I'd post it just in case. Example output is below (with the password changed to xxxxxxxxx).

From the log:

2023-06-13 16:57:04.185 DEBUG (MainThread) [pysma] Sending POST request to /dyn/login.json: {'data': '{"right": "istl", "pass": "xxxxxxxxx"}', 'headers': {'content-type': 'application/json'}}

Curl using dyn/login.json:

[core-ssh ~]$ curl -v -i -d '{"right": "istl", "pass": "xxxxxxxxx"}' http://192.168.1.254/dyn/login.json

Curl using culture/login:

[core-ssh ~]$ curl -v -i -d '{"right": "istl", "pass": "xxxxxxxxx"}' http://192.168.1.254/culture/login

<?xml version="1.0"?><?xml-stylesheet type='text/xsl' href='style_en.xslt'?><Page xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema deviceKey="109:155010870:p" languageCode="en" name="Login" xsi:noNamespaceSchemaLocation="PageDefinition.xsd" isDefUserPwd="false" isDefInstallerPwd="false" isUser="false"><Content deviceKey="109:155010870:p"><Element xsi:type="Login" deviceKey="109:155010870:p"><Language displayType="StateTags" obsolete="true" itemType="Value" name="Language of the user interface" address="6800837880" parameterJobStatus="OK" tagName="CntrySettings.Lang" timeStamp="11/10/2011 04:06:39 AM"><Items><XmlItem itemType="SubValue" name="Deutsch" tagName="LangDE"><Items /><Value>0</Value></XmlItem><XmlItem itemType="SubValue" name="English" tagName="LangEN"><Items /> etc. This seems to indicate a successful login. If I'm already logged in through a browser, it returns an error here saying already logged in.

garyr2w commented 1 year ago

FYI for anyone else with a WebBox. This integration seems to work: https://github.com/jpcornil-git/HA-sma

cedricdelecole commented 1 year ago

I had the exact same issue as described here ... here is how I solved it (not on purpose) .... I had installed Ha couple of weeks ago, connected to the SMA SB5.0 to test my user / installer, then tried to integrate it using the HA integration for SMA ... FAILED as a lot of people are experiencing below ...

My Synology crashed, so I had to reinstall the complete HA couple of days ago, and I directly tried to integrate the SMA SB 5.0 and it directly worked !!****, so without having tested the password on the SMA web interface first.

I ASSUME the issue is that if you connect to the SMA web interface first, the connection somehow stays active (even if you log off), which makes HA integration unable to log in the SMA inverter web interface at his turn. It looks to me like only 1 connection at the time is allowed ...

Anycase, it is working for me now ...

gb1320 commented 1 year ago

Another success story, also on the fresh HA install, worked like a charm on the first try: Hardware Type SB3.8-1SP-US-40 Firmware version 2.4.92.R

Webconnect Software version (See SMA GUI -> Device parameters -> External Communication -> Webconnect) there's none visible, only word 'Activated' The next part has couple versions: Main Processor: 2.3.41.R Communication Assembly: 2.4.91.R

URL used to connect to SMA GUI in browser: https://sma1990024609/ Inverter is connected over Ethernet to LAN. LAN DHCP server assigned it that host name. The same host name sma1990024609 worked in HA integration.

Home Assistant Details: HA Core only + MariaDB + Mosquitto MQTT running on Ubuntu 18.04.5 LTS Version currently used: 2023.6.3 (just installed few days ago) This is the only integration I added there so far. Browser to open inverter UI or HA UI is Microsoft Edge Version 114.0.1823.58 (Official build) (64-bit) running on a separate computer, Windows 10 VM, wired Ethernet everywhere.

SMA609

monester commented 11 months ago

I have this https://www.sma.de/en/products/monitoring-control/webconnect module installed in my inverter Sunny Boy 5000TL-21 but this module don't expose any local ports. It is possible to register this module on portal via https://www.sunnyportal.com/register with PIC and RID values which are coming with the module. You can monitor on performance via https://www.sunnyportal.com . Sma module for home assistant working only with local access so if module don't expose local interface there is no way to connect. In https://github.com/home-assistant/core/issues/67953#issuecomment-1619332087 there is mentioned that you should enable local access somehow but I wasn't been able to find "External Communication -> Webconnect" anywhere.

Webconnect Software version (See SMA GUI -> Device parameters -> External Communication -> Webconnect) there's none visible, only word 'Activated'

JunoGregoire commented 10 months ago

I'm having this issue too, with the newest version of HA. My password is 12 chars long. I've logged in directly into my SMA inverter and that works. I used to have an RPi on which this worked perfectly, though that was about a year ago. I'm running HA on a Proxmox VM now. Could that be the issue?

gb1320 commented 10 months ago

module installed in my inverter Sunny Boy 5000TL-21 but this module don't expose any local ports.

If you can see inverter's UI and its production numbers over LAN in the browser then it exposes at least ports 80 / 443. I believe HA integration uses the very same connection. My inverter is newer model so there's possibility that SMA changed Web API methods for this series and HA cannot 'understand' the previous version. I think post https://github.com/home-assistant/core/issues/67953#issuecomment-1590263811 above provides a method how to check login / connectivity outside HA.

JunoGregoire commented 10 months ago

I'm having this issue too, with the newest version of HA. My password is 12 chars long. I've logged in directly into my SMA inverter and that works. I used to have an RPi on which this worked perfectly, though that was about a year ago. I'm running HA on a Proxmox VM now. Could that be the issue?

An update: I just tried pinging my SMA inverter, which works perfectly. So HA can definitely talk to the inverter.

EIDT: just tried again with the first checkbox enables and the 2nd disabled. Logged in in a second.

gravidigit commented 10 months ago

Hi all, same problem here. No login is proberly. I have tried all combies. user or installer, with and withoud ssl checkboxes. Login on the webinterface with my user account is no problem. have a user here any idea? thanks a lot!

HomeAssistant: Home Assistant 2023.8.4 Supervisor 2023.08.1 Operating System 10.5 SMA: SMA X12 Wechelrichter / Sunny Tripower X 12 Firmware-Version 03.02.08.R

Home Assistant Log: Logger: pysma Source: components/sma/config_flow.py:33 First occurred: 29. August 2023 um 19:58:27 (12 occurrences) Last logged: 15:39:21

Request to /dyn/login.json did not return a valid json. Could not start session: Session ID expected [result.sid]

Carsten90 commented 10 months ago

login problem solved!!!

at first you have to use the sunny explorer and set in the inverter and battery inverter the external communication web connect to on. Now you dont use the IP in the sunny explorer, go to your fritzbox or router and search for the actual network ip. Use the IP adress set the first hook with the ssl and uncheck the second hook!!! thats priority! now click on installer and use the sunny explorer password..

works like a charme!

also you have to do it for both inverters if you habe two like me

TheChatty commented 9 months ago

I also had this problem (SUNNY TRIPOWER 6.0 SE on firmware 3.4.16.R).

Important like told 1000x: [x] Uses an SSL certificate, [ ] Verify SSL certificate.

What's strange: example.py https://sma301560xxxxx.local/ user mysecretpw is working (from here).

juite commented 9 months ago

Hi everybody,

Used the intergration always without problems. Since 2 weeks entities not available anymore. Tried to reinstall the integration but now login issues. Tried al kind of combinations nothing works anymore.

HA version 10.5 SMA STP6.0-3AV-40 Firmware version: 4.0.8.R

Any ideas?

rozsap commented 8 months ago

I also have the problem that I cannot log in to Sonny Home Manager 2.0 on the WebUI interface. Thus, the Home Assistant cannot set the SMA integration either. I added the device on Sunny Portal, it works great. I know the IP address, you can ping it, and the legal_notices.txt page comes up. Port scanner says ports 80 and 4712 are open. I can't access the device on either of them. What might be the problem?

nelsongraca commented 8 months ago

Having this error as well, it was working a few days ago DEBUG (MainThread) [pysma] Sending POST request to /dyn/login.json: {'data': '{"right": "istl", "pass": "SECRET"}', 'headers': {'content-type': 'application/json'}}

heereb commented 7 months ago

hi, this is how I fixed the error:

Sakamoto2215 commented 6 months ago

I have the same problem, not being able to connect to the sma integration. No matter what I try, I get invalid authentication. I tried user and installer. I even created a new installer profile and changed the PW, didnt work either.

What bothers me is when I log into my inverter using the browser / IP I have to log in with a username and PW

The HA integration never asks for an username? Is that the problem? I think my inverter runs in the new ennexOS.

Can someone with a working HA connection confirm their login to the inverter looks the same?

grafik

Cheers Sakamoto

gb1320 commented 6 months ago

That login page doesn't look like inverter's login. Please make sure you're logging into inverter itself, not SunnyPortal site. My inverter page looks like this:

From: Sakamoto2215 @.> Sent: Tuesday, December 26, 2023 1:19 PM To: home-assistant/core @.> Cc: gb1320 @.>; Comment @.> Subject: Re: [home-assistant/core] No Connection with SMA Integration / SMA Integration Login failed (Issue #67953)

I have the same problem, not being able to connect to the sma integration. No matter what I try, I get invalid authentication. I tried user and installer. I even created a new installer profile and changed the PW, didnt work either.

What bothers me is when I log into my inverter using the browser / IP I have to log in with a username and PW

The HA integration never asks for an username? Is that the problem? I think my inverter runs in the new ennexOS.

Can someone with a working HA connection confirm their login to the inverter looks the same?

grafik.png (view on web) https://github.com/home-assistant/core/assets/154930231/61bab3d9-29f0-426f- 8232-ad744774c5fd

Cheers Sakamoto

- Reply to this email directly, view it on GitHub <https://github.com/home-assistant/core/issues/67953#issuecomment-1869776879

, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMWH7HEOORY4O7HDB42OX4DYL M5LDAVCNFSM5QMX7ZEKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBWHE3TONRYG44Q . You are receiving this because you commented. https://github.com/notifications/beacon/AMWH7HFL5UJDQAOU6L76MOLYLM5LDA5CNFS M5QMX7ZEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGON5ZIP3Y .gif Message ID: @. @.> >

rklomp commented 6 months ago

Maybe a new tripower X device? https://github.com/home-assistant/core/issues/90313

Sakamoto2215 commented 6 months ago

Thanks,

I just found out that the new SMA TRIPOWER X Inverter run on a completely new system. HA Integrations does not work on TRIPOWER X.

Batum78 commented 6 months ago

It's working with a Sunny Boy 5.0. Had to check "use an ssl certificate"

TQRT commented 6 months ago

I was having the same issue trying to connect a SMA Energy Meter, tinkering with Home Assistant (first time user) I ended up in

/homeassistant/home-assistant.log

there I saw the next message:

2024-01-10 17:45:26.341 ERROR (MainThread) [pysma] Could not start session: Session ID expected [result.sid] 2024-01-10 17:45:34.838 WARNING (MainThread) [pysma] Password should not exceed 12 characters

As I'm using a password manager I had set up a 20 characters password, after changing to a 12 characters password it is now conected and working perfect. I hope this can help other people too.

issue-triage-workflows[bot] commented 3 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

littleyoda commented 3 months ago

Thanks,

I just found out that the new SMA TRIPOWER X Inverter run on a completely new system. HA Integrations does not work on TRIPOWER X.

You can test my integration: https://community.home-assistant.io/t/support-for-more-sma-devices-e-g-tripower-x/713737

frederikvoGIT commented 2 months ago
SMA Device details:
    -Sunny Boy Smart Energy 5.0
    -Firmware version: 03.08.03.R
    -Webconnect functionality switched on Software version not found
    -URL used to connect to SMA GUI in browser: https://192.168.129.12/webui/Plant:1/dashboard
Home Assistant Details:
    -Versions:
         Core 2024.5.4
         Supervisor 2024.05.1
         Operating System 12.3
         Frontend 20240501.1
   -Debug logging not available because can't succeed connecting

afbeelding afbeelding afbeelding

And next to my own login for the webinterface, i have this page delivered with the invertor with serial numbers and codes: BwuLxHOv

Sonnenwerk commented 1 month ago

Hi, i have a "similar" problem: My Tripower 8 refuses to connect. Username, role and password work with the local login into the converter.

image image

Any idea what i should do ?