blueair-api 1.26.3__tar.gz → 1.27.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.26.3 → blueair_api-1.27.0}/PKG-INFO +1 -1
  2. {blueair_api-1.26.3 → blueair_api-1.27.0}/pyproject.toml +1 -1
  3. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/device.py +13 -3
  4. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/http_blueair.py +41 -0
  5. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api.egg-info/PKG-INFO +1 -1
  6. {blueair_api-1.26.3 → blueair_api-1.27.0}/LICENSE +0 -0
  7. {blueair_api-1.26.3 → blueair_api-1.27.0}/README.md +0 -0
  8. {blueair_api-1.26.3 → blueair_api-1.27.0}/setup.cfg +0 -0
  9. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/__init__.py +0 -0
  10. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/callbacks.py +0 -0
  11. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/const.py +0 -0
  12. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/device_aws.py +0 -0
  13. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/errors.py +0 -0
  14. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/http_aws_blueair.py +0 -0
  15. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/intermediate_representation_aws.py +0 -0
  16. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/model_enum.py +0 -0
  17. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/stub.py +0 -0
  18. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/util.py +0 -0
  19. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/util_bootstrap.py +0 -0
  20. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api/util_http.py +0 -0
  21. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api.egg-info/SOURCES.txt +0 -0
  22. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api.egg-info/dependency_links.txt +0 -0
  23. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api.egg-info/requires.txt +0 -0
  24. {blueair_api-1.26.3 → blueair_api-1.27.0}/src/blueair_api.egg-info/top_level.txt +0 -0
  25. {blueair_api-1.26.3 → blueair_api-1.27.0}/tests/test_device_aws.py +0 -0
  26. {blueair_api-1.26.3 → blueair_api-1.27.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.26.3
3
+ Version: 1.27.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.26.3"
11
+ version = "1.27.0"
12
12
  authors = [
13
13
  { name="Brendan Dahl", email="dahl.brendan@gmail.com" },
14
14
  ]
@@ -72,7 +72,7 @@ class Device(CallbacksMixin):
72
72
  if "child_lock" in attributes:
73
73
  self.child_lock = attributes["child_lock"] == "1"
74
74
  if "night_mode" in attributes:
75
- self.night_mode = bool(attributes["night_mode"])
75
+ self.night_mode = attributes["night_mode"] == "1"
76
76
  self.fan_speed = int(attributes["fan_speed"])
77
77
  if "filter_status" in attributes:
78
78
  self.filter_expired = attributes["filter_status"] != "OK"
@@ -95,7 +95,17 @@ class Device(CallbacksMixin):
95
95
  _LOGGER.debug(f"refreshed blueair device: {self}")
96
96
  self.publish_updates()
97
97
 
98
- async def set_fan_speed(self, new_speed):
99
- self.fan_speed = new_speed
98
+ async def set_fan_speed(self, new_speed: str):
99
+ self.fan_speed = int(new_speed)
100
100
  await self.api.set_fan_speed(self.uuid, new_speed)
101
101
  self.publish_updates()
102
+
103
+ async def set_brightness(self, new_brightness: int):
104
+ self.brightness = new_brightness
105
+ await self.api.set_brightness(self.uuid, new_brightness)
106
+ self.publish_updates()
107
+
108
+ async def set_child_lock(self, enabled: bool):
109
+ self.child_lock = enabled
110
+ await self.api.set_child_lock(self.uuid, enabled)
111
+ self.publish_updates()
@@ -254,3 +254,44 @@ class HttpBlueair:
254
254
  )
255
255
  )
256
256
  return await response.json()
257
+
258
+ async def set_brightness(self, device_uuid, new_brightness: int):
259
+ if new_brightness not in [0, 1, 2, 3, 4]:
260
+ raise Exception("Brightness not supported")
261
+ url = f"https://{await self.get_home_host()}/v2/device/{device_uuid}/attribute/brightness/"
262
+ headers = {
263
+ "X-API-KEY-TOKEN": API_KEY,
264
+ "X-AUTH-TOKEN": await self.get_auth_token(),
265
+ }
266
+ json_body = {
267
+ "currentValue": new_brightness,
268
+ "scope": "device",
269
+ "name": "brightness",
270
+ "uuid": str(device_uuid),
271
+ }
272
+ response: ClientResponse = (
273
+ await self._post_request_with_logging_and_errors_raised(
274
+ url=url, json_body=json_body, headers=headers
275
+ )
276
+ )
277
+ return await response.json()
278
+
279
+ async def set_child_lock(self, device_uuid, enabled: bool):
280
+ url = f"https://{await self.get_home_host()}/v2/device/{device_uuid}/attribute/child_lock/"
281
+ new_value = "1" if enabled else "0"
282
+ headers = {
283
+ "X-API-KEY-TOKEN": API_KEY,
284
+ "X-AUTH-TOKEN": await self.get_auth_token(),
285
+ }
286
+ json_body = {
287
+ "currentValue": new_value,
288
+ "scope": "device",
289
+ "name": "child_lock",
290
+ "uuid": str(device_uuid),
291
+ }
292
+ response: ClientResponse = (
293
+ await self._post_request_with_logging_and_errors_raised(
294
+ url=url, json_body=json_body, headers=headers
295
+ )
296
+ )
297
+ return await response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blueair_api
3
- Version: 1.26.3
3
+ Version: 1.27.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
File without changes
File without changes
File without changes