1 """Support for Neato botvac connected vacuum cleaners."""
3 from datetime
import timedelta
6 from pybotvac
import Account
7 from urllib3.response
import HTTPResponse
13 from .const
import NEATO_MAP_DATA, NEATO_PERSISTENT_MAPS, NEATO_ROBOTS
15 _LOGGER = logging.getLogger(__name__)
19 """A My Neato hub wrapper class."""
21 def __init__(self, hass: HomeAssistant, neato: Account) ->
None:
22 """Initialize the Neato hub."""
24 self.my_neato: Account = neato
26 @Throttle(timedelta(minutes=1))
28 """Update the robot states."""
29 _LOGGER.debug(
"Running HUB.update_robots %s", self.
_hass_hass.data.get(NEATO_ROBOTS))
30 self.
_hass_hass.data[NEATO_ROBOTS] = self.my_neato.robots
31 self.
_hass_hass.data[NEATO_PERSISTENT_MAPS] = self.my_neato.persistent_maps
32 self.
_hass_hass.data[NEATO_MAP_DATA] = self.my_neato.maps
35 """Download a new map image."""
36 map_image_data: HTTPResponse = self.my_neato.get_map_image(url)
40 """Update entry for unique_id."""
42 await self.
_hass_hass.async_add_executor_job(self.my_neato.refresh_userdata)
43 unique_id: str = self.my_neato.unique_id
45 if entry.unique_id == unique_id:
48 _LOGGER.debug(
"Updating user unique_id for previous config entry")
49 self.
_hass_hass.config_entries.async_update_entry(entry, unique_id=unique_id)
HTTPResponse download_map(self, str url)
None __init__(self, HomeAssistant hass, Account neato)
str async_update_entry_unique_id(self, ConfigEntry entry)