blueair-api 1.19.0__py3-none-any.whl → 1.20.0__py3-none-any.whl

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.
blueair_api/device.py CHANGED
@@ -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
@@ -1,18 +1,18 @@
1
1
  blueair_api/__init__.py,sha256=GucsIENhTF4AVxPn4Xyr4imUxJJ8RO8RYt1opHCF2hQ,326
2
2
  blueair_api/callbacks.py,sha256=eqgfe1qN_NNWOp2qNSP123zQJxh_Ie6vZXp5EHp6ePc,757
3
3
  blueair_api/const.py,sha256=fRth29dQT1dguM7L4ij8pDefB_vBrevAHqTdfNvSugs,1048
4
- blueair_api/device.py,sha256=CugWoAbtSPd-rQMkg4MEYEWdx77tCExOqJ5_xzkfDvM,2636
4
+ blueair_api/device.py,sha256=Yz9M3-JmCUxaecVr98DcMT9hu6LAWUqarTcMwKfI064,2708
5
5
  blueair_api/device_aws.py,sha256=DZBE02Rae7z5qF7tdO3C1LuhTxaD-Y7jLoSuxysHdtc,5343
6
6
  blueair_api/errors.py,sha256=lJ_iFU_W6zQfGRi_wsMhWDw-fAVPFeCkCbT1erIlYQQ,233
7
7
  blueair_api/http_aws_blueair.py,sha256=m_qoCFOYICCu_U_maBvkmOha3YmNtxxtPYyapVBGKNc,17821
8
- blueair_api/http_blueair.py,sha256=ieDvjs0_DHSJzseO_qdvLIxdrUUHuTgSHjWb6u-_gRs,7350
8
+ blueair_api/http_blueair.py,sha256=Q-BOzObAPvfj1KqTxMR4MyhVMuH3FmKHlv7Lpd6PAEk,8335
9
9
  blueair_api/model_enum.py,sha256=kDb3NL3bVQxl6eaQaBACOwtAZD9jV_nf7ivGJa2cZmQ,2056
10
10
  blueair_api/stub.py,sha256=yJLfmrHjAH0XKl9HVTkKt-Ks9bG6Uhlkn3H2Jf3REJQ,1278
11
11
  blueair_api/util.py,sha256=3L9-vfHfN1vUBYU0BA9ruYyNPUTmS21D-uI-Jyo5x6U,1672
12
- blueair_api/util_bootstrap.py,sha256=5jDTtQduSwcouuTOga8DraUfPTjRiJz_bdGCVdBvehs,1592
12
+ blueair_api/util_bootstrap.py,sha256=GSn0Ez7UQNajmPKyH3fpJdSwJYj-DbPqSc_wnYF94WM,1612
13
13
  blueair_api/util_http.py,sha256=45AJG3Vb6LMVzI0WV22AoSyt64f_Jj3KpOAwF5M6EFE,1327
14
- blueair_api-1.19.0.dist-info/LICENSE,sha256=W6UV41yCe1R_Avet8VtsxwdJar18n40b3MRnbEMHZmI,1066
15
- blueair_api-1.19.0.dist-info/METADATA,sha256=4KonUsV7rROBIHMm5OA5Gr2uKfMFN0229a_FYeJ8d04,1995
16
- blueair_api-1.19.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
- blueair_api-1.19.0.dist-info/top_level.txt,sha256=-gn0jNtmE83qEu70uMW5F4JrXnHGRfuFup1EPWF70oc,12
18
- blueair_api-1.19.0.dist-info/RECORD,,
14
+ blueair_api-1.20.0.dist-info/LICENSE,sha256=W6UV41yCe1R_Avet8VtsxwdJar18n40b3MRnbEMHZmI,1066
15
+ blueair_api-1.20.0.dist-info/METADATA,sha256=wfvi7qRXqpAtrkfD3z9rp91ESpAS-JnABF3aHMhFmBg,1995
16
+ blueair_api-1.20.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
+ blueair_api-1.20.0.dist-info/top_level.txt,sha256=-gn0jNtmE83qEu70uMW5F4JrXnHGRfuFup1EPWF70oc,12
18
+ blueair_api-1.20.0.dist-info/RECORD,,