Pass an application identifier to the Hydrawise API (#132779)
parent
1a60f0e668
commit
9614a8d1ca
|
@ -7,7 +7,7 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
|
||||
from .const import DOMAIN
|
||||
from .const import APP_ID, DOMAIN
|
||||
from .coordinator import (
|
||||
HydrawiseMainDataUpdateCoordinator,
|
||||
HydrawiseUpdateCoordinators,
|
||||
|
@ -30,7 +30,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||
raise ConfigEntryAuthFailed
|
||||
|
||||
hydrawise = client.Hydrawise(
|
||||
auth.Auth(config_entry.data[CONF_USERNAME], config_entry.data[CONF_PASSWORD])
|
||||
auth.Auth(config_entry.data[CONF_USERNAME], config_entry.data[CONF_PASSWORD]),
|
||||
app_id=APP_ID,
|
||||
)
|
||||
|
||||
main_coordinator = HydrawiseMainDataUpdateCoordinator(hass, hydrawise)
|
||||
|
|
|
@ -13,7 +13,7 @@ import voluptuous as vol
|
|||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
|
||||
from .const import DOMAIN, LOGGER
|
||||
from .const import APP_ID, DOMAIN, LOGGER
|
||||
|
||||
|
||||
class HydrawiseConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
@ -39,7 +39,7 @@ class HydrawiseConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
return on_failure("timeout_connect")
|
||||
|
||||
try:
|
||||
api = client.Hydrawise(auth)
|
||||
api = client.Hydrawise(auth, app_id=APP_ID)
|
||||
# Don't fetch zones because we don't need them yet.
|
||||
user = await api.get_user(fetch_zones=False)
|
||||
except TimeoutError:
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.const import __version__ as HA_VERSION
|
||||
|
||||
LOGGER = logging.getLogger(__package__)
|
||||
|
||||
APP_ID = f"homeassistant-{HA_VERSION}"
|
||||
|
||||
DOMAIN = "hydrawise"
|
||||
DEFAULT_WATERING_TIME = timedelta(minutes=15)
|
||||
|
||||
|
|
Loading…
Reference in New Issue