1 """Button platform for Tessie integration."""
3 from __future__
import annotations
5 from collections.abc
import Callable
6 from dataclasses
import dataclass
8 from tessie_api
import (
10 enable_keyless_driving,
21 from .
import TessieConfigEntry
22 from .entity
import TessieEntity
23 from .models
import TessieVehicleData
28 @dataclass(frozen=True, kw_only=True)
30 """Describes a Tessie Button entity."""
35 DESCRIPTIONS: tuple[TessieButtonEntityDescription, ...] = (
40 key=
"trigger_homelink", func=
lambda: trigger_homelink
43 key=
"enable_keyless_driving",
44 func=
lambda: enable_keyless_driving,
52 entry: TessieConfigEntry,
53 async_add_entities: AddEntitiesCallback,
55 """Set up the Tessie Button platform from a config entry."""
56 data = entry.runtime_data
60 for vehicle
in data.vehicles
61 for description
in DESCRIPTIONS
66 """Base class for Tessie Buttons."""
68 entity_description: TessieButtonEntityDescription
72 vehicle: TessieVehicleData,
73 description: TessieButtonEntityDescription,
75 """Initialize the Button."""
76 super().
__init__(vehicle, description.key)
80 """Press the button."""
None run(self, Callable[..., Awaitable[dict[str, Any]]] func, **Any kargs)