Skip to content

feat(energy): add RSA key registration for Powerwall LAN clients#34

Merged
Bre77 merged 2 commits intomainfrom
claude/add-rsa-key-registration-BqUGI
Apr 25, 2026
Merged

feat(energy): add RSA key registration for Powerwall LAN clients#34
Bre77 merged 2 commits intomainfrom
claude/add-rsa-key-registration-BqUGI

Conversation

@Bre77
Copy link
Copy Markdown
Member

@Bre77 Bre77 commented Apr 25, 2026

Adds the ability to generate a compliant RSA-4096 key pair and register
it as an authorized client on a Powerwall energy gateway, mirroring the
v1r registration flow from pypowerwall.

  • Tesla.get_rsa_private_key generates or loads a 4096-bit RSA key, saved
    as PEM with mode 0o600. Exposes the public key in the DER PKCS1 format
    the gateway expects, plus base64 and PEM helpers.
  • EnergySite.add_authorized_client posts the gRPC
    add_authorized_client_request command, accepting either raw DER bytes
    or a base64-encoded public key.
  • New enums: AuthorizedClientKeyType, AuthorizedClientType, and
    AuthorizedClientState (PENDING / PENDING_VERIFICATION / VERIFIED) for
    polling list_authorized_clients after registration.

claude added 2 commits April 25, 2026 08:20
Adds the ability to generate a compliant RSA-4096 key pair and register
it as an authorized client on a Powerwall energy gateway, mirroring the
v1r registration flow from pypowerwall.

- Tesla.get_rsa_private_key generates or loads a 4096-bit RSA key, saved
  as PEM with mode 0o600. Exposes the public key in the DER PKCS1 format
  the gateway expects, plus base64 and PEM helpers.
- EnergySite.add_authorized_client posts the gRPC
  add_authorized_client_request command, accepting either raw DER bytes
  or a base64-encoded public key.
- New enums: AuthorizedClientKeyType, AuthorizedClientType, and
  AuthorizedClientState (PENDING / PENDING_VERIFICATION / VERIFIED) for
  polling list_authorized_clients after registration.
Replace placeholder LAN=1 with the three values defined in Tesla's
AuthorizedClientType enum, as reverse-engineered in pypowerwall's
tedapi_combined.proto:

  INVALID = 0
  CUSTOMER_MOBILE_APP = 1
  VEHICLE = 2

There is no WiFi-specific value — WiFi vs LAN refers to the transport,
not the client type. pypowerwall registers its RSA key as
CUSTOMER_MOBILE_APP, so that becomes the default for add_authorized_client.

Also document that AuthorizedClientKeyType.RSA=1 is empirically derived;
Tesla has not published the full key_type enum body publicly.
@Bre77 Bre77 merged commit 8022f23 into main Apr 25, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants