1 """Platform for the opengarage.io binary sensor component."""
3 from __future__
import annotations
6 from typing
import cast
10 BinarySensorEntityDescription,
16 from .const
import DOMAIN
17 from .coordinator
import OpenGarageDataUpdateCoordinator
18 from .entity
import OpenGarageEntity
20 _LOGGER = logging.getLogger(__name__)
23 SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
26 translation_key=
"vehicle",
32 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
34 """Set up the OpenGarage binary sensors."""
35 open_garage_data_coordinator: OpenGarageDataUpdateCoordinator = hass.data[DOMAIN][
40 open_garage_data_coordinator,
41 cast(str, entry.unique_id),
44 for description
in SENSOR_TYPES
49 """Representation of a OpenGarage binary sensor."""
53 coordinator: OpenGarageDataUpdateCoordinator,
55 description: BinarySensorEntityDescription,
57 """Initialize the entity."""
59 super().
__init__(coordinator, device_id, description)
63 """Return True if entity is available."""
64 return super().available
and self.
_available_available
68 """Handle updated data from the coordinator."""
None __init__(self, OpenGarageDataUpdateCoordinator coordinator, str device_id, BinarySensorEntityDescription description)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)