1 """Support for KEBA charging station binary sensors."""
3 from __future__
import annotations
8 BinarySensorDeviceClass,
15 from .
import DOMAIN, KebaHandler
21 async_add_entities: AddEntitiesCallback,
22 discovery_info: DiscoveryInfoType |
None =
None,
24 """Set up the KEBA charging station platform."""
25 if discovery_info
is None:
28 keba: KebaHandler = hass.data[DOMAIN]
36 BinarySensorDeviceClass.CONNECTIVITY,
43 BinarySensorDeviceClass.PLUG,
50 BinarySensorDeviceClass.POWER,
56 "failsafe_mode_state",
57 BinarySensorDeviceClass.SAFETY,
64 """Representation of a binary sensor of a KEBA charging station."""
66 _attr_should_poll =
False
74 device_class: BinarySensorDeviceClass,
76 """Initialize the KEBA Sensor."""
79 self._attributes: dict[str, Any] = {}
87 """Return the state attributes of the binary sensor."""
88 return self._attributes
91 """Get latest cached states from the device."""
92 if self.
_key_key ==
"Online":
95 elif self.
_key_key ==
"Plug":
97 self._attributes[
"plugged_on_wallbox"] = self.
_keba_keba.
get_value(
100 self._attributes[
"plug_locked"] = self.
_keba_keba.
get_value(
"Plug_locked")
101 self._attributes[
"plugged_on_EV"] = self.
_keba_keba.
get_value(
"Plug_EV")
103 elif self.
_key_key ==
"State":
105 self._attributes[
"status"] = self.
_keba_keba.
get_value(
"State_details")
106 self._attributes[
"max_charging_rate"] =
str(
110 elif self.
_key_key ==
"Tmo FS":
114 elif self.
_key_key ==
"Authreq":
118 """Schedule a state update."""
122 """Add update callback after being added to hass."""
dict[str, Any] extra_state_attributes(self)
None __init__(self, KebaHandler keba, str key, str name, str entity_type, BinarySensorDeviceClass device_class)
None update_callback(self)
None async_added_to_hass(self)
None async_schedule_update_ha_state(self, bool force_refresh=False)
None async_setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback async_add_entities, DiscoveryInfoType|None discovery_info=None)
float|int|str|None get_value(Sensor sensor, str field)