From 997819496cf4da15cb30fa7dce5773d64cd74706 Mon Sep 17 00:00:00 2001 From: firstmate crewmate Date: Fri, 3 Jul 2026 07:54:19 +1000 Subject: [PATCH 1/3] Regenerate protobuf gencode for protobuf 6.32.0 (HA compat), bump to 1.5.2 Home Assistant core pins protobuf==6.32.0, but the 1.5.1 gencode was stamped 6.33.4 and calls ValidateProtobufRuntimeVersion(6, 33, 4, ...), which refuses to load on the 6.32.0 runtime (gencode newer than runtime => VersionError). This forced a core-wide protobuf bump when dropping the library into HA. Regenerate every *_pb2.py under tesla/vehicle/proto/ from the unchanged .proto sources using protoc v32.0 (tools/regenerate_protos.sh with protoc-32.0 on PATH), so the gencode is stamped 6.32.0. Only the version stamp lines change; the serialized descriptors are byte-identical, so this is a pure toolchain/version change with no schema drift. The .pyi stubs are unaffected (no version stamp). Raise the protobuf floor to >=6.32.0 to match the gencode: gencode 6.32.0 requires the runtime to be >= 6.32.0, so the previous >=6.31.1 floor was unsafe (a resolved 6.31.1 would VersionError at import). The floor is not raised above 6.32.0, so HA's exact pin still satisfies it. No upper cap: protobuf 7.x loads major-6 gencode without error, so a <7 cap would only exclude valid runtimes. Document the reproducible regen (protoc v32.0 -> 6.32.0 gencode, and the floor-must-match-gencode rule) in AGENTS.md. Bump version 1.5.1 -> 1.5.2. Verified with protobuf==6.32.0: all nine *_pb2 modules import cleanly and the full test suite passes (37 passed); 6.31.1 fails as expected. Co-Authored-By: Claude Opus 4.8 (1M context) --- AGENTS.md | 4 +++- pyproject.toml | 4 ++-- tesla_fleet_api.egg-info/PKG-INFO | 4 ++-- tesla_fleet_api.egg-info/requires.txt | 2 +- tesla_fleet_api/__init__.py | 2 +- tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py | 6 +++--- tesla_fleet_api/tesla/vehicle/proto/common_pb2.py | 6 +++--- tesla_fleet_api/tesla/vehicle/proto/errors_pb2.py | 6 +++--- tesla_fleet_api/tesla/vehicle/proto/keys_pb2.py | 6 +++--- tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.py | 6 +++--- tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.py | 6 +++--- .../tesla/vehicle/proto/universal_message_pb2.py | 6 +++--- tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.py | 6 +++--- tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.py | 6 +++--- uv.lock | 6 +++--- 15 files changed, 39 insertions(+), 37 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index a471e33..2ebfe58 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -87,7 +87,9 @@ All exceptions inherit from `TeslaFleetError(BaseException)`. ### Protobuf -Generated protobuf files live in `tesla/vehicle/proto/` and are excluded from ruff and pyright. Do not edit these directly. +Generated protobuf files live in `tesla/vehicle/proto/` and are excluded from ruff and pyright. Do not edit these directly — regenerate them with `tools/regenerate_protos.sh` (needs `protoc` on `PATH`). + +**Runtime-version pin (Home Assistant compatibility).** The gencode stamps a `ValidateProtobufRuntimeVersion(major, minor, patch, …)` call, and protobuf refuses to load gencode that is *newer* than the installed runtime (`gencode X > runtime` → `VersionError`). Home Assistant core pins `protobuf==6.32.0`, so the gencode must be stamped **≤ 6.32.0** or it breaks in HA. The generator version is the `protoc` version: under unified protobuf versioning, `protoc vX.Y` (`libprotoc X.Y`) stamps Python gencode `6.X.Y`. So to target runtime 6.32.0, regenerate with **protoc v32.0** (`protoc-32.0-linux-x86_64.zip` from the protobuf GitHub releases). The `protobuf>=6.32.0` floor in `pyproject.toml` must match the gencode version — never set it below the stamped version, or installs that resolve an older protobuf will hit `VersionError` at import. ## Code Style diff --git a/pyproject.toml b/pyproject.toml index ee9dadb..9f17c8e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ["setuptools>=77.0"] [project] name = "tesla_fleet_api" -version = "1.5.1" +version = "1.5.2" license = "Apache-2.0" description = "Tesla Fleet API library for Python" readme = "README.md" @@ -21,7 +21,7 @@ dependencies = [ "aiofiles>=24", "aiolimiter>=1", "cryptography>=43", - "protobuf>=6.31.1", + "protobuf>=6.32.0", "bleak>=0.22", "bleak-retry-connector>=3.9", ] diff --git a/tesla_fleet_api.egg-info/PKG-INFO b/tesla_fleet_api.egg-info/PKG-INFO index 0668790..be85d58 100644 --- a/tesla_fleet_api.egg-info/PKG-INFO +++ b/tesla_fleet_api.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: tesla_fleet_api -Version: 1.5.1 +Version: 1.5.2 Summary: Tesla Fleet API library for Python Author-email: Brett Adams License-Expression: Apache-2.0 @@ -16,7 +16,7 @@ Requires-Dist: aiohttp>=3 Requires-Dist: aiofiles>=24 Requires-Dist: aiolimiter>=1 Requires-Dist: cryptography>=43 -Requires-Dist: protobuf>=6.31.1 +Requires-Dist: protobuf>=6.32.0 Requires-Dist: bleak>=0.22 Requires-Dist: bleak-retry-connector>=3.9 Dynamic: license-file diff --git a/tesla_fleet_api.egg-info/requires.txt b/tesla_fleet_api.egg-info/requires.txt index 6130b41..67d48e2 100644 --- a/tesla_fleet_api.egg-info/requires.txt +++ b/tesla_fleet_api.egg-info/requires.txt @@ -2,6 +2,6 @@ aiohttp>=3 aiofiles>=24 aiolimiter>=1 cryptography>=43 -protobuf>=6.31.1 +protobuf>=6.32.0 bleak>=0.22 bleak-retry-connector>=3.9 diff --git a/tesla_fleet_api/__init__.py b/tesla_fleet_api/__init__.py index bce87a7..86b427d 100644 --- a/tesla_fleet_api/__init__.py +++ b/tesla_fleet_api/__init__.py @@ -1,7 +1,7 @@ """Tesla Fleet API""" __author__ = "hello@teslemetry.com" -__version__ = "1.5.1" +__version__ = "1.5.2" from tesla_fleet_api.const import Region, is_valid_region from tesla_fleet_api.tesla.bluetooth import TeslaBluetooth diff --git a/tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py index cc9c02f..1e48c94 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/car_server.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/car_server.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/common_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/common_pb2.py index 15f44db..70c6e86 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/common_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/common_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/common.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/common.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/errors_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/errors_pb2.py index 789dd31..18e3db8 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/errors_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/errors_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/errors.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/errors.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/keys_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/keys_pb2.py index 4578f47..68c3e26 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/keys_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/keys_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/keys.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/keys.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.py index a6875e3..fa65d05 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/managed_charging.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/managed_charging.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.py index dd02cb0..3f8514c 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/signatures.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/signatures.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.py index a1d8b57..a6bfd78 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/universal_message.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/universal_message.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.py index 6312b82..ea4e8bc 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/vcsec.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/vcsec.proto' ) diff --git a/tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.py b/tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.py index caebf41..93d247d 100644 --- a/tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.py +++ b/tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.py @@ -2,7 +2,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: tesla/vehicle.proto -# Protobuf Python Version: 6.33.4 +# Protobuf Python Version: 6.32.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _runtime_version.ValidateProtobufRuntimeVersion( _runtime_version.Domain.PUBLIC, 6, - 33, - 4, + 32, + 0, '', 'tesla/vehicle.proto' ) diff --git a/uv.lock b/uv.lock index 7187c3d..6cbffaf 100644 --- a/uv.lock +++ b/uv.lock @@ -172,7 +172,7 @@ source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "aiooui" }, { name = "bleak" }, - { name = "dbus-fast", marker = "sys_platform == 'linux'" }, + { name = "dbus-fast" }, { name = "uart-devices" }, { name = "usb-devices" }, ] @@ -728,7 +728,7 @@ wheels = [ [[package]] name = "tesla-fleet-api" -version = "1.5.1" +version = "1.5.2" source = { editable = "." } dependencies = [ { name = "aiofiles" }, @@ -755,7 +755,7 @@ requires-dist = [ { name = "bleak", specifier = ">=0.22" }, { name = "bleak-retry-connector", specifier = ">=3.9" }, { name = "cryptography", specifier = ">=43" }, - { name = "protobuf", specifier = ">=6.31.1" }, + { name = "protobuf", specifier = ">=6.32.0" }, ] [package.metadata.requires-dev] From 9d21b31a640e97abe3d3b147377f8c2111800a39 Mon Sep 17 00:00:00 2001 From: firstmate crewmate Date: Fri, 3 Jul 2026 08:01:19 +1000 Subject: [PATCH 2/3] no-mistakes(document): Sync protoc/protobuf version docs with 6.32.0 gencode pin --- tools/regenerate_protos.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/regenerate_protos.sh b/tools/regenerate_protos.sh index 0cab908..d7226ab 100755 --- a/tools/regenerate_protos.sh +++ b/tools/regenerate_protos.sh @@ -9,7 +9,13 @@ # Usage: # tools/regenerate_protos.sh # -# Requirements: protoc (>= 3) on PATH. +# Requirements: protoc on PATH. The protoc version determines the version +# stamped into the generated gencode: under unified protobuf versioning, +# protoc vX.Y emits Python gencode 6.X.Y. Because protobuf refuses to load +# gencode newer than the installed runtime, and Home Assistant core pins +# protobuf==6.32.0, regenerate with protoc v32.0 (-> gencode 6.32.0) and keep +# the protobuf floor in pyproject.toml in sync with the stamped version. See +# the "Protobuf" section of AGENTS.md for the full rationale. set -euo pipefail From 282c695b6412e1817da1adffba6f8c7c59d20e39 Mon Sep 17 00:00:00 2001 From: firstmate crewmate Date: Fri, 3 Jul 2026 08:04:52 +1000 Subject: [PATCH 3/3] no-mistakes(document): Bump upgradeProtoc.sh PROTOC_VERSION to 32.0 for gencode pin --- upgradeProtoc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upgradeProtoc.sh b/upgradeProtoc.sh index 2a6df32..b403d92 100755 --- a/upgradeProtoc.sh +++ b/upgradeProtoc.sh @@ -1,4 +1,4 @@ -PROTOC_VERSION=31.1 +PROTOC_VERSION=32.0 protoc --version curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip