Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: More i35 support #19

Merged
merged 3 commits into from
Nov 28, 2024
Merged

feat: More i35 support #19

merged 3 commits into from
Nov 28, 2024

Conversation

rainwoodman
Copy link
Contributor

@rainwoodman rainwoodman commented Nov 27, 2024

Fix a few bugs in i35 support.
Add sku for better model name inference.

- Add SKU to prepare for better device model inference in ha_blueair.
- and fix type_name propagation.
@@ -12,6 +12,9 @@ class DeviceAws(CallbacksMixin):
name: str = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These attribute declarations typically do not mean anything in Python (some type checkers may use them, but due to backward compatibility its value is limited): I was mistyping water_shortage to wshortage and no checks were triggered.

To make typed properties we can declare

@property
def water_shortage(self) -> bool:
  """Returns True if the device reports a water shortage."""
  return safely_get_json_value(self._last_info['state'], ....)

That said I don't know whether the current style is conventional in homeassistant codebase. If you have no objections I will update the device_aws.py file to the strongly typed style (would require a update on the ha_blueair custom_component that I will file as well, since the attributes will be made read-only.

@rainwoodman rainwoodman changed the title More i35 support feat: More i35 support Nov 27, 2024
Copy link
Owner

@dahlb dahlb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good except the version being edited manually, also I like your idea of improving the typing with properties

pyproject.toml Outdated Show resolved Hide resolved
@dahlb dahlb merged commit 8944db0 into dahlb:main Nov 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants