diff --git a/pyproject.toml b/pyproject.toml index a29fcc6..d3e9499 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ["setuptools>=77.0"] [project] name = "teslemetry_stream" -version = "0.11.0" +version = "0.11.1" license = "Apache-2.0" description = "Teslemetry Streaming API library for Python" readme = "README.md" diff --git a/teslemetry_stream/const.py b/teslemetry_stream/const.py index 1fa300a..2a01dd2 100644 --- a/teslemetry_stream/const.py +++ b/teslemetry_stream/const.py @@ -597,7 +597,7 @@ def upper_options(self) -> list[str]: # Unused BuckleStatus = TeslemetryEnum( - "BuckleStatus", ["Unknown", "Unlatched", "Latched", "Faulted"] + "BuckleStatus", ["Unknown", "Unlatched", "Latched", "Faulted", "SNA"] ) CarType = TeslemetryEnum( diff --git a/teslemetry_stream/vehicle.py b/teslemetry_stream/vehicle.py index 5daf84e..70c7949 100644 --- a/teslemetry_stream/vehicle.py +++ b/teslemetry_stream/vehicle.py @@ -12,6 +12,7 @@ from .const import ( BMSState, + BuckleStatus, CabinOverheatProtectionModeState, CableType, CarType, @@ -1301,10 +1302,14 @@ def listen_DriveRail( def listen_DriverSeatBelt( self, callback: Callable[[bool | None], None] ) -> Callable[[], None]: - """Listen for Driver Seat Belt.""" + """Listen for Driver Seat Belt. + + True only when the driver seat is occupied and its belt is undone - + this is the safety-warning condition, not raw belt state. + """ self._enable_field(Signal.DRIVER_SEAT_BELT) return self.stream.async_add_listener( - make_bool(Signal.DRIVER_SEAT_BELT, callback), # BuckleStatus? + make_bool(Signal.DRIVER_SEAT_BELT, callback), {"vin": self.vin, "data": {Signal.DRIVER_SEAT_BELT: None}}, ) @@ -1946,12 +1951,18 @@ def listen_PairedPhoneKeyAndKeyFobQty( ) def listen_PassengerSeatBelt( - self, callback: Callable[[bool | None], None] + self, callback: Callable[[str | None], None] ) -> Callable[[], None]: - """Listen for Passenger Seat Belt.""" + """Listen for Passenger Seat Belt. + + Despite the name, this reports the 2nd row centre belt, not the + front passenger belt. + """ self._enable_field(Signal.PASSENGER_SEAT_BELT) return self.stream.async_add_listener( - make_bool(Signal.PASSENGER_SEAT_BELT, callback), + lambda x: callback( + BuckleStatus.get(x["data"][Signal.PASSENGER_SEAT_BELT]) + ), {"vin": self.vin, "data": {Signal.PASSENGER_SEAT_BELT: None}}, ) diff --git a/uv.lock b/uv.lock index 1d72232..d0d73b2 100644 --- a/uv.lock +++ b/uv.lock @@ -612,7 +612,7 @@ wheels = [ [[package]] name = "teslemetry-stream" -version = "0.11.0" +version = "0.11.1" source = { editable = "." } dependencies = [ { name = "aiohttp" },