feat(energy): add RSA key registration for Powerwall LAN clients#34
Merged
feat(energy): add RSA key registration for Powerwall LAN clients#34
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
as PEM with mode 0o600. Exposes the public key in the DER PKCS1 format
the gateway expects, plus base64 and PEM helpers.
add_authorized_client_request command, accepting either raw DER bytes
or a base64-encoded public key.
AuthorizedClientState (PENDING / PENDING_VERIFICATION / VERIFIED) for
polling list_authorized_clients after registration.