blueair-api 1.28.0__tar.gz → 1.30.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {blueair_api-1.28.0 → blueair_api-1.30.0}/PKG-INFO +1 -1
  2. {blueair_api-1.28.0 → blueair_api-1.30.0}/pyproject.toml +1 -1
  3. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/device.py +1 -4
  4. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/device_aws.py +5 -11
  5. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/http_blueair.py +20 -1
  6. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/stub.py +1 -5
  7. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/util_bootstrap.py +1 -1
  8. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api.egg-info/PKG-INFO +1 -1
  9. {blueair_api-1.28.0 → blueair_api-1.30.0}/tests/test_device_aws.py +8 -11
  10. {blueair_api-1.28.0 → blueair_api-1.30.0}/LICENSE +0 -0
  11. {blueair_api-1.28.0 → blueair_api-1.30.0}/README.md +0 -0
  12. {blueair_api-1.28.0 → blueair_api-1.30.0}/setup.cfg +0 -0
  13. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/__init__.py +0 -0
  14. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/callbacks.py +0 -0
  15. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/const.py +0 -0
  16. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/errors.py +0 -0
  17. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/http_aws_blueair.py +0 -0
  18. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/intermediate_representation_aws.py +0 -0
  19. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/model_enum.py +0 -0
  20. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/util.py +0 -0
  21. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api/util_http.py +0 -0
  22. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api.egg-info/SOURCES.txt +0 -0
  23. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api.egg-info/dependency_links.txt +0 -0
  24. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api.egg-info/requires.txt +0 -0
  25. {blueair_api-1.28.0 → blueair_api-1.30.0}/src/blueair_api.egg-info/top_level.txt +0 -0
  26. {blueair_api-1.28.0 → blueair_api-1.30.0}/tests/test_intermediate_representation_aws.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blueair_api
3
- Version: 1.28.0
3
+ Version: 1.30.0
4
4
  Summary: Blueair Api Wrapper
5
5
  Author-email: Brendan Dahl <dahl.brendan@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/dahlb/blueair_api
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
8
8
 
9
9
  [project]
10
10
  name = "blueair_api"
11
- version = "1.28.0"
11
+ version = "1.30.0"
12
12
  authors = [
13
13
  { name="Brendan Dahl", email="dahl.brendan@gmail.com" },
14
14
  ]
@@ -85,10 +85,7 @@ class Device(CallbacksMixin):
85
85
  self.filter_expired = attributes["filter_status"] != "OK"
86
86
  else:
87
87
  self.filter_expired = NotImplemented
88
- if "mode" in attributes:
89
- self.fan_mode = attributes["mode"]
90
- else:
91
- self.fan_mode = NotImplemented
88
+ self.fan_mode = attributes.get("mode", NotImplemented)
92
89
  if "wifi_status" in attributes:
93
90
  self.wifi_working = attributes["wifi_status"] == "1"
94
91
  else:
@@ -138,17 +138,6 @@ class DeviceAws(CallbacksMixin):
138
138
  await self.api.set_device_info(self.uuid, "standby", "vb", value)
139
139
  self.publish_updates()
140
140
 
141
- # FIXME: avoid state translation at the API level and depreate running.
142
- # replace with standby which is standard across aws devices.
143
- @property
144
- def running(self) -> AttributeType[bool]:
145
- if self.standby is None or self.standby is NotImplemented:
146
- return self.standby
147
- return not self.standby
148
-
149
- async def set_running(self, running: bool):
150
- await self.set_standby(not running)
151
-
152
141
  async def set_fan_auto_mode(self, fan_auto_mode: bool):
153
142
  self.fan_auto_mode = fan_auto_mode
154
143
  await self.api.set_device_info(self.uuid, "automode", "vb", fan_auto_mode)
@@ -174,6 +163,11 @@ class DeviceAws(CallbacksMixin):
174
163
  await self.api.set_device_info(self.uuid, "wickdrys", "vb", value)
175
164
  self.publish_updates()
176
165
 
166
+ async def set_germ_shield(self, value: bool):
167
+ self.germ_shield = value
168
+ await self.api.set_device_info(self.uuid, "germshield", "vb", value)
169
+ self.publish_updates()
170
+
177
171
  @property
178
172
  def model(self) -> ModelEnum:
179
173
  if self.sku == "111633":
@@ -7,7 +7,6 @@ import base64
7
7
  from .util_http import request_with_logging
8
8
  from .const import API_KEY
9
9
  from .errors import LoginError
10
- from typing import Optional
11
10
 
12
11
  _LOGGER = logging.getLogger(__name__)
13
12
 
@@ -295,3 +294,23 @@ class HttpBlueair:
295
294
  )
296
295
  )
297
296
  return await response.json()
297
+
298
+ async def set_fan_mode(self, device_uuid, auto: bool):
299
+ url = f"https://{await self.get_home_host()}/v2/device/{device_uuid}/attribute/mode/"
300
+ new_value = "auto" if auto else "manual"
301
+ headers = {
302
+ "X-API-KEY-TOKEN": API_KEY,
303
+ "X-AUTH-TOKEN": await self.get_auth_token(),
304
+ }
305
+ json_body = {
306
+ "currentValue": new_value,
307
+ "scope": "device",
308
+ "name": "mode",
309
+ "uuid": str(device_uuid),
310
+ }
311
+ response: ClientResponse = (
312
+ await self._post_request_with_logging_and_errors_raised(
313
+ url=url, json_body=json_body, headers=headers
314
+ )
315
+ )
316
+ return await response.json()
@@ -1,17 +1,14 @@
1
1
  # run with "python3 src/blueair_api/stub.py"
2
2
  import logging
3
3
  import asyncio
4
- from threading import Event
5
4
 
6
5
  from getpass import getpass
7
6
  from pathlib import Path
8
7
  import sys
9
8
 
10
- # import blueair_api
11
-
12
9
  path_root = Path(__file__).parents[2]
13
10
  sys.path.append(str(path_root))
14
- from src.blueair_api import get_devices, get_aws_devices
11
+ from src.blueair_api import get_devices, get_aws_devices, DeviceAws
15
12
 
16
13
 
17
14
  logger = logging.getLogger("src.blueair_api")
@@ -30,7 +27,6 @@ async def testing():
30
27
  api, devices = await get_aws_devices(username=username, password=password)
31
28
  for device in devices:
32
29
  await device.refresh()
33
- await device.set_child_lock(True)
34
30
  logger.debug(device)
35
31
  finally:
36
32
  if api:
@@ -45,7 +45,7 @@ async def get_aws_devices(
45
45
  password: str,
46
46
  region: str = "us",
47
47
  client_session: ClientSession | None = None,
48
- ) -> tuple[HttpAwsBlueair, list[Device]]:
48
+ ) -> tuple[HttpAwsBlueair, list[DeviceAws]]:
49
49
  api = HttpAwsBlueair(
50
50
  username=username,
51
51
  password=password,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blueair_api
3
- Version: 1.28.0
3
+ Version: 1.30.0
4
4
  Summary: Blueair Api Wrapper
5
5
  Author-email: Brendan Dahl <dahl.brendan@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/dahlb/blueair_api
@@ -112,6 +112,7 @@ class DeviceAwsSetterTest(DeviceAwsTestBase):
112
112
  "brightness": fake,
113
113
  "fanspeed": fake,
114
114
  "standby": fake,
115
+ "germshield": fake,
115
116
  "automode": fake,
116
117
  "autorh": fake,
117
118
  "childlock": fake,
@@ -143,17 +144,17 @@ class DeviceAwsSetterTest(DeviceAwsTestBase):
143
144
  await self.device.refresh()
144
145
  assert self.device.fan_speed == 2
145
146
 
146
- async def test_running(self):
147
+ async def test_germ_shield(self):
147
148
  # test cache works
148
- self.device.standby = None
149
- await self.device.set_running(False)
150
- assert self.device.running is False
149
+ self.device.germ_shield = None
150
+ await self.device.set_germ_shield(False)
151
+ assert self.device.germ_shield is False
151
152
 
152
153
  # test refresh works
153
- await self.device.set_running(True)
154
- self.device.standby = None
154
+ await self.device.set_germ_shield(True)
155
+ self.device.germ_shield = None
155
156
  await self.device.refresh()
156
- assert self.device.running is True
157
+ assert self.device.germ_shield is True
157
158
 
158
159
  async def test_standby(self):
159
160
  # test cache works
@@ -258,7 +259,6 @@ class EmptyDeviceAwsTest(DeviceAwsTestBase):
258
259
  assert device.serial_number is NotImplemented
259
260
  assert device.sku is NotImplemented
260
261
 
261
- assert device.running is NotImplemented
262
262
  assert device.standby is NotImplemented
263
263
  assert device.night_mode is NotImplemented
264
264
  assert device.germ_shield is NotImplemented
@@ -304,7 +304,6 @@ class H35iTest(DeviceAwsTestBase):
304
304
  assert device.serial_number == "111163300201110210004036"
305
305
  assert device.sku == "111633"
306
306
 
307
- assert device.running is True
308
307
  assert device.standby is False
309
308
  assert device.night_mode is False
310
309
  assert device.germ_shield is NotImplemented
@@ -350,7 +349,6 @@ class T10iTest(DeviceAwsTestBase):
350
349
  assert device.serial_number == "111212400002313210001961"
351
350
  assert device.sku == "112124"
352
351
 
353
- assert device.running is True
354
352
  assert device.standby is False
355
353
  assert device.night_mode is NotImplemented
356
354
  assert device.germ_shield is NotImplemented
@@ -396,7 +394,6 @@ class Protect7470iTest(DeviceAwsTestBase):
396
394
  assert device.serial_number == "110582600000110110016855"
397
395
  assert device.sku == "105826"
398
396
 
399
- assert device.running is True
400
397
  assert device.standby is False
401
398
  assert device.night_mode is False
402
399
  assert device.germ_shield is True
File without changes
File without changes
File without changes