3 from deebot_client.capabilities
import CapabilityEvent
4 from deebot_client.device
import Device
5 from deebot_client.events
import CleanJobStatus, ReportStatsEvent
12 from .
import EcovacsConfigEntry
13 from .entity
import EcovacsEntity
14 from .util
import get_name_key
19 config_entry: EcovacsConfigEntry,
20 async_add_entities: AddEntitiesCallback,
22 """Add entities for passed config_entry in HA."""
23 controller = config_entry.runtime_data
30 EcovacsEntity[CapabilityEvent[ReportStatsEvent]],
33 """Ecovacs last job event entity."""
37 translation_key=
"last_job",
38 entity_category=EntityCategory.DIAGNOSTIC,
39 event_types=[
"finished",
"finished_with_warnings",
"manually_stopped"],
43 """Initialize entity."""
44 super().
__init__(device, device.capabilities.stats.report)
47 """Set up the event listeners now that hass is ready."""
50 async
def on_event(event: ReportStatsEvent) ->
None:
52 if event.status
in (CleanJobStatus.NO_STATUS, CleanJobStatus.CLEANING):
None _subscribe(self, type[EventT] event_type, Callable[[EventT], Coroutine[Any, Any, None]] callback)
None __init__(self, Device device)
None async_added_to_hass(self)
None _trigger_event(self, str event_type, dict[str, Any]|None event_attributes=None)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, EcovacsConfigEntry config_entry, AddEntitiesCallback async_add_entities)
str get_name_key(Enum enum)