Add Cybertruck tonneau cover to Teslemetry - #177610
Draft
Bre77 wants to merge 1 commit into
Draft
Conversation
Exposes the Cybertruck's power tonneau as a controllable cover using TonneauPosition/TonneauOpenPercent streaming telemetry and the teslemetry closure() command (open/close/stop). The entity is only created for Cybertrucks, mirroring the sunroof capability-gate pattern in cover.py but keyed on vehicle_config_car_type.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a streaming Cybertruck tonneau cover entity to Teslemetry.
Changes:
- Adds open, close, and stop controls with streamed position data.
- Gates creation by vehicle model and firmware.
- Adds translations, fixtures, snapshots, and behavioral tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/teslemetry/cover.py |
Implements the tonneau cover entity. |
homeassistant/components/teslemetry/strings.json |
Adds the entity name. |
tests/components/teslemetry/const.py |
Adds a Cybertruck fixture. |
tests/components/teslemetry/test_cover.py |
Tests creation, services, and streaming updates. |
tests/components/teslemetry/snapshots/test_cover.ambr |
Records Cybertruck cover states and registry entries. |
| TeslemetryStreamingTonneauEntity(vehicle, entry.runtime_data.scopes) | ||
| for vehicle in entry.runtime_data.vehicles | ||
| if not vehicle.poll | ||
| and firmware_at_least(vehicle.firmware, "2024.44.25") |
| {ATTR_ENTITY_ID: [entity_id]}, | ||
| blocking=True, | ||
| ) | ||
| call.assert_called_once() |
Bre77
marked this pull request as ready for review
July 30, 2026 10:05
3 tasks
erwindouna
requested changes
Jul 30, 2026
| if value in (None, "Unknown", "Invalid"): | ||
| self._attr_is_closed = None | ||
| else: | ||
| self._attr_is_closed = value == "Closed" |
Member
There was a problem hiding this comment.
Can we use the constant maybe for this Closed?
|
|
||
| def _async_position_from_stream(self, value: str | None) -> None: | ||
| """Update the entity attributes.""" | ||
| if value in (None, "Unknown", "Invalid"): |
Member
There was a problem hiding this comment.
If which case these edge cases can happen?
| """Initialize the cover.""" | ||
| super().__init__(vehicle, "tonneau") | ||
| self.scoped = Scope.VEHICLE_CMDS in scopes | ||
| if not self.scoped: |
Member
There was a problem hiding this comment.
This would render it completely unused, right? When can this occur and maybe we should check this upfront before setting up the platform?
Contributor
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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.
Proposed change
Adds a
coverentity for the Cybertruck's tonneau (truck bed cover), backed by the streamingTonneauPositionandTonneauOpenPercentfields and controllable via the existingclosure(tonneau=...)command intesla_fleet_api. It's modeled as acoverrather than asensorbecause the tonneau can actually be opened/closed/stopped through the API, matching how doors, windows and the sunroof are already exposed.The entity is only created for Cybertrucks (gated on
vehicle_config_car_type == "cybertruck"), mirroring the existing sunroof capability-gate pattern (vehicle_config_sun_roof_installed) already used incover.py, since these fields don't apply to Model 3/Y/S/X. Firmware is additionally gated to >= 2024.44.25, matching when these streaming fields were introduced. As with the other streaming-only fields in this integration, there's no RESTvehicle_dataequivalent, so only a streaming variant is added.This is one of three small, independent PRs splitting up a set of new Teslemetry streaming fields; the other two (#177608, #177609) touch unrelated entities and files.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: