Skip to content

VehicleRouter ImportError on v6.0.x — tesla-fleet-api version mismatch #293

Description

@caitotheonlypotato

The problem

Bug Report: VehicleRouter ImportError on v6.0.x — tesla-fleet-api version mismatch

Environment

  • Home Assistant Core: 2026.7.2
  • Home Assistant OS: 18.1
  • Supervisor: 2026.07.3
  • Teslemetry Integration: v6.0.3 (also reproduced on v6.0.2 and v6.0.1)
  • Installation method: Home Assistant OS (VM)
  • Working version: v5.3.x

Description

All v6.0.x releases fail to load with an ImportError on startup. The integration
cannot be used at all — it never gets past the import stage. Rolling back to v5.3
restores functionality.

Error

Logger: homeassistant.setup
Source: setup.py:341

Setup failed for custom integration 'teslemetry': Unable to import component:
cannot import name 'VehicleRouter' from 'tesla_fleet_api.tesla'
(/usr/local/lib/python3.14/site-packages/tesla_fleet_api/tesla/__init__.py)

ImportError: cannot import name 'VehicleRouter' from 'tesla_fleet_api.tesla'

Root Cause

The v6.0.x integration files import VehicleRouter from:

from tesla_fleet_api.tesla import VehicleRouter

However, manifest.json specifies tesla-fleet-api==1.7.2 as the requirement.
In that version, VehicleRouter does not exist in tesla_fleet_api.tesla at all.

Actual structure of tesla-fleet-api==1.7.2 (from PyPI)

tesla_fleet_api/
├── __init__.py
├── const.py
├── exceptions.py
├── router/
│   ├── __init__.py
│   ├── base.py
│   ├── energysite.py
│   └── vehicle.py          ← VehicleRouter lives here in 1.7.2
├── tesla/
│   ├── __init__.py
│   ├── bluetooth.py
│   ├── vehicle/
│   │   ├── __init__.py
│   │   └── ...             ← No router.py here
│   └── ...
├── teslemetry/
└── tessie/

In tesla-fleet-api==1.7.2, VehicleRouter is at tesla_fleet_api.router.vehicle,
not tesla_fleet_api.tesla or tesla_fleet_api.tesla.router.

Key Finding

The python-tesla-fleet-api GitHub README documents VehicleRouter as importable
from both tesla_fleet_api.tesla.router and tesla_fleet_api.tesla — exactly as
the v6.0.x integration code expects. However, this structure does not exist in
the PyPI release of v1.7.2
.

This means v6.0.x was written against an unreleased/dev version of tesla-fleet-api
where VehicleRouter was moved into the tesla_fleet_api.tesla namespace, but
manifest.json was never updated to require that newer version. As a result, HA
installs v1.7.2 from PyPI which has a completely different structure, and the
integration fails to import.

Required Fix

Bump the tesla-fleet-api requirement in manifest.json to whichever version
first adds VehicleRouter to the tesla_fleet_api.tesla namespace. For example:

"requirements": [
    "tesla-fleet-api>=X.Y.Z",
    ...
]

Where X.Y.Z is the first PyPI release that matches the structure described in
the current GitHub README.

What We Tried

  1. from tesla_fleet_api.tesla import VehicleRouter — fails (original v6.0.x code)
  2. from tesla_fleet_api.tesla.router import VehicleRouter — fails (submodule doesn't exist in 1.7.2)
  3. from tesla_fleet_api.router import VehicleRouter — correct path for 1.7.2 but
    still fails because the import error prevents HA from ever installing the
    dependency in the first place (chicken-and-egg problem)

Additional Notes

  • Because the import error occurs before HA installs dependencies, tesla-fleet-api
    never gets installed on disk, making the issue self-perpetuating on each restart
  • All three v6.0.x releases (v6.0.1, v6.0.2, v6.0.3) have this same issue
  • v5.3 works correctly and is the recommended rollback target
  • No workaround exists short of manually installing the correct library version
    into the HA Python environment, which is not supported or recommended

Affected Files in v6.0.x

All 12 files contain the broken import:

  • __init__.py, button.py, climate.py, cover.py, entity.py, lock.py,
    media_player.py, models.py, number.py, select.py, switch.py, update.py

What version of Home Assistant Core has the issue?

2026.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Teslemetry

Link to integration documentation on our website

https://www.home-assistant.io/integrations/teslemetry/

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions