1 """Support for TechnoVE binary sensor."""
3 from __future__
import annotations
5 from collections.abc
import Callable
6 from dataclasses
import dataclass
7 from typing
import TYPE_CHECKING
9 from technove
import Station
as TechnoVEStation
12 DOMAIN
as BINARY_SENSOR_DOMAIN,
13 BinarySensorDeviceClass,
15 BinarySensorEntityDescription,
27 from .
import TechnoVEConfigEntry
28 from .const
import DOMAIN
29 from .coordinator
import TechnoVEDataUpdateCoordinator
30 from .entity
import TechnoVEEntity
33 @dataclass(frozen=True, kw_only=True)
35 """Describes TechnoVE binary sensor entity."""
37 deprecated_version: str |
None =
None
38 value_fn: Callable[[TechnoVEStation], bool |
None]
43 key=
"conflict_in_sharing_config",
44 translation_key=
"conflict_in_sharing_config",
45 entity_category=EntityCategory.DIAGNOSTIC,
46 value_fn=
lambda station: station.info.conflict_in_sharing_config,
49 key=
"in_sharing_mode",
50 translation_key=
"in_sharing_mode",
51 entity_category=EntityCategory.DIAGNOSTIC,
52 value_fn=
lambda station: station.info.in_sharing_mode,
55 key=
"is_battery_protected",
56 translation_key=
"is_battery_protected",
57 entity_category=EntityCategory.DIAGNOSTIC,
58 value_fn=
lambda station: station.info.is_battery_protected,
61 key=
"is_session_active",
62 entity_category=EntityCategory.DIAGNOSTIC,
63 device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
64 value_fn=
lambda station: station.info.is_session_active,
65 deprecated_version=
"2025.2.0",
67 entity_registry_enabled_default=
False,
71 translation_key=
"is_static_ip",
72 entity_category=EntityCategory.DIAGNOSTIC,
73 entity_registry_enabled_default=
False,
74 value_fn=
lambda station: station.info.is_static_ip,
77 key=
"update_available",
78 entity_category=EntityCategory.DIAGNOSTIC,
79 device_class=BinarySensorDeviceClass.UPDATE,
80 value_fn=
lambda station:
not station.info.is_up_to_date,
87 entry: TechnoVEConfigEntry,
88 async_add_entities: AddEntitiesCallback,
90 """Set up the binary sensor platform."""
93 for description
in BINARY_SENSORS
98 """Defines a TechnoVE binary sensor entity."""
100 entity_description: TechnoVEBinarySensorDescription
104 coordinator: TechnoVEDataUpdateCoordinator,
105 description: TechnoVEBinarySensorDescription,
107 """Initialize a TechnoVE binary sensor entity."""
109 super().
__init__(coordinator, description.key)
113 """Return the state of the sensor."""
118 """Raise issue when entity is registered and was not disabled."""
121 if entity_id := er.async_get(self.
hasshasshass).async_get_entity_id(
122 BINARY_SENSOR_DOMAIN, DOMAIN, self.
unique_idunique_id
128 f
"deprecated_entity_{self.entity_description.key}",
131 severity=IssueSeverity.WARNING,
132 translation_key=f
"deprecated_entity_{self.entity_description.key}",
133 translation_placeholders={
135 if isinstance(self.
namenamename, str)
144 f
"deprecated_entity_{self.entity_description.key}",
None __init__(self, TechnoVEDataUpdateCoordinator coordinator, TechnoVEBinarySensorDescription description)
None async_added_to_hass(self)
str|UndefinedType|None name(self)
None async_create_issue(HomeAssistant hass, str entry_id)
None async_delete_issue(HomeAssistant hass, str entry_id)
None async_setup_entry(HomeAssistant hass, TechnoVEConfigEntry entry, AddEntitiesCallback async_add_entities)