1 """Platform for binary sensor integration."""
3 from __future__
import annotations
7 from laundrify_aio
import LaundrifyDevice
10 BinarySensorDeviceClass,
19 from .const
import DOMAIN, MANUFACTURER, MODELS
20 from .coordinator
import LaundrifyUpdateCoordinator
22 _LOGGER = logging.getLogger(__name__)
26 hass: HomeAssistant, config: ConfigEntry, async_add_entities: AddEntitiesCallback
28 """Set up sensors from a config entry created in the integrations UI."""
30 coordinator: LaundrifyUpdateCoordinator = hass.data[DOMAIN][config.entry_id][
40 CoordinatorEntity[LaundrifyUpdateCoordinator], BinarySensorEntity
42 """Representation of a laundrify Power Plug."""
44 _attr_device_class = BinarySensorDeviceClass.RUNNING
46 _attr_has_entity_name =
True
47 _attr_translation_key =
"wash_cycle"
50 self, coordinator: LaundrifyUpdateCoordinator, device: LaundrifyDevice
52 """Pass coordinator to CoordinatorEntity."""
58 identifiers={(DOMAIN, unique_id)},
60 manufacturer=MANUFACTURER,
61 model=MODELS[device.model],
62 sw_version=device.firmwareVersion,
63 configuration_url=f
"http://{device.internalIP}",
68 """Check if the device is available."""
71 and self.coordinator.last_update_success
76 """Return entity state."""
81 """Handle updated data from the coordinator."""
None _handle_coordinator_update(self)
None __init__(self, LaundrifyUpdateCoordinator coordinator, LaundrifyDevice device)
None async_setup_entry(HomeAssistant hass, ConfigEntry config, AddEntitiesCallback async_add_entities)