1 """Support for monitoring Dremel 3D Printer binary sensors."""
3 from __future__
import annotations
5 from collections.abc
import Callable
6 from dataclasses
import dataclass
8 from dremel3dpy
import Dremel3DPrinter
11 BinarySensorDeviceClass,
13 BinarySensorEntityDescription,
18 from .coordinator
import DremelConfigEntry
19 from .entity
import Dremel3DPrinterEntity
22 @dataclass(frozen=True, kw_only=True)
24 """Describes a Dremel 3D Printer binary sensor."""
26 value_fn: Callable[[Dremel3DPrinter], bool]
29 BINARY_SENSOR_TYPES: tuple[Dremel3DPrinterBinarySensorEntityDescription, ...] = (
32 device_class=BinarySensorDeviceClass.DOOR,
33 value_fn=
lambda api: api.is_door_open(),
37 device_class=BinarySensorDeviceClass.RUNNING,
38 value_fn=
lambda api: api.is_running(),
45 config_entry: DremelConfigEntry,
46 async_add_entities: AddEntitiesCallback,
48 """Set up the available Dremel binary sensors."""
51 for description
in BINARY_SENSOR_TYPES
56 """Representation of a Dremel 3D Printer door binary sensor."""
58 entity_description: Dremel3DPrinterBinarySensorEntityDescription
62 """Return True if door is open."""
Dremel3DPrinter _api(self)
None async_setup_entry(HomeAssistant hass, DremelConfigEntry config_entry, AddEntitiesCallback async_add_entities)