1 """The lawn mower integration."""
3 from __future__
import annotations
5 from datetime
import timedelta
7 from typing
import final
9 from propcache
import cached_property
25 LawnMowerEntityFeature,
28 _LOGGER = logging.getLogger(__name__)
30 DATA_COMPONENT: HassKey[EntityComponent[LawnMowerEntity]] =
HassKey(DOMAIN)
31 PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA
32 PLATFORM_SCHEMA_BASE = cv.PLATFORM_SCHEMA_BASE
36 async
def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
37 """Set up the lawn_mower component."""
38 component = hass.data[DATA_COMPONENT] = EntityComponent[LawnMowerEntity](
39 _LOGGER, DOMAIN, hass, SCAN_INTERVAL
41 await component.async_setup(config)
43 component.async_register_entity_service(
47 [LawnMowerEntityFeature.START_MOWING],
49 component.async_register_entity_service(
50 SERVICE_PAUSE,
None,
"async_pause", [LawnMowerEntityFeature.PAUSE]
52 component.async_register_entity_service(
53 SERVICE_DOCK,
None,
"async_dock", [LawnMowerEntityFeature.DOCK]
60 """Set up lawn mower devices."""
65 """Unload a config entry."""
70 """A class that describes lawn mower entities."""
73 CACHED_PROPERTIES_WITH_ATTR_ = {
80 """Base class for lawn mower entities."""
82 entity_description: LawnMowerEntityEntityDescription
83 _attr_activity: LawnMowerActivity |
None =
None
89 """Return the current state."""
93 def activity(self) -> LawnMowerActivity | None:
94 """Return the current lawn mower activity."""
95 return self._attr_activity
99 """Flag lawn mower features that are supported."""
100 return self._attr_supported_features
103 """Start or resume mowing."""
104 raise NotImplementedError
107 """Start or resume mowing."""
111 """Dock the mower."""
112 raise NotImplementedError
115 """Dock the mower."""
116 await self.
hasshass.async_add_executor_job(self.
dockdock)
119 """Pause the lawn mower."""
120 raise NotImplementedError
123 """Pause the lawn mower."""
124 await self.
hasshass.async_add_executor_job(self.
pausepause)
LawnMowerEntityFeature supported_features(self)
None async_start_mowing(self)
LawnMowerActivity|None activity(self)
bool async_setup(HomeAssistant hass, ConfigType config)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)