Skip to content

Commit fc34c61

Browse files
dknowles2frenck
authored andcommitted
Pass an application identifier to the Hydrawise API (#132779)
1 parent 60e8a38 commit fc34c61

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

homeassistant/components/hydrawise/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from homeassistant.core import HomeAssistant
88
from homeassistant.exceptions import ConfigEntryAuthFailed
99

10-
from .const import DOMAIN
10+
from .const import APP_ID, DOMAIN
1111
from .coordinator import (
1212
HydrawiseMainDataUpdateCoordinator,
1313
HydrawiseUpdateCoordinators,
@@ -30,7 +30,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
3030
raise ConfigEntryAuthFailed
3131

3232
hydrawise = client.Hydrawise(
33-
auth.Auth(config_entry.data[CONF_USERNAME], config_entry.data[CONF_PASSWORD])
33+
auth.Auth(config_entry.data[CONF_USERNAME], config_entry.data[CONF_PASSWORD]),
34+
app_id=APP_ID,
3435
)
3536

3637
main_coordinator = HydrawiseMainDataUpdateCoordinator(hass, hydrawise)

homeassistant/components/hydrawise/config_flow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
1414
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
1515

16-
from .const import DOMAIN, LOGGER
16+
from .const import APP_ID, DOMAIN, LOGGER
1717

1818

1919
class HydrawiseConfigFlow(ConfigFlow, domain=DOMAIN):
@@ -39,7 +39,7 @@ async def _create_or_update_entry(
3939
return on_failure("timeout_connect")
4040

4141
try:
42-
api = client.Hydrawise(auth)
42+
api = client.Hydrawise(auth, app_id=APP_ID)
4343
# Don't fetch zones because we don't need them yet.
4444
user = await api.get_user(fetch_zones=False)
4545
except TimeoutError:

homeassistant/components/hydrawise/const.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
from datetime import timedelta
44
import logging
55

6+
from homeassistant.const import __version__ as HA_VERSION
7+
68
LOGGER = logging.getLogger(__package__)
79

10+
APP_ID = f"homeassistant-{HA_VERSION}"
11+
812
DOMAIN = "hydrawise"
913
DEFAULT_WATERING_TIME = timedelta(minutes=15)
1014

0 commit comments

Comments
 (0)