blueair-api 1.26.3__py3-none-any.whl → 1.28.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 +28 -6
- blueair_api/http_blueair.py +41 -0
- {blueair_api-1.26.3.dist-info → blueair_api-1.28.0.dist-info}/METADATA +1 -1
- {blueair_api-1.26.3.dist-info → blueair_api-1.28.0.dist-info}/RECORD +7 -7
- {blueair_api-1.26.3.dist-info → blueair_api-1.28.0.dist-info}/LICENSE +0 -0
- {blueair_api-1.26.3.dist-info → blueair_api-1.28.0.dist-info}/WHEEL +0 -0
- {blueair_api-1.26.3.dist-info → blueair_api-1.28.0.dist-info}/top_level.txt +0 -0
blueair_api/device.py
CHANGED
@@ -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 =
|
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 =
|
76
|
-
|
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
|
-
|
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()
|
blueair_api/http_blueair.py
CHANGED
@@ -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,19 +1,19 @@
|
|
1
1
|
blueair_api/__init__.py,sha256=GucsIENhTF4AVxPn4Xyr4imUxJJ8RO8RYt1opHCF2hQ,326
|
2
2
|
blueair_api/callbacks.py,sha256=fvrJsqH5eDRxWOGWiZkF2uLU4n2ve0zzU17ERqWbHP8,756
|
3
3
|
blueair_api/const.py,sha256=q1smSEhwyYvuQiR867lToFm-mGV-d3dNJvN0NJgscbU,1037
|
4
|
-
blueair_api/device.py,sha256=
|
4
|
+
blueair_api/device.py,sha256=eTtdIGSjNBnP2de5529jE4Nit7VF-EkTToEieHpjuRk,4604
|
5
5
|
blueair_api/device_aws.py,sha256=FYz1YtJQMTUfzZ-__kdOGe5HtO8MTUygX-XdRsYejWg,7356
|
6
6
|
blueair_api/errors.py,sha256=lJ_iFU_W6zQfGRi_wsMhWDw-fAVPFeCkCbT1erIlYQQ,233
|
7
7
|
blueair_api/http_aws_blueair.py,sha256=jztGyoH0iC7aCJ2oGf9hnEeHFOie3YikFvwtWo3W2w4,8536
|
8
|
-
blueair_api/http_blueair.py,sha256=
|
8
|
+
blueair_api/http_blueair.py,sha256=Ms-tDcGaTb8-Zg1Sw68aVoU6QP2ba2JQWT31_g1jUMk,11048
|
9
9
|
blueair_api/intermediate_representation_aws.py,sha256=DJWxHFP9yVll0O6kxHWjKscIlu-7genc3f7ZvwV5YdA,6137
|
10
10
|
blueair_api/model_enum.py,sha256=Z9Ne4icNEjbGNwdHJZSDibcKJKwv-W1BRpZx01RGFuY,2480
|
11
11
|
blueair_api/stub.py,sha256=sTWyRSDObzrXpZToAgDmZhCk3q8SsGN35h-kzMOqSOc,1272
|
12
12
|
blueair_api/util.py,sha256=7MrB2DLqUVOlBQuhv7bRmUXvcGcsjXiV3M0H3LloiOo,1962
|
13
13
|
blueair_api/util_bootstrap.py,sha256=RNIKrMWMBSUad4loYGwEVIKVxQ1_LVhXNQtUwuaquyo,1754
|
14
14
|
blueair_api/util_http.py,sha256=45AJG3Vb6LMVzI0WV22AoSyt64f_Jj3KpOAwF5M6EFE,1327
|
15
|
-
blueair_api-1.
|
16
|
-
blueair_api-1.
|
17
|
-
blueair_api-1.
|
18
|
-
blueair_api-1.
|
19
|
-
blueair_api-1.
|
15
|
+
blueair_api-1.28.0.dist-info/LICENSE,sha256=W6UV41yCe1R_Avet8VtsxwdJar18n40b3MRnbEMHZmI,1066
|
16
|
+
blueair_api-1.28.0.dist-info/METADATA,sha256=wGsJCFaJCWmezjsLCv4q_HZL0Zgin-AvyM_5cE6HE4M,1995
|
17
|
+
blueair_api-1.28.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
18
|
+
blueair_api-1.28.0.dist-info/top_level.txt,sha256=-gn0jNtmE83qEu70uMW5F4JrXnHGRfuFup1EPWF70oc,12
|
19
|
+
blueair_api-1.28.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|