Fix throttle bug with multiple robots

This commit is contained in:
Michael Graf 2021-04-27 13:05:47 +02:00
parent 6bc641b4b6
commit adab03db60
2 changed files with 1 additions and 5 deletions

View File

@ -1,6 +1,5 @@
"""Support for botvac connected Vorwerk vacuum cleaners.""" """Support for botvac connected Vorwerk vacuum cleaners."""
import asyncio import asyncio
from datetime import timedelta
import logging import logging
from pybotvac.exceptions import NeatoException from pybotvac.exceptions import NeatoException
@ -13,7 +12,6 @@ from homeassistant.exceptions import ConfigEntryNotReady
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.util import Throttle
from .api import VorwerkState from .api import VorwerkState
from .const import ( from .const import (
@ -72,7 +70,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
"""Set up config entry.""" """Set up config entry."""
robots = await _async_create_robots(hass, entry.data[VORWERK_ROBOTS]) robots = await _async_create_robots(hass, entry.data[VORWERK_ROBOTS])
robot_states = [ VorwerkState(robot) for robot in robots ] robot_states = [VorwerkState(robot) for robot in robots]
hass.data[VORWERK_DOMAIN][entry.entry_id] = { hass.data[VORWERK_DOMAIN][entry.entry_id] = {
VORWERK_ROBOTS: [ VORWERK_ROBOTS: [
@ -109,7 +107,6 @@ def _create_coordinator(
async def _async_create_robots(hass, robot_confs): async def _async_create_robots(hass, robot_confs):
@Throttle(timedelta(minutes=1))
def create_robot(config): def create_robot(config):
return Robot( return Robot(
serial=config[VORWERK_ROBOT_SERIAL], serial=config[VORWERK_ROBOT_SERIAL],

View File

@ -21,7 +21,6 @@ from homeassistant.components.vacuum import (
SUPPORT_STOP, SUPPORT_STOP,
StateVacuumEntity, StateVacuumEntity,
) )
from homeassistant.const import ATTR_MODE from homeassistant.const import ATTR_MODE
from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.update_coordinator import ( from homeassistant.helpers.update_coordinator import (