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
69.82k stars 28.95k 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

probot-home-assistant[bot] commented 2 years ago

sma documentation sma source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @kellerza, @rklomp, mind taking a look at this issue as it has been labeled with an integration (sma) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

rklomp commented 2 years ago

The SMA integration does not support modbus, only web interface.

Jogiarea commented 2 years ago

Sorry yes I know meant to say that I used the modbus to test the connection, i.e. a connection is there. Do I what beachtren must be activated for the web interface something?

rklomp commented 2 years ago

I've never tested of heard of anyone using the sunny island with this plugin. Maybe this device is running different code for webconnect.

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

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.

labros-zotos commented 2 years ago

Did you find a solution? I am trying to add the integration but I get "Failed to connect".

The only thing I get on the log is 2022-03-13 23:39:03 DEBUG (MainThread) [pysma] Sending POST request to /dyn/login.json: {'data': '{"right": "usr", "pass": "secret"}', 'headers': {'content-type': 'application/json'}}

Jogiarea commented 2 years ago

Hi all, Sorry for late answer, had any to do This Weekend 1

Here are my log Error handling request:

Logger: aiohttp.server
Source: core.py:1043
First occurred: 05:48:09 (2 occurrences)
Last logged: 05:48:18

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/api/__init__.py", line 223, in post
    hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1363, in async_set
    state = State(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1043, in __init__
    raise InvalidEntityFormatError(
homeassistant.exceptions.InvalidEntityFormatError: Invalid entity id encountered: sma. Format should be <domain>.<object_id>

And Unexpected exception:

Logger: homeassistant.components.sma.config_flow
Source: components/sma/config_flow.py:33
Integration: SMA Solar (documentation, issues)
First occurred: 05:52:01 (3 occurrences)
Last logged: 05:53:03

Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sma/config_flow.py", line 68, in async_step_user
    device_info = await validate_input(self.hass, user_input)
  File "/usr/src/homeassistant/homeassistant/components/sma/config_flow.py", line 33, in validate_input
    await sma.new_session()
  File "/usr/local/lib/python3.9/site-packages/pysma/__init__.py", line 247, in new_session
    body = await self._post_json(URL_LOGIN, self._new_session_data)
  File "/usr/local/lib/python3.9/site-packages/pysma/__init__.py", line 177, in _post_json
    return await self._request_json(hdrs.METH_POST, url, **params)
  File "/usr/local/lib/python3.9/site-packages/pysma/__init__.py", line 118, in _request_json
    async with self._aio_session.request(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 634, in _request
    break
  File "/usr/local/lib/python3.9/site-packages/aiohttp/helpers.py", line 721, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

I dont know what this say to me

Jogiarea commented 2 years ago

One More Information 2 :

CyborgNL commented 2 years ago

Same for me. I have tried all combination. Still got the message: Unexpected Error. With an other app (SunSpec) it works but I prefer to use the SMA app.

skyluker commented 2 years ago

Same for me. I have tried all combination. Still got the message: Unexpected Error. With an other app (SunSpec) it works but I prefer to use the SMA app.

it is undergoing fix: https://github.com/kellerza/pysma/pull/98

kellerza commented 2 years ago

The fix addresses the TimeoutError - https://github.com/home-assistant/core/issues/68999

My suspicion is that TimeoutError typically occur when you are connected via wifi.

But if your inverter has no support for the webconnect protocol it will still timeout, but the HA setup will just gracefully retry forever.

As @rklomp mentioned no-one has reported a working sunny island, so very likely it is NOT webconnect based. The first test is always, what can you access/see when you point your own browser to the inverter…

ghost commented 2 years ago

@Jogiarea, are you redirected to the https version when you access it in the browser? Then check the first checkbox (uses an SSL certificate), but not the second one (verify SSL certificate), like this:

image

CyborgNL commented 2 years ago

I have updated Home Assistant to: 2022-4.0 Then I try to add SMA I get the the message that no connection can be made.

Schermafbeelding 2022-04-07 om 15 43 24
rklomp commented 2 years ago

I have updated Home Assistant to: 2022-4.0 Then I try to add SMA I get the the message that no connection can be made.

What kind of device are you trying to connect to?

CyborgNL commented 2 years ago

I try to connect to my SMA Sunny boy 4000TL. I know the passwords for user and installer.

kellerza commented 2 years ago

Do you have an external webconnect on the 4000TL?

From the datasheet the 4000TL only supports RS485 and bluetooth

Can you please post a screenshot of Chrome when you open the page at http:// or https://?

skyluker commented 2 years ago

I have a SMA Sunny Tripower 6.0 | SMA STP6.0-3AV-40] and it doesn't work one the newest 2022.04 core. Although there was a time (January '22 I think) it worked.

CyborgNL commented 2 years ago

Do you have an external webconnect on the 4000TL?

From the datasheet the 4000TL only supports RS485 and bluetooth

Can you please post a screenshot of Chrome when you open the page at http:// or https://?

@kellerza The web connect module is installed on the 4000TL-21 I can retrieve data when using SunSpec in HomeAssistant. Is does not work when using the SMA app.

asimar75 commented 2 years ago

Same issue for my Sunnyboy 3.0, in the integration description say is for SMA(US), I’m in Europe, wondering if it is a geographic issue.

jimverte commented 2 years ago

As my old Home Assistant instence is crashed i'm building a new Home Assistant. Currently i'm facing the same issue as not able to connect to the webconnect.

does anybody still have the older way by adding the code in the configuration.yaml file ourself

than we could try that way to get connected to the sma webconnect. I have a sunnyboy 3.0 @ home

rklomp commented 2 years ago

I am using a sunnyboy 3.6, so I assume a sb 3.0 should also work.

Are you using correct settings to connect?

jimverte commented 2 years ago

Succes now bu using the following settings

USE SSL Certification

Unselect Validate SSL Certification

Use the Installer account and his password

CyborgNL commented 2 years ago

Does anybody know if this will work with my Sunnyboy 4000TL-21? I make use of the Webconnect. Always the same error: Cannot connect. I have the username and password for user and installer.

What is the minimum requierment to the the SMA app in HA? It works with SunPac but not with the SMA app in HA.

SMA

.

Jogiarea commented 2 years ago

Ive tested all but nothing works;-(

xzaz commented 2 years ago

I'm having the same problem with Sunny boy 1.5. It can't just connect. I had it working with old versions of HA though.

rklomp commented 2 years ago

For all people having issues connecting. Please share more details about your installation:

To get debug logging, turn on debug in the configuration.yaml and than restart HA.

logger:
  default: info
  logs:
    homeassistant.components.sma: debug
    pysma: debug
skyluker commented 2 years ago

For all people having issues connecting. Please share more details about your installation:

  • SMA Device details:

    • Hardware Type
    • Firmware version
    • Webconnect Software version (See SMA GUI -> Device parameters -> External Communication -> Webconnect)
    • URL used to connect to SMA GUI in browser
  • Home Assistant Details:

    • Version currently used
    • If working with old version, the last version it was still working
    • Screenshot of your settings used in HA.
    • Debug logging of HA when trying to connect.

To get debug logging, turn on debug in the configuration.yaml and than restart HA.

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

SUNNY TRIPOWER 6.0 - STP6.0-3AV-40 370 firmware: 3.11.3.R Webconnect ver: 1.5.2.R https://192.168.0.108/

Home Assistant 2022.4.7

LOG from Core: 2022-05-17 14:42:38 DEBUG (MainThread) [pysma] Sending POST request to /dyn/login.json: {'data': '{"right": "usr", "pass": "***"}', 'headers': {'content-type': 'application/json'}}

When I try to add integration: error

where should I take the screenshot with HA setting?

xzaz commented 2 years ago

Do we need more information? I got the same as above with the same message: 2022-06-20 19:44:55 DEBUG (MainThread) [pysma] Sending POST request to /dyn/login.json: {'data': '{"right": "usr", "pass": "pass"}', 'headers': {'content-type': 'application/json'}}

Edit: I'v checked it in Postman and it goes correct:

First: http://192.168.178.14/dyn/login.json with content JSON {"pass" : "pass", "right" : "usr"} Second: http://192.168.178.14/dyn/getValues.json?sid=nBak2UwgQaogwUgh with content {"destDev":[],"keys":["6400_00260100","6400_00262200","6100_40263F00"]} here 6100_40263F00 is current Watt output.

So it does not continue connecting: _LOGGER.debug("Sending %s request to %s: %s", method, url, kwargs) https://github.com/kellerza/pysma/blob/e38cf758912fabc2ad4f75ab5df827b3c06a5fab/pysma/__init__.py#L114

Fixed I fixed it with some help from Tweakers.net. I messed up with the port. It's just port 80, so http. Put my forwarding the correct way and tada; connection.

rklomp commented 2 years ago

Did not have any time to look into this. As I understand you only got the "Sending POST request to /dyn/login.json" entry and after that no further logging?

If I test this myself by connecting to HTTP instead of HTTPS I get a reply: DEBUG:pysma:Received reply {'err': 404}

Stefan-Verwey commented 2 years ago

@kellerza Hi Johann I have managed to connect to my Sunny Island and Sunny Boy from within Home Assistant. All my devices are connected directly via Ethernet cable. I am in Pretoria, if it can help you to pop-in and have a look.

Regards Stefan

Jogiarea commented 1 year ago

Sorry for my very late reply, I have not been able to do so lately, the problem unfortunately still exists.

I also brought everything up to date, what I noticed is that in SunnyExplorer webconnect every time I set the setting to yes, the next time I restart it is back to no.

here still my data

1

3 2

Do someone have an idea

prom00 commented 1 year ago

I have the same issue:

I've tried a telnet to see if the port 502 is open on my device: image

image

I have a STP 7000TL-20 203 inverter. All the data is presented in sunny portal, but can't connect to it through HA

image

Sunny portal: image

I really have no clue as to why this isn't working?

Also when directly going to the (fixed) ip in the browser: (http://192.168.1.151) image

girafhacker commented 1 year ago

Hi what you can try is disabling speedwire incryption Greets.

prom00 commented 1 year ago

You mean the use ssl certificate in the plug-in? I tried those settings already.

Or is it a setting which needs to be changed at the inverter?

rklomp commented 1 year ago

As mentioned before, the integration does not support speedwire. Only fetching data using the webinterface.

prom00 commented 1 year ago

It's kinda unclear what exactly is what. It seems like there's 3 options:

You have an inverter without any ethernet connection -> You can't monitor it online You have an inverter with ethernet connection over speedwire -> You can monitor online with Sunny Portal only? You have an inverter with ethernet connection with GUI -> You can use this HA integration?

rklomp commented 1 year ago

Correct. It needs a local webinterface that you can connect to by either http:// or https://

xzaz commented 1 year ago

@prom00 You can check out: https://github.com/Harrum/SMAlogger this works on speedwire.

prom00 commented 1 year ago

@prom00 You can check out: https://github.com/Harrum/SMAlogger this works on speedwire.

Thanks for your reply. This however is no valid add on for HA. image

Rean-nl commented 1 year ago

I've got it running with the settings below.

afbeelding

Not as a user, but as the installer This has almost driven me mad, but loggin out of the Sunny Boy portal seems to make a difference

xargon1004 commented 1 year ago

I've got it running with the settings below.

afbeelding

Not as a user, but as the installer This has almost driven me mad, but loggin out of the Sunny Boy portal seems to make a difference

Exactly! Logging out of the sunny boy portal made it work for me as well!

prom00 commented 1 year ago

Where exactly did you logout of the sunny boy portal?

xargon1004 commented 1 year ago

On the sunny boy web portal. (Sunnyportal.com)

kellerza commented 1 year ago

The local WebConnect interface only support a single login per user at a time on the local web interface (typically http://192.168.1.xx or https://192.168.1.xx).

So logging out of any local sessions usually helps since psma (the library behind the HA integration) needs to log in as either user/installer.

Your comment seem to indicate that while you are logged into sunnyportal.com it enforces another restriction. I've not seen this before, but might explain why people are struggling!

skyluker commented 1 year ago

I created another instance of HA on a different machina. As from there the sma integration worked. So I went back to my main HA server and I clicked on Terminal. I tried to ping my SMA without success. So I turned off add-on like adblokers, reverse my hairpin on the router so that I could login with my internal IP address. And the ping came alive. After that the integration stared to work. It seems like something was blocking the basic connection between HA and SMA. Check pings!

Nagi2626 commented 1 year ago

image

Do I need to delete myself here? Do not want to lose the data on Sunny portal. Ping works in HA, but do not get access.

Jogiarea commented 1 year ago

Could not solve the problem, unfortunately still does not go, have browsed some more and I have now implemented my solution with Modbus and found the missing registers of my SunnyIsland In Configuration

#SMA Wechselrichter
modbus:
  - name: "hub1"
    type: tcp
    host: 192.XXX.X.XXX
    port: 502
    close_comm_on_error: true
    delay: 5
    timeout: 5
    sensors:
      - name: SMApwrL1
        unit_of_measurement: kW
        slave: 3
        address: 30777
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMApwrL2
        unit_of_measurement: kW
        slave: 3
        address: 30779
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMApwrL3
        unit_of_measurement: kW
        slave: 3
        address: 30781
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMAcurL1
        unit_of_measurement: A
        slave: 3
        address: 30977
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMAcurL2
        unit_of_measurement: A
        slave: 3
        address: 30979
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMAcurL3
        unit_of_measurement: A
        slave: 3
        address: 30981
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMAvoltL1
        unit_of_measurement: V
        slave: 3
        address: 30783
        count: 2
        data_type: uint32
        scale: 0.01
        precision: 1
        scan_interval: 15
      - name: SMAvoltL2
        unit_of_measurement: V
        slave: 3
        address: 30785
        count: 2
        data_type: uint32
        scale: 0.01
        precision: 1
        scan_interval: 15
      - name: SMAvoltL3
        unit_of_measurement: V
        slave: 3
        address: 30787
        count: 2
        data_type: uint32
        scale: 0.01
        precision: 1
        scan_interval: 15
      - name: SMAnetHZ
        unit_of_measurement: Hz
        slave: 3
        address: 30803
        count: 2
        data_type: uint32
        scale: 0.01
        precision: 2
        scan_interval: 15
      - name: SMApwr
        unit_of_measurement: kW
        slave: 3
        address: 30775
        count: 2
        data_type: int32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMAtotal
        unit_of_measurement: MW
        slave: 3
        address: 30529
        count: 2
        data_type: uint32
        scale: 0.000001
        precision: 2
        scan_interval: 15
      - name: SMAtoday
        unit_of_measurement: kWh
        slave: 3
        address: 30535
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
      - name: SMAdevtype
        slave: 3
        address: 30053
        count: 2
        data_type: int32
        scan_interval: 15
      - name: SMAgridrelay
        slave: 3
        address: 30217
        count: 2
        data_type: int32
        scan_interval: 15
      - name: SMAderating
        slave: 3
        address: 30219
        count: 2
        data_type: int32
        scan_interval: 15
      - name: SMAcondition
        slave: 3
        address: 30201
        count: 2
        data_type: int32
        scan_interval: 15
      - name: sma_tempurature
        data_type: int32
        device_class: 'temperature'
        unit_of_measurement: °C
        slave: 3
        address: 30953
        count: 2
        scale: 0.1

#--------------------------

#SMA Batterie Wechselrichter

  - name: "hub2"
    type: tcp
    host: 192.XXX.X.XXX
    port: 502
    close_comm_on_error: true
    delay: 5
    timeout: 5
    sensors:
    #Wirkleistung Außenleiter L1, in W
      - name: SMApwrL1SI
        unit_of_measurement: kW
        slave: 3
        address: 30777
        count: 2
        data_type: int32
        scale: 0.001
        precision: 2
        scan_interval: 15
    #Netzstrom Außenleiter L1, in A 
      - name: SMAcurL1SI
        unit_of_measurement: A
        slave: 3
        address: 30977
        count: 2
        data_type: uint32
        scale: 0.001
        precision: 2
        scan_interval: 15
    #Netzspannung Außenleiter L1 gegen N, in V
      - name: SMAvoltL1SI
        unit_of_measurement: V
        slave: 3
        address: 30783
        count: 2
        data_type: uint32
        scale: 0.01
        precision: 1
        scan_interval: 15
    #Netzfrequenz, in Hz    
      - name: SMAnetHZSI
        unit_of_measurement: Hz
        slave: 3
        address: 30803
        count: 2
        data_type: uint32
        scale: 0.01
        precision: 2
        scan_interval: 15
    #Wirkleistung über alle Außenleiter, in W   
      - name: SMApwrSI
        unit_of_measurement: kW
        slave: 3
        address: 30775
        count: 2
        data_type: int32
        scale: 0.001
        precision: 2
        scan_interval: 15
    #Numerische Kennung des SMA Gerätetyps --> uint32
      - name: SMAdevtypeSI
        slave: 3
        address: 30053
        count: 2
        data_type: int32
        scan_interval: 60
    #Status des Geräts:35 = Fehler 303 = Aus 307 = OK 455 = Warnung
    #uint32
      - name: SMAconditionSI
        slave: 3
        address: 30201
        count: 2
        data_type: int32
        scan_interval: 15
    #Aktueller Batterieladezustand, in %
    #-->uint32
      - name: SMABat.ChaSttSI
        slave: 3
        address: 30845
        input_type: holding
        count: 2
        data_type: int32
        scan_interval: 15
    #Aktuelle Batteriekapazität, in % 
      - name: smaBatkapaSI
        slave: 3
        address: 30847
        count: 2
        data_type: uint32
        precision: 2
        scale: 0.1
        scan_interval: 15
    #Batterietemperatur, in °C
      - name: sma_BattempSI
        slave: 3
        address: 30849
        count: 2
        data_type: int32
        unit_of_measurement: °C
        precision: 1
        scale: 0.1
        scan_interval: 15
    #Batteriespannung, in V
      - name: sma_BatspannSI
        slave: 3
        address: 30851
        count: 2
        data_type: uint32
        unit_of_measurement: V
        scale: 0.1
        scan_interval: 15
    #Anzahl Ladungsdurchsätze der Batterie
      - name: SMAloadcountSI
        slave: 3
        address: 30857
        count: 2
        data_type: int32
        scan_interval: 60
    #Aktuelle Batterieladesollspannung, in V 
      - name: sma_BatlodsollspannSI
        data_type: uint32
        unit_of_measurement: V
        slave: 3
        address: 30855
        count: 2
        scale: 0.1
        scan_interval: 15

In Sensors

#  sensor:

  - platform: template
    sensors:

      sma_power_l1:
        value_template: "{% if states('sensor.smapwrl1')|float > 10000 %}0{% else %}{{ states('sensor.smapwrl1') | float | round(2)}}{% endif %}"
        friendly_name: "SMA power L1"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
      sma_power_l2:
        value_template: "{% if states('sensor.smapwrl2')|float > 10000 %}0{% else %}{{ states('sensor.smapwrl2') | float | round(2)}}{% endif %}"
        friendly_name: "SMA power L2"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
      sma_power_l3:
        value_template: "{% if states('sensor.smapwrl3')|float > 10000 %}0{% else %}{{ states('sensor.smapwrl3') | float | round(2)}}{% endif %}"
        friendly_name: "SMA power L3"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
      sma_stroom_l1:
        value_template: "{% if states('sensor.smacurl1')|float > 100 %}0{% else %}{{ states('sensor.smacurl1') | float | round(2)}}{% endif %}"
        friendly_name: "SMA stroom L1"
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
      sma_stroom_l2:
        value_template: "{% if states('sensor.smacurl2')|float > 100 %}0{% else %}{{ states('sensor.smacurl2') | float | round(2)}}{% endif %}"
        friendly_name: "SMA stroom L2"
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
      sma_stroom_l3:
        value_template: "{% if states('sensor.smacurl3')|float > 100 %}0{% else %}{{ states('sensor.smacurl3') | float | round(2)}}{% endif %}"
        friendly_name: "SMA stroom L3"
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
      sma_spanning_l1:
        value_template: "{% if states('sensor.smavoltl1')|float > 1000 %}0{% else %}{{ states('sensor.smavoltl1') | float | round(2)}}{% endif %}"
        friendly_name: "SMA spanning L1"
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
      sma_spanning_l2:
        value_template: "{% if states('sensor.smavoltl2')|float > 1000 %}0{% else %}{{ states('sensor.smavoltl2') | float | round(2)}}{% endif %}"
        friendly_name: "SMA spanning L2"
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
      sma_spanning_l3:
        value_template: "{% if states('sensor.smavoltl3')|float > 1000 %}0{% else %}{{ states('sensor.smavoltl3') | float | round(2)}}{% endif %}"
        friendly_name: "SMA spanning L3"
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
      sma_netfrequentie:
        value_template: "{% if states('sensor.smanethz')|float > 1000 %}0{% else %}{{ states('sensor.smanethz') | float | round(2)}}{% endif %}"
        friendly_name: "SMA Netfrequentie"
        unit_of_measurement: 'Hz'
        icon_template: mdi:solar-power
      sma_power:
        value_template: "{% if states('sensor.smapwr')|float < 0 %}0{% else %}{{ states('sensor.smapwr') | float | round(2)}}{% endif %}"
        friendly_name: "SMA Power"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
      sma_total:
        value_template: "{% if states('sensor.smatotal')|float < 0 %}0{% else %}{{ states('sensor.smatotal') | float | round(2)}}{% endif %}"
        friendly_name: "SMA Total"
        unit_of_measurement: 'MWh'
        icon_template: mdi:solar-power
      sma_today:
        value_template: "{% if states('sensor.smatoday')|float > 1000 %}0{% else %}{{ states('sensor.smatoday') | float | round(2)}}{% endif %}"
        friendly_name: "SMA Today"
        unit_of_measurement: 'kWh'
        icon_template: mdi:solar-power
      sma_device_type:
        value_template: "{% if states('sensor.smadevtype')|float == 9281 %}Tripower 10000TL-20{% else %}?{% endif %}"
        friendly_name: "SMA device type"
        icon_template: mdi:solar-power
      sma_grid_relay:
        value_template: "{% if states('sensor.smagridrelay')|float == 51 %}closed{% elif states('sensor.smagridrelay')|float == 311 %}open{% else %}?{% endif %}"
        friendly_name: "SMA grid relay"
        icon_template: mdi:solar-power
        device_class: energy
      sma_condition:
        value_template: "{% if states('sensor.smacondition')|float == 35 %}Fehler{% elif states('sensor.smacondition')|float == 303 %}Aus{% elif states('sensor.smacondition')|float == 307 %}OK{% elif states('sensor.smacondition')|float == 455 %}Warnung{% else %}?{% endif %}" 
        friendly_name: "SMA Zustand"
        icon_template: mdi:state-machine
        device_class: energy

#---------------------
      sma_power_l1si:
        value_template: "{% if states('sensor.smapwrl1si')|float > 10000 %}0{% else %}{{ states('sensor.smapwrl1si') | float | round(2)}}{% endif %}"
        friendly_name: "SMA power L1 SI"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
      sma_stroom_l1si:
        value_template: "{% if states('sensor.smacurl1si')|float > 100 %}0{% else %}{{ states('sensor.smacurl1si') | float | round(2)}}{% endif %}"
        friendly_name: "SMA stroom L1 SI"
        unit_of_measurement: 'A'
        icon_template: mdi:solar-power
      sma_spanning_l1si:
        value_template: "{% if states('sensor.smavoltl1si')|float > 1000 %}0{% else %}{{ states('sensor.smavoltl1si') | float | round(2)}}{% endif %}"
        friendly_name: "SMA spanning L1 SI"
        unit_of_measurement: 'V'
        icon_template: mdi:solar-power
      sma_netfrequentiesi:
        value_template: "{% if states('sensor.smanethzsi')|float > 1000 %}0{% else %}{{ states('sensor.smanethzsi') | float | round(2)}}{% endif %}"
        friendly_name: "SMA Netfrequentie SI"
        unit_of_measurement: 'Hz'
        icon_template: mdi:solar-power
      sma_powersi:
        value_template: "{% if states('sensor.smapwrsi')|float < -2500 %}0{% else %}{{ states('sensor.smapwrsi') | float | round(2)}}{% endif %}"
        friendly_name: "SMA Power SI"
        unit_of_measurement: 'kW'
        icon_template: mdi:solar-power
      sma_device_typesi:
        value_template: "{% if states('sensor.smadevtypesi')|float == 9278 %}Island 3.0M{% else %}?{% endif %}"
        friendly_name: "SMA device type SI"
        icon_template: mdi:solar-power
      sma_conditionsi:
        value_template: "{% if states('sensor.smaconditionsi')|float == 35 %}Fehler{% elif states('sensor.smaconditionsi')|float == 303 %}Aus{% elif states('sensor.smaconditionsi')|float == 307 %}OK{% elif states('sensor.smaconditionsi')|float == 455 %}Warnung{% else %}?{% endif %}" 
        friendly_name: "SMA BatterieWR Zustand SI"
        icon_template: mdi:state-machine
        device_class: energy

For those with the same problem can solve it this way and you have the real live data without cloud connection

henne49 commented 1 year ago

Since yesterday, I'm unable to connect to my SMA using the integration.

It worked the day before.

Firmware-Version: 3.10.15.R IP-Adresse Ethernet: X.X.X.X

And there is not much in the logs other than this, even if I have added the debug as suggested as above:

2022-11-02 14:39:47.432 DEBUG (MainThread) [pysma] Sending POST request to /dyn/login.json: {'data': '{"right": "usr", "pass": "****"}', 'headers': {'content-type': 'application/json'}} 2022-11-02 14:39:47.790 WARNING (MainThread) [homeassistant.config_entries] Config entry 'X.X.X.X' for sma integration not ready yet: Could not connect to SMA at https://X.X.X.X: Cannot connect to host X.X.X.X:443 ssl:default [Connection reset by peer]; Retrying in background

Modbus works very fine. What can I do? Als the Web Interface always shows webconnect disabled after 30 minutes. I also tried wifi, no luck it was working before with LAN Connectivity.

My Sunnyportal, and Victron can still read data, as they could before. Even looging out of SMA and Sunnyportal did not do any change.

Appreaciate any support here

rklomp commented 1 year ago

What version of HA are you running?

henne49 commented 1 year ago

Home Assistant 2022.10.5 Supervisor 2022.10.0 Frontend 20221010.0 - latest