blueair-api 1.26.3__tar.gz → 1.28.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.28.0}/PKG-INFO +1 -1
  2. {blueair_api-1.26.3 → blueair_api-1.28.0}/pyproject.toml +1 -1
  3. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/device.py +28 -6
  4. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/http_blueair.py +41 -0
  5. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api.egg-info/PKG-INFO +1 -1
  6. {blueair_api-1.26.3 → blueair_api-1.28.0}/LICENSE +0 -0
  7. {blueair_api-1.26.3 → blueair_api-1.28.0}/README.md +0 -0
  8. {blueair_api-1.26.3 → blueair_api-1.28.0}/setup.cfg +0 -0
  9. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/__init__.py +0 -0
  10. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/callbacks.py +0 -0
  11. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/const.py +0 -0
  12. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/device_aws.py +0 -0
  13. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/errors.py +0 -0
  14. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/http_aws_blueair.py +0 -0
  15. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/intermediate_representation_aws.py +0 -0
  16. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/model_enum.py +0 -0
  17. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/stub.py +0 -0
  18. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/util.py +0 -0
  19. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/util_bootstrap.py +0 -0
  20. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api/util_http.py +0 -0
  21. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api.egg-info/SOURCES.txt +0 -0
  22. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api.egg-info/dependency_links.txt +0 -0
  23. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api.egg-info/requires.txt +0 -0
  24. {blueair_api-1.26.3 → blueair_api-1.28.0}/src/blueair_api.egg-info/top_level.txt +0 -0
  25. {blueair_api-1.26.3 → blueair_api-1.28.0}/tests/test_device_aws.py +0 -0
  26. {blueair_api-1.26.3 → blueair_api-1.28.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.28.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.28.0"
12
12
  authors = [
13
13
  { name="Brendan Dahl", email="dahl.brendan@gmail.com" },
14
14
  ]
@@ -68,15 +68,27 @@ class Device(CallbacksMixin):
68
68
  if "brightness" in attributes:
69
69
  self.brightness = int(attributes["brightness"])
70
70
  else:
71
- self.brightness = 0
71
+ self.brightness = NotImplemented
72
72
  if "child_lock" in attributes:
73
73
  self.child_lock = attributes["child_lock"] == "1"
74
+ else:
75
+ self.child_lock = NotImplemented
74
76
  if "night_mode" in attributes:
75
- self.night_mode = bool(attributes["night_mode"])
76
- self.fan_speed = int(attributes["fan_speed"])
77
+ self.night_mode = attributes["night_mode"] == "1"
78
+ else:
79
+ self.night_mode = NotImplemented
80
+ if "fan_speed" in attributes:
81
+ self.fan_speed = int(attributes["fan_speed"])
82
+ else:
83
+ self.fan_speed = NotImplemented
77
84
  if "filter_status" in attributes:
78
85
  self.filter_expired = attributes["filter_status"] != "OK"
79
- self.fan_mode = attributes["mode"]
86
+ else:
87
+ self.filter_expired = NotImplemented
88
+ if "mode" in attributes:
89
+ self.fan_mode = attributes["mode"]
90
+ else:
91
+ self.fan_mode = NotImplemented
80
92
  if "wifi_status" in attributes:
81
93
  self.wifi_working = attributes["wifi_status"] == "1"
82
94
  else:
@@ -95,7 +107,17 @@ class Device(CallbacksMixin):
95
107
  _LOGGER.debug(f"refreshed blueair device: {self}")
96
108
  self.publish_updates()
97
109
 
98
- async def set_fan_speed(self, new_speed):
99
- self.fan_speed = new_speed
110
+ async def set_fan_speed(self, new_speed: str):
111
+ self.fan_speed = int(new_speed)
100
112
  await self.api.set_fan_speed(self.uuid, new_speed)
101
113
  self.publish_updates()
114
+
115
+ async def set_brightness(self, new_brightness: int):
116
+ self.brightness = new_brightness
117
+ await self.api.set_brightness(self.uuid, new_brightness)
118
+ self.publish_updates()
119
+
120
+ async def set_child_lock(self, enabled: bool):
121
+ self.child_lock = enabled
122
+ await self.api.set_child_lock(self.uuid, enabled)
123
+ 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.28.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