Skip to content

Commit

Permalink
rename symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Nov 2, 2024
1 parent bbf0c12 commit 4dcedb1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/evohomeasync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __init__(
self.devices: dict[_ZoneIdT, _DeviceDictT] = {} # dhw or zone by id
self.named_devices: dict[_ZoneNameT, _DeviceDictT] = {} # zone by name

self.broker = Auth(
self.auth = Auth(
username,
password,
_LOGGER,
Expand All @@ -127,10 +127,10 @@ def __init__(
def user_data(self) -> _UserDataT | None: # TODO: deprecate?
"""Return the user data used for HTTP authentication."""

if not self.broker.session_id:
if not self.auth.session_id:
return None
return { # type: ignore[return-value]
SZ_SESSION_ID: self.broker.session_id,
SZ_SESSION_ID: self.auth.session_id,
SZ_USER_INFO: self.user_info,
}

Expand All @@ -145,7 +145,7 @@ async def _populate_user_data(
"""

if not self.user_info or force_refresh:
user_data = await self.broker.populate_user_data()
user_data = await self.auth.populate_user_data()
self.user_info = user_data[SZ_USER_INFO] # type: ignore[assignment]

return self.user_info # excludes session id
Expand All @@ -167,7 +167,7 @@ async def _populate_locn_data(self, force_refresh: bool = True) -> _LocnDataT:
"""

if not self.location_data or force_refresh:
full_data = await self.broker.populate_full_data()
full_data = await self.auth.populate_full_data()
self.location_data = full_data[self._LOC_IDX]

self.location_id = self.location_data[SZ_LOCATION_ID]
Expand Down Expand Up @@ -235,7 +235,7 @@ async def _set_system_mode(
data |= {SZ_QUICK_ACTION_NEXT_TIME: until.strftime("%Y-%m-%dT%H:%M:%SZ")}

url = f"evoTouchSystems?locationId={self.location_id}"
await self.broker.make_request(HTTPMethod.PUT, url, data=data)
await self.auth.make_request(HTTPMethod.PUT, url, data=data)

async def set_mode_auto(self) -> None:
"""Set the system to normal operation."""
Expand Down Expand Up @@ -320,7 +320,7 @@ async def _set_heat_setpoint(
}

url = f"devices/{zone_id}/thermostat/changeableValues/heatSetpoint"
await self.broker.make_request(HTTPMethod.PUT, url, data=data)
await self.auth.make_request(HTTPMethod.PUT, url, data=data)

async def set_temperature(
self, zone: _ZoneIdT | _ZoneNameT, temperature: float, until: dt | None = None
Expand Down Expand Up @@ -378,7 +378,7 @@ async def _set_dhw(
data |= {SZ_NEXT_TIME: next_time.strftime("%Y-%m-%dT%H:%M:%SZ")}

url = f"devices/{dhw_id}/thermostat/changeableValues"
await self.broker.make_request(HTTPMethod.PUT, url, data=data)
await self.auth.make_request(HTTPMethod.PUT, url, data=data)

async def set_dhw_on(self, until: dt | None = None) -> None:
"""Set DHW to On, either indefinitely, or until a specified time.
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_rf/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async def should_work_v1(
response: aiohttp.ClientResponse

# unlike _make_request(), make_request() incl. raise_for_status()
response = await evo.broker._make_request(method, url, data=json)
response = await evo.auth._make_request(method, url, data=json)
response.raise_for_status()

# TODO: perform this transform in the broker
Expand Down Expand Up @@ -65,7 +65,7 @@ async def should_fail_v1(

try:
# unlike _make_request(), make_request() incl. raise_for_status()
response = await evo.broker._make_request(method, url, data=json)
response = await evo.auth._make_request(method, url, data=json)
response.raise_for_status()

except aiohttp.ClientResponseError as err:
Expand Down
4 changes: 3 additions & 1 deletion tests/tests_rf/test_v1_xxxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@


async def _test_url_locations(evo: evo1.EvohomeClient) -> None:
# evo.update()

# evo.broker._headers["sessionId"] = evo.user_info["sessionId"] # what is this?
user_id: int = evo.user_info["userID"] # type: ignore[assignment]

assert evo.broker.session_id
assert evo.auth.session_id

url = f"locations?userId={user_id}&allData=True"
_ = await should_work_v1(evo, HTTPMethod.GET, url)
Expand Down

0 comments on commit 4dcedb1

Please sign in to comment.