Skip to content

Commit a15a3c1

Browse files
authored
Pass requestor_uuid to bond API calls (home-assistant#144128)
1 parent a6131b3 commit a15a3c1

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

homeassistant/components/bond/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Any
66

77
from aiohttp import ClientError, ClientResponseError, ClientTimeout
8-
from bond_async import Bond, BPUPSubscriptions, start_bpup
8+
from bond_async import Bond, BPUPSubscriptions, RequestorUUID, start_bpup
99

1010
from homeassistant.config_entries import ConfigEntry
1111
from homeassistant.const import (
@@ -49,6 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: BondConfigEntry) -> bool
4949
token=token,
5050
timeout=ClientTimeout(total=_API_TIMEOUT),
5151
session=async_get_clientsession(hass),
52+
requestor_uuid=RequestorUUID.HOME_ASSISTANT,
5253
)
5354
hub = BondHub(bond, host)
5455
try:

homeassistant/components/bond/config_flow.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import Any
99

1010
from aiohttp import ClientConnectionError, ClientResponseError
11-
from bond_async import Bond
11+
from bond_async import Bond, RequestorUUID
1212
import voluptuous as vol
1313

1414
from homeassistant.config_entries import ConfigEntryState, ConfigFlow, ConfigFlowResult
@@ -34,7 +34,12 @@
3434

3535
async def async_get_token(hass: HomeAssistant, host: str) -> str | None:
3636
"""Try to fetch the token from the bond device."""
37-
bond = Bond(host, "", session=async_get_clientsession(hass))
37+
bond = Bond(
38+
host,
39+
"",
40+
session=async_get_clientsession(hass),
41+
requestor_uuid=RequestorUUID.HOME_ASSISTANT,
42+
)
3843
response: dict[str, str] = {}
3944
with contextlib.suppress(ClientConnectionError):
4045
response = await bond.token()
@@ -45,7 +50,10 @@ async def _validate_input(hass: HomeAssistant, data: dict[str, Any]) -> tuple[st
4550
"""Validate the user input allows us to connect."""
4651

4752
bond = Bond(
48-
data[CONF_HOST], data[CONF_ACCESS_TOKEN], session=async_get_clientsession(hass)
53+
data[CONF_HOST],
54+
data[CONF_ACCESS_TOKEN],
55+
session=async_get_clientsession(hass),
56+
requestor_uuid=RequestorUUID.HOME_ASSISTANT,
4957
)
5058
try:
5159
hub = BondHub(bond, data[CONF_HOST])

0 commit comments

Comments
 (0)