Skip to content

Sunny Island returns {"err":404} on /dyn/login.json (HTTP), causes authentication failure in pysma / HA integration #129

@Saargebeat

Description

@Saargebeat

With the help of ChatGPT:

Summary

After a recent update, my SMA Sunny Island (local WebConnect, HTTP only) triggers a re-authentication in Home Assistant. Entering the correct credentials results in failed to connect (while an intentionally wrong password correctly yields Invalid authentication).
Local checks show the inverter is reachable over HTTP/1.0 on port 80 and does not redirect to HTTPS. The inverter’s /dyn/login.json endpoint returns HTTP/1.0 200 OK with body {"err":404}. Current pysma interprets this as an error and raises SmaAuthenticationException in new_session, which breaks the login/session establishment path.

This appears to be a regression in how pysma handles HTTP login flows / legacy Sunny Island behavior.


Environment

  • Platform: Home Assistant OS on Home Assistant Yellow
  • Integration: homeassistant.components.sma (uses pysma)
  • Python inside HA Core container: Python 3.13
    (Path observed: /usr/local/lib/python3.13/site-packages/pysma)
  • Device: SMA Sunny Island (exact model/firmware unknown; local WebConnect)
  • Network: Local LAN, inverter reachable via HTTP on port 80, no HTTPS and no redirect to HTTPS
  • Note: Initially no useful HA logs appeared until debug logging for pysma was enabled.

I can add the exact HA Core version and device firmware on request; the key is the HTTP login behavior returning {"err":404}.


What I did / Diagnostics

From the HA host (Terminal & SSH add-on):

# Port open?
nc -vz 192.168.1.203 80
# -> succeeded

# Login endpoint over HTTP:
curl -v http://192.168.1.203/dyn/login.json
# -> HTTP/1.0 200 OK
#    Content-Type: application/json
#    Body: {"err":404}

# No redirect to HTTPS:
curl -I http://192.168.1.203/
# -> HTTP/1.0 200 OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions