Skip to content

Commit

Permalink
Merge pull request #7 from v0nNemizez/dev
Browse files Browse the repository at this point in the history
v1.1.1 ready for master merge
  • Loading branch information
v0nNemizez authored Sep 19, 2024
2 parents 4190b76 + f627d14 commit d73848c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/melcloud/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def device_exists(self, devices, device_id):
def device_exists(devices, device_id):
for device in devices:
if device.device_id == device_id:
return True
Expand Down
4 changes: 4 additions & 0 deletions lib/melcloud/melcloudclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async def login(self):
return False
try:
j = await response.json()
log.info(msg=j)
self.contextKey = j["LoginData"]["ContextKey"]
return self.contextKey
except aiohttp.client_exceptions.ContentTypeError as e:
Expand All @@ -55,6 +56,7 @@ async def get_devices(self):
j = await response.json()
for device in j:
device_id = device['Structure']['Devices'][0]['DeviceID']
log.debug(f'found device {device_id}')
if not device_exists(self.devices, device_id):
d = Device()
await d.set_device_id(device['Structure']['Devices'][0]['BuildingID'],
Expand All @@ -63,6 +65,7 @@ async def get_devices(self):

self.devices.append(d)
log.info(f"Devices loaded. Found {len(self.devices)} devices")
return self.devices

except aiohttp.client_exceptions.ContentTypeError as e:
logging.error(f"Error: {e}")
Expand Down Expand Up @@ -151,6 +154,7 @@ async def change_fan_speed(self, deviceid, speed: int):
await device.jsonGenerator.set_new_fanspeed(speed)
await device.jsonGenerator.set_EffectiveFlags(EffectiveFlags.CHANGE_FANSPEED.value)
data = await device.create_request()
log.info(data)
async with self.session.post(url, headers=headers, json=data) as response:
if response.status != 200:
logging.error(f"Error: Received status code {response.status}")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "melcloudlibasyncio"
version = "1.1.0"
version = "1.1.1"
description = "A async client for interacting with the MELCloud API"
authors = ["Simen Andrè Skogum <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit d73848c

Please sign in to comment.