Skip to content

Commit

Permalink
Support setting properties
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindwe committed Jul 2, 2024
1 parent 9f72670 commit 98c5999
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions connectlife/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ async def get_appliances_json(self) -> Any:
return await response.json()


async def update_appliance(self, puid: str, properties: dict[str, int]):
data = {
"puid": puid,
"properties": properties
}
_LOGGER.debug("Updating appliance with puid %s", puid)
await self._fetch_access_token()
async with aiohttp.ClientSession() as session:
async with session.post(APPLIANCES_URL, json=data, headers={
"User-Agent": "connectlife-api-connector 2.1.4",
"X-Token": self._access_token
}) as response:
result = await response.text()
_LOGGER.debug(result)
_LOGGER.debug("Updated appliance with puid %s", puid)


async def _fetch_access_token(self):
if self._expires is None:
await self._initial_access_token()
Expand Down

0 comments on commit 98c5999

Please sign in to comment.