1 """Support for Dovado router."""
4 from datetime
import timedelta
8 import voluptuous
as vol
22 _LOGGER = logging.getLogger(__name__)
26 CONFIG_SCHEMA = vol.Schema(
30 vol.Required(CONF_USERNAME): cv.string,
31 vol.Required(CONF_PASSWORD): cv.string,
32 vol.Optional(CONF_HOST): cv.string,
33 vol.Optional(CONF_PORT): cv.port,
37 extra=vol.ALLOW_EXTRA,
43 def setup(hass: HomeAssistant, config: ConfigType) -> bool:
44 """Set up the Dovado component."""
48 config[DOMAIN][CONF_USERNAME],
49 config[DOMAIN][CONF_PASSWORD],
50 config[DOMAIN].
get(CONF_HOST),
51 config[DOMAIN].
get(CONF_PORT),
58 """Maintain a connection to the router."""
61 """Set up a new Dovado connection."""
67 """Name of the router."""
68 return self.
statestate.
get(
"product name", DEVICE_DEFAULT_NAME)
70 @Throttle(MIN_TIME_BETWEEN_UPDATES)
72 """Update device state."""
75 if not self.
statestate:
78 except OSError
as error:
79 _LOGGER.warning(
"Could not contact the router: %s", error)
81 _LOGGER.debug(
"Received: %s", self.
statestate)
86 """Dovado client instance."""
def __init__(self, client)
web.Response get(self, web.Request request, str config_key)
bool setup(HomeAssistant hass, ConfigType config)