Skip to content

Add Cybertruck tonneau cover to Teslemetry - #177610

Draft
Bre77 wants to merge 1 commit into
home-assistant:devfrom
Bre77:fm/core-signals-tonneau-0730
Draft

Add Cybertruck tonneau cover to Teslemetry#177610
Bre77 wants to merge 1 commit into
home-assistant:devfrom
Bre77:fm/core-signals-tonneau-0730

Conversation

@Bre77

@Bre77 Bre77 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Proposed change

Adds a cover entity for the Cybertruck's tonneau (truck bed cover), backed by the streaming TonneauPosition and TonneauOpenPercent fields and controllable via the existing closure(tonneau=...) command in tesla_fleet_api. It's modeled as a cover rather than a sensor because 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 in cover.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 REST vehicle_data equivalent, 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

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
if value in (None, "Unknown", "Invalid"):
self._attr_is_closed = None
else:
self._attr_is_closed = value == "Closed"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would render it completely unused, right? When can this occur and maybe we should check this upfront before setting up the platform?

@home-assistant
home-assistant Bot marked this pull request as draft July 30, 2026 11:29
@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants