"""Support for retrieving status info from Google Wifi/OnHub routers."""
import logging
from datetime import timedelta

import voluptuous as vol
import requests

from homeassistant.util import dt
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
    CONF_NAME, CONF_HOST, CONF_MONITORED_CONDITIONS, STATE_UNKNOWN)
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle

_LOGGER = logging.getLogger(__name__)

ATTR_CURRENT_VERSION = 'current_version'
ATTR_LAST_RESTART = 'last_restart'
ATTR_LOCAL_IP = 'local_ip'
ATTR_NEW_VERSION = 'new_version'
ATTR_STATUS = 'status'
ATTR_UPTIME = 'uptime'

DEFAULT_HOST = 'testwifi.here'
DEFAULT_NAME = 'google_wifi'

ENDPOINT = '/api/v1/status'

MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=1)

MONITORED_CONDITIONS = {
    ATTR_CURRENT_VERSION: [
        ['software', 'softwareVersion'],
        None,