From 527ed1edd07ec239fbeffce8d4980003a7d43516 Mon Sep 17 00:00:00 2001 From: Yu Feng Date: Sat, 9 Nov 2024 23:00:25 -0800 Subject: [PATCH 1/3] Better model name information. - Add SKU to prepare for better device model inference in ha_blueair. - and fix type_name propagation. --- pyproject.toml | 4 ++-- src/blueair_api/device_aws.py | 9 ++++++++- src/blueair_api/util_bootstrap.py | 8 +++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4872096..66f3a86 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "blueair_api" -version = "1.10.0" +version = "1.11.0" authors = [ { name="Brendan Dahl", email="dahl.brendan@gmail.com" }, ] @@ -35,4 +35,4 @@ keywords = [ [project.urls] "Homepage" = "https://github.com/dahlb/blueair_api" -"Bug Tracker" = "https://github.com/dahlb/blueair_api/issues" \ No newline at end of file +"Bug Tracker" = "https://github.com/dahlb/blueair_api/issues" diff --git a/src/blueair_api/device_aws.py b/src/blueair_api/device_aws.py index f592267..349ac85 100644 --- a/src/blueair_api/device_aws.py +++ b/src/blueair_api/device_aws.py @@ -12,6 +12,9 @@ class DeviceAws(CallbacksMixin): name: str = None name_api: str = None mac: str = None + type_name: str = None + + sku: str = None firmware: str = None mcu_firmware: str = None serial_number: str = None @@ -36,7 +39,7 @@ class DeviceAws(CallbacksMixin): # i35 wick_usage: int = None # percentage wick_dry_mode: bool = None - wshortage: bool = None + water_shortage: bool = None auto_regulated_humidity: int = None def __init__( @@ -55,6 +58,7 @@ def __init__( _LOGGER.debug(f"creating blueair device aws: {self.uuid}") async def refresh(self): + _LOGGER.debug(f"refreshing blueair device aws: {self.uuid}") info = await self.api.device_info(self.name_api, self.uuid) sensor_data = convert_api_array_to_dict(info["sensordata"]) self.pm1 = safely_get_json_value(sensor_data, "pm1", int) @@ -68,6 +72,7 @@ async def refresh(self): self.firmware = safely_get_json_value(info, "configuration.di.cfv") self.mcu_firmware = safely_get_json_value(info, "configuration.di.mfv") self.serial_number = safely_get_json_value(info, "configuration.di.ds") + self.sku = safely_get_json_value(info, "configuration.di.sku") states = convert_api_array_to_dict(info["states"]) self.running = safely_get_json_value(states, "standby") is False @@ -85,6 +90,7 @@ async def refresh(self): self.water_shortage = safely_get_json_value(states, "wshortage", bool) self.publish_updates() + _LOGGER.debug(f"refreshed blueair device aws: {self}") async def set_brightness(self, value: int): self.brightness = value @@ -131,6 +137,7 @@ def __repr__(self): "uuid": self.uuid, "name": self.name, "type_name": self.type_name, + "sku": self.sku, "name_api": self.name_api, "mac": self.mac, "firmware": self.firmware, diff --git a/src/blueair_api/util_bootstrap.py b/src/blueair_api/util_bootstrap.py index 6d2ea5d..c51ee71 100644 --- a/src/blueair_api/util_bootstrap.py +++ b/src/blueair_api/util_bootstrap.py @@ -32,7 +32,6 @@ def create_device(device): uuid=device["uuid"], name=device["name"], mac=device["mac"], - type_name=device["type"], ) devices = map(create_device, api_devices) @@ -62,7 +61,10 @@ def create_device(device): uuid=device["uuid"], name_api=device["name"], mac=device["mac"], + type_name=device["type"], ) - devices = map(create_device, api_devices) - return (api, list(devices)) + + devices = list(map(create_device, api_devices)) + + return (api, devices) From 73736434db33129035a35ffeccc45a004da211d5 Mon Sep 17 00:00:00 2001 From: Yu Feng Date: Tue, 26 Nov 2024 20:50:28 -0800 Subject: [PATCH 2/3] match version number with i35 branch of ha_blueair --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 66f3a86..ec225f1 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "blueair_api" -version = "1.11.0" +version = "1.10.1" authors = [ { name="Brendan Dahl", email="dahl.brendan@gmail.com" }, ] From 6c2dd02538ca75f325e0bd955fb59bd8b0e9dd1a Mon Sep 17 00:00:00 2001 From: Yu Feng Date: Wed, 27 Nov 2024 10:12:28 -0800 Subject: [PATCH 3/3] Revert version edit. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ec225f1..ab5dc5b 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" [project] name = "blueair_api" -version = "1.10.1" +version = "1.10.0" authors = [ { name="Brendan Dahl", email="dahl.brendan@gmail.com" }, ]