blueair-api 1.36.2__tar.gz → 1.36.4__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.36.2 → blueair_api-1.36.4}/PKG-INFO +1 -1
  2. {blueair_api-1.36.2 → blueair_api-1.36.4}/pyproject.toml +1 -1
  3. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/device_aws.py +1 -0
  4. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/http_aws_blueair.py +5 -4
  5. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/intermediate_representation_aws.py +6 -2
  6. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api.egg-info/PKG-INFO +1 -1
  7. {blueair_api-1.36.2 → blueair_api-1.36.4}/tests/test_device_aws.py +14 -11
  8. {blueair_api-1.36.2 → blueair_api-1.36.4}/LICENSE +0 -0
  9. {blueair_api-1.36.2 → blueair_api-1.36.4}/README.md +0 -0
  10. {blueair_api-1.36.2 → blueair_api-1.36.4}/setup.cfg +0 -0
  11. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/__init__.py +0 -0
  12. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/callbacks.py +0 -0
  13. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/const.py +0 -0
  14. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/device.py +0 -0
  15. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/errors.py +0 -0
  16. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/http_blueair.py +0 -0
  17. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/model_enum.py +0 -0
  18. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/stub.py +0 -0
  19. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/util.py +0 -0
  20. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/util_bootstrap.py +0 -0
  21. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api/util_http.py +0 -0
  22. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api.egg-info/SOURCES.txt +0 -0
  23. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api.egg-info/dependency_links.txt +0 -0
  24. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api.egg-info/requires.txt +0 -0
  25. {blueair_api-1.36.2 → blueair_api-1.36.4}/src/blueair_api.egg-info/top_level.txt +0 -0
  26. {blueair_api-1.36.2 → blueair_api-1.36.4}/tests/test_intermediate_representation_aws.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blueair_api
3
- Version: 1.36.2
3
+ Version: 1.36.4
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.36.2"
11
+ version = "1.36.4"
12
12
  authors = [
13
13
  { name="Brendan Dahl", email="dahl.brendan@gmail.com" },
14
14
  ]
@@ -101,6 +101,7 @@ class DeviceAws(CallbacksMixin):
101
101
  self.tVOC = sensor_data_safe_get("tVOC")
102
102
  self.temperature = sensor_data_safe_get("t")
103
103
  self.humidity = sensor_data_safe_get("h")
104
+ self.fan_speed_0 = sensor_data_safe_get("fsp0")
104
105
 
105
106
  def info_safe_get(path):
106
107
  # directly reads for the schema. If the schema field is
@@ -39,9 +39,10 @@ def request_with_errors(func):
39
39
  status_code = response.status
40
40
  try:
41
41
  response_json = await response.json(content_type=None)
42
- if "statusCode" in response_json:
43
- _LOGGER.debug("response json found, checking status code from response")
44
- status_code = response_json["statusCode"]
42
+ if response_json is not None:
43
+ if "statusCode" in response_json:
44
+ _LOGGER.debug("response json found, checking status code from response")
45
+ status_code = response_json["statusCode"]
45
46
  except Exception as e:
46
47
  _LOGGER.error(f"Error parsing response for errors {e}")
47
48
  raise e
@@ -49,7 +50,7 @@ def request_with_errors(func):
49
50
  _LOGGER.debug("response 200")
50
51
  return response
51
52
  if 400 <= status_code <= 500:
52
- _LOGGER.debug("auth error")
53
+ _LOGGER.debug(f"auth error, {status_code}")
53
54
  url = kwargs["url"]
54
55
  response_text = await response.text()
55
56
  if "accounts.login" in url:
@@ -123,8 +123,12 @@ class SensorRecord:
123
123
 
124
124
  class SensorHistory(list[SensorRecord]):
125
125
  def __init__(self, response):
126
- sensors = response[0]["sensors"]
127
- datapoints = response[0]["datapoints"]
126
+ if response is None:
127
+ sensors = []
128
+ datapoints = []
129
+ else:
130
+ sensors = response[0]["sensors"]
131
+ datapoints = response[0]["datapoints"]
128
132
  sensor_records = []
129
133
  for datapoint in datapoints:
130
134
  values = {}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blueair_api
3
- Version: 1.36.2
3
+ Version: 1.36.4
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
@@ -97,11 +97,12 @@ class DeviceAwsTestBase(IsolatedAsyncioTestCase):
97
97
  "states": [],
98
98
  })
99
99
 
100
- async def fake_sensors(device_name, device_uuid):
101
- return [{
100
+ self.device_sensor_helper = {"mock_data": [{
102
101
  "datapoints": [],
103
102
  "sensors": []
104
- }]
103
+ }]}
104
+ async def fake_sensors(device_name, device_uuid):
105
+ return self.device_sensor_helper["mock_data"]
105
106
 
106
107
  self.api.device_sensors.side_effect = fake_sensors
107
108
  self.api.device_info.side_effect = self.device_info_helper.device_info
@@ -563,6 +564,9 @@ class Protect7470iTest(DeviceAwsTestBase):
563
564
  with open(resources.files().joinpath('device_info/protect_7470i.json')) as sample_file:
564
565
  info = json.load(sample_file)
565
566
  self.device_info_helper.info.update(info)
567
+ with open(resources.files().joinpath('device_info/protect_7470i_sensors.json')) as sample_file:
568
+ sensors = json.load(sample_file)
569
+ self.device_sensor_helper["mock_data"] = sensors
566
570
 
567
571
  async def test_attributes(self):
568
572
 
@@ -572,13 +576,12 @@ class Protect7470iTest(DeviceAwsTestBase):
572
576
  with assert_fully_checked(self.device) as device:
573
577
 
574
578
  assert device.model == ModelEnum.PROTECT_7470I
575
-
576
- assert device.pm1 is None
577
- assert device.pm2_5 is None
578
- assert device.pm10 is None
579
- assert device.tVOC is None
580
- assert device.temperature is None
581
- assert device.humidity is None
579
+ assert device.pm1 == 0
580
+ assert device.pm2_5 == 0
581
+ assert device.pm10 == 0
582
+ assert device.tVOC == 134
583
+ assert device.temperature == 23
584
+ assert device.humidity == 55
582
585
  assert device.name == "air filter in room"
583
586
  assert device.firmware == "2.1.1"
584
587
  assert device.mcu_firmware == "1.0.12"
@@ -605,7 +608,7 @@ class Protect7470iTest(DeviceAwsTestBase):
605
608
  assert device.cool_sub_mode is NotImplemented
606
609
  assert device.cool_fan_speed is NotImplemented
607
610
  assert device.ap_sub_mode is NotImplemented
608
- assert device.fan_speed_0 is None
611
+ assert device.fan_speed_0 == 91
609
612
  assert device.temperature_unit is NotImplemented
610
613
 
611
614
 
File without changes
File without changes
File without changes