Skip to content

Commit

Permalink
feat: More i35 support (#19)
Browse files Browse the repository at this point in the history
* Better model name information.

- Add SKU to prepare for better device model inference in ha_blueair.
- and fix type_name propagation.

* match version number with i35 branch of ha_blueair

* Revert version edit.
  • Loading branch information
rainwoodman authored Nov 28, 2024
1 parent 01fe20f commit 8944db0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ keywords = [

[project.urls]
"Homepage" = "https://github.com/dahlb/blueair_api"
"Bug Tracker" = "https://github.com/dahlb/blueair_api/issues"
"Bug Tracker" = "https://github.com/dahlb/blueair_api/issues"
9 changes: 8 additions & 1 deletion src/blueair_api/device_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__(
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/blueair_api/util_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit 8944db0

Please sign in to comment.