blueair-api 1.17.0__py3-none-any.whl → 1.18.1__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
@@ -9,6 +9,28 @@ _LOGGER = logging.getLogger(__name__)
9
9
 
10
10
  @dataclasses.dataclass(slots=True)
11
11
  class Device(CallbacksMixin):
12
+ @classmethod
13
+ async def create_device(cls, api, uuid, name, mac, refresh=False):
14
+ _LOGGER.debug("UUID:"+uuid)
15
+ info = await api.get_info(uuid)
16
+ device = Device(
17
+ api=api,
18
+ uuid=uuid,
19
+ name=name,
20
+ mac=mac,
21
+ timezone=info["timezone"],
22
+ compatibility=info["compatibility"],
23
+ model=info["model"],
24
+ firmware=info["firmware"],
25
+ mcu_firmware=info["mcuFirmware"],
26
+ wlan_driver=info["wlanDriver"],
27
+ room_location=info["roomLocation"]
28
+ )
29
+ if refresh:
30
+ await device.refresh()
31
+ _LOGGER.debug(f"create_device blueair device: {device}")
32
+ return device
33
+
12
34
  api: HttpBlueair
13
35
  uuid: str | None = None
14
36
  name: str | None = None
@@ -29,17 +51,6 @@ class Device(CallbacksMixin):
29
51
  filter_expired: bool | None = None
30
52
  wifi_working: bool | None = None
31
53
 
32
- async def post_init(self):
33
- info = await self.api.get_info(self.uuid)
34
- self.timezone = info["timezone"]
35
- self.compatibility = info["compatibility"]
36
- self.model = info["model"]
37
- self.firmware = info["firmware"]
38
- self.mcu_firmware = info["mcuFirmware"]
39
- self.wlan_driver = info["wlanDriver"]
40
- self.room_location = info["roomLocation"]
41
- _LOGGER.debug(f"post_init blueair device: {self}")
42
-
43
54
  async def refresh(self):
44
55
  _LOGGER.debug("Requesting current attributes...")
45
56
  attributes = await self.api.get_attributes(self.uuid)
blueair_api/model_enum.py CHANGED
@@ -56,9 +56,6 @@ class ModelEnum(Enum):
56
56
  FeatureEnum.CHILD_LOCK,
57
57
  ]
58
58
  MAX_211I = "Blueair Blue Pure 211i Max", [
59
- FeatureEnum.TEMPERATURE,
60
- FeatureEnum.HUMIDITY,
61
- FeatureEnum.VOC,
62
59
  FeatureEnum.PM1,
63
60
  FeatureEnum.PM10,
64
61
  FeatureEnum.PM25,
@@ -66,9 +63,6 @@ class ModelEnum(Enum):
66
63
  FeatureEnum.CHILD_LOCK,
67
64
  ]
68
65
  MAX_311I = "Blueair Blue Pure 311i Max", [
69
- FeatureEnum.TEMPERATURE,
70
- FeatureEnum.HUMIDITY,
71
- FeatureEnum.VOC,
72
66
  FeatureEnum.PM1,
73
67
  FeatureEnum.PM10,
74
68
  FeatureEnum.PM25,
@@ -26,18 +26,17 @@ async def get_devices(
26
26
  )
27
27
  api_devices = await api.get_devices()
28
28
 
29
- def create_device(device):
30
- return Device(
31
- api=api,
32
- uuid=device["uuid"],
33
- name=device["name"],
34
- mac=device["mac"],
35
- )
36
-
37
- devices = map(create_device, api_devices)
29
+ devices = []
30
+ for api_device in api_devices:
31
+ devices.append(await Device.create_device(
32
+ api,
33
+ api_device["uuid"],
34
+ api_device["name"],
35
+ api_device["mac"]
36
+ ))
38
37
  return (
39
38
  api,
40
- list(devices),
39
+ devices,
41
40
  )
42
41
 
43
42
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blueair_api
3
- Version: 1.17.0
3
+ Version: 1.18.1
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=ogpUE0nH7s4o3rXHkioixm8S_jC79pYya0opLkTbc0c,2362
4
+ blueair_api/device.py,sha256=CugWoAbtSPd-rQMkg4MEYEWdx77tCExOqJ5_xzkfDvM,2636
5
5
  blueair_api/device_aws.py,sha256=8UYMInVnBI4nvfKO3ldtI18u99soCM-0FG3Vec8R89c,5272
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
8
  blueair_api/http_blueair.py,sha256=ieDvjs0_DHSJzseO_qdvLIxdrUUHuTgSHjWb6u-_gRs,7350
9
- blueair_api/model_enum.py,sha256=Em-Lu_1B_Jh5ut8GuDH9NGPQb_OykxsRFW0y0P5x3gk,2085
9
+ blueair_api/model_enum.py,sha256=QyeWyy53zbqnp1PCs73bneqqOnIp5IQphigm1r3Nr18,1909
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=1IQXZ0_nbRiLYnrnmyQcDMdZ7vi4i_CV78vFRxXCPWY,1602
12
+ blueair_api/util_bootstrap.py,sha256=5jDTtQduSwcouuTOga8DraUfPTjRiJz_bdGCVdBvehs,1592
13
13
  blueair_api/util_http.py,sha256=45AJG3Vb6LMVzI0WV22AoSyt64f_Jj3KpOAwF5M6EFE,1327
14
- blueair_api-1.17.0.dist-info/LICENSE,sha256=W6UV41yCe1R_Avet8VtsxwdJar18n40b3MRnbEMHZmI,1066
15
- blueair_api-1.17.0.dist-info/METADATA,sha256=hSI0Ng_uMPcJgn536kde8bm8fsl7RUTClktL05h0I3U,1995
16
- blueair_api-1.17.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
- blueair_api-1.17.0.dist-info/top_level.txt,sha256=-gn0jNtmE83qEu70uMW5F4JrXnHGRfuFup1EPWF70oc,12
18
- blueair_api-1.17.0.dist-info/RECORD,,
14
+ blueair_api-1.18.1.dist-info/LICENSE,sha256=W6UV41yCe1R_Avet8VtsxwdJar18n40b3MRnbEMHZmI,1066
15
+ blueair_api-1.18.1.dist-info/METADATA,sha256=_6bcF0Xd4Zox844LpCO8wAhBK9Cp7CiL8L4e68hMf70,1995
16
+ blueair_api-1.18.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
+ blueair_api-1.18.1.dist-info/top_level.txt,sha256=-gn0jNtmE83qEu70uMW5F4JrXnHGRfuFup1EPWF70oc,12
18
+ blueair_api-1.18.1.dist-info/RECORD,,