Commit Graph
2 Commits
Author SHA1 Message Date
tajniak81andClaude Opus 5.5 9d8636ee73 Anker Solix: a 403 that is not about the token spends no login
anker-solix-api v3.9.1 (2026-10-25) and ha-anker-solix 3.9.1.1 (2026-10-30).
The release is mostly PPS, F3000 and A91B2 work, and none of it reaches an
A5191. The emergency fix does. On 29 October Anker retired an endpoint by
answering it 403. Clients took every 403 for an evicted token and logged in
again on every poll, and that ended in a 24-hour IP ban, code 100041 "Hit max
login error limit" (ha-anker-solix #658, #659). This connector treated a 403
the same way. A successful login clears the backoff, so nothing would have
stopped the loop.

A refused token now costs a login only when one could help:
- A token issued less than two minutes ago was not evicted, so its refusal is
  the endpoint saying no.
- If another request has already replaced the token, the retry uses that
  token and no new login is made.
- An endpoint that refuses a fresh token is left alone for an hour. Its
  requests still go out and fail on their own, and no further logins are
  spent on it.
- Code 100041 holds the next login attempt back for an hour. More attempts
  only add to the count, and only a new public IP lifts the ban early.

Already as upstream now has it: the MQTT client does not mark a topic
subscribed when its SUBACK refuses it, and a malformed message is dropped
without touching the connection. The v3.9.1 signature comment (secret[:16]
after the handshake, presetKey only for the exchange) matches
payloadcrypto.go.

Toyota: pytoyoda has nothing after 6.0.0, which e7d2ef8 ported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 09:44:43 +01:00
tajniak81andClaude Opus 5 f8b39fa0a3 Anker Solix: the encrypted transport the app uses, ported from upstream v3.8.2
anker-solix-api v3.8.2 (2026-09-13) worked out the mobile app's REST payload
encryption end to end — a second ECDH handshake after login, then every body
AES-sealed and HMAC-signed both ways. Anker's servers still accept the plain
JSON this connector has always sent, and upstream leaves the mode off for that
reason; this ports it so that the day they stop is a config change rather than
an outage.

payloadcrypto.go holds the handshake (openapi/oauth/key/exchange, both public
keys wrapped under the app's presetKey) and the per-request envelope
(AES-128-CBC under secret[:16], x-signature keyed on its ascii hex). The
handshake lives beside the token in the shared session and is dropped with it,
so a fresh login is a fresh handshake before the retry. The switch is a
global-layer field, payloadEncryption, default off: it is how the connector
talks to Anker rather than whose account it talks as, so it does not cascade —
ankerCloudConfig copies it into every per-user config, and the six places that
built that map by hand now go through it.

Verified against a fake cloud that implements the server half from upstream's
description, not against Anker's; the switch should be tried on a test account
before it is relied on. Nothing else in v3.8.2 reaches an EV charger: the
Solarbank expansion sizing, the Gen 2 smart meter and the new site parameter
types are other devices, and the A5191 MQTT block is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 16:40:43 +02:00