Skip to content

Commit

Permalink
fix(api): use id= again in values2.xml API
Browse files Browse the repository at this point in the history
  • Loading branch information
luuuis committed Dec 20, 2023
1 parent dddfb46 commit f7bd762
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/wibeee/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ def __init__(self, session: aiohttp.ClientSession, host: str, timeout: timedelta
async def async_fetch_status(self, device: DeviceInfo, var_names: list[str], retries: int = 0) -> dict[str, any]:
"""Fetches the status XML from Wibeee as a dict, optionally retries"""
if device.use_values2:
# request the specific vars we need, otherwise Wibeee will send down everything including WiFi keys.
var_ids = [f"{quote_plus(device.id)}.{name}" for name in var_names]
values2_response = await self.async_fetch_url(f'http://{self.host}/services/user/values2.xml?var={"&".join(var_ids)}', retries)
device_id = quote_plus(device.id)
# Temporarily disabled: request the specific vars we need, otherwise Wibeee will send down everything including WiFi keys.
# var_ids = [f"{device_id}.{name}" for name in var_names]
# values2_response_ = await self.async_fetch_url(f'http://{self.host}/services/user/values2.xml?var={"&".join(var_ids)}', retries)
values2_response = await self.async_fetch_url(f'http://{self.host}/services/user/values2.xml?id={device_id}', retries)
return values2_response['values']
else:
status_response = await self.async_fetch_url(f'http://{self.host}/en/status.xml', retries)
Expand Down

0 comments on commit f7bd762

Please sign in to comment.