blueair-api 1.19.0__tar.gz → 1.20.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 (23) hide show
  1. {blueair_api-1.19.0 → blueair_api-1.20.0}/PKG-INFO +1 -1
  2. {blueair_api-1.19.0 → blueair_api-1.20.0}/pyproject.toml +1 -1
  3. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/device.py +1 -0
  4. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/http_blueair.py +24 -0
  5. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/util_bootstrap.py +5 -4
  6. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api.egg-info/PKG-INFO +1 -1
  7. {blueair_api-1.19.0 → blueair_api-1.20.0}/LICENSE +0 -0
  8. {blueair_api-1.19.0 → blueair_api-1.20.0}/README.md +0 -0
  9. {blueair_api-1.19.0 → blueair_api-1.20.0}/setup.cfg +0 -0
  10. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/__init__.py +0 -0
  11. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/callbacks.py +0 -0
  12. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/const.py +0 -0
  13. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/device_aws.py +0 -0
  14. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/errors.py +0 -0
  15. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/http_aws_blueair.py +0 -0
  16. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/model_enum.py +0 -0
  17. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/stub.py +0 -0
  18. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/util.py +0 -0
  19. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api/util_http.py +0 -0
  20. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api.egg-info/SOURCES.txt +0 -0
  21. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api.egg-info/dependency_links.txt +0 -0
  22. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api.egg-info/requires.txt +0 -0
  23. {blueair_api-1.19.0 → blueair_api-1.20.0}/src/blueair_api.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blueair_api
3
- Version: 1.19.0
3
+ Version: 1.20.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.19.0"
11
+ version = "1.20.0"
12
12
  authors = [
13
13
  { name="Brendan Dahl", email="dahl.brendan@gmail.com" },
14
14
  ]
@@ -54,6 +54,7 @@ class Device(CallbacksMixin):
54
54
  async def refresh(self):
55
55
  _LOGGER.debug("Requesting current attributes...")
56
56
  attributes = await self.api.get_attributes(self.uuid)
57
+ _data_points = await self.api.get_current_data_point(self.uuid)
57
58
  _LOGGER.debug(f"result: {attributes}")
58
59
  if "brightness" in attributes:
59
60
  self.brightness = int(attributes["brightness"])
@@ -177,6 +177,30 @@ class HttpBlueair:
177
177
  )
178
178
  return await response.json()
179
179
 
180
+ # Note: refreshes every 5 minutes, timestamps are in seconds
181
+ async def get_current_data_point(self, device_uuid: str) -> dict[str, any]:
182
+ """
183
+ Fetch device information for the provided device ID.
184
+
185
+ The return value is a dictionary containing key-value pairs for the
186
+ available device information.
187
+
188
+ Note: the data for this API call is only updated once every 5 minutes.
189
+ Calling it more often will return the same respone from the server and
190
+ should be avoided to limit server load.
191
+ """
192
+ url = f"https://{await self.get_home_host()}/v2/device/{device_uuid}/datapoint/0/last/0/"
193
+ headers = {
194
+ "X-API-KEY-TOKEN": API_KEY,
195
+ "X-AUTH-TOKEN": await self.get_auth_token(),
196
+ }
197
+ response: ClientResponse = (
198
+ await self._get_request_with_logging_and_errors_raised(
199
+ url=url, headers=headers
200
+ )
201
+ )
202
+ return await response.json()
203
+
180
204
  async def set_fan_speed(self, device_uuid, new_speed: str):
181
205
  """
182
206
  Set the fan speed per @spikeyGG comment at https://community.home-assistant.io/t/blueair-purifier-addon/154456/14
@@ -63,7 +63,8 @@ async def get_aws_devices(
63
63
  type_name=device["type"],
64
64
  )
65
65
 
66
-
67
- devices = list(map(create_device, api_devices))
68
-
69
- return (api, devices)
66
+ devices = map(create_device, api_devices)
67
+ return (
68
+ api,
69
+ list(devices)
70
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blueair_api
3
- Version: 1.19.0
3
+ Version: 1.20.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