1 """Support for binary_sensor entities."""
3 from __future__
import annotations
5 from dataclasses
import dataclass, field
7 from gardena_bluetooth.const
import Sensor, Valve
8 from gardena_bluetooth.parse
import CharacteristicBool
11 BinarySensorDeviceClass,
13 BinarySensorEntityDescription,
19 from .
import GardenaBluetoothConfigEntry
20 from .entity
import GardenaBluetoothDescriptorEntity
23 @dataclass(frozen=True)
25 """Description of entity."""
31 """Context needed for update coordinator."""
32 return {self.char.uuid}
37 key=Valve.connected_state.uuid,
38 translation_key=
"valve_connected_state",
39 device_class=BinarySensorDeviceClass.CONNECTIVITY,
40 entity_category=EntityCategory.DIAGNOSTIC,
41 char=Valve.connected_state,
44 key=Sensor.connected_state.uuid,
45 translation_key=
"sensor_connected_state",
46 device_class=BinarySensorDeviceClass.CONNECTIVITY,
47 entity_category=EntityCategory.DIAGNOSTIC,
48 char=Sensor.connected_state,
55 entry: GardenaBluetoothConfigEntry,
56 async_add_entities: AddEntitiesCallback,
58 """Set up binary sensor based on a config entry."""
59 coordinator = entry.runtime_data
62 for description
in DESCRIPTIONS
63 if description.key
in coordinator.characteristics
69 GardenaBluetoothDescriptorEntity, BinarySensorEntity
71 """Representation of a binary sensor."""
73 entity_description: GardenaBluetoothBinarySensorEntityDescription
None _handle_coordinator_update(self)
CharacteristicType|None get_cached(self, Characteristic[CharacteristicType] char)
None async_setup_entry(HomeAssistant hass, GardenaBluetoothConfigEntry entry, AddEntitiesCallback async_add_entities)