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: Set NotImplemented from device schema. #31

Merged
merged 30 commits into from
Dec 14, 2024
Merged

Conversation

rainwoodman
Copy link
Contributor

@rainwoodman rainwoodman commented Dec 11, 2024

If a control/sensor is not supported by the device, then set the corresponding attribute to NotImplemented.

#25 #30

  • This PR included the unit test PR test: Draft test example. #27

  • A major change: added a ir_aws.py file that solidified the reverse engineering of the device info response. (ir == intermediate representation).

    • We discussed that the outward facing API should not be concrete; the ir sort of bridges the meta-ness (the device schema in the response) of the blueair server API and our concrete Python API
    • added SenML SensorPack parsing roughly following the RFC8428 definitions.
    • moved json parsing routines (and updated) to ir_aws.py, added unit tests.
  • Some upgrades to the Python 3.12 new typing syntax. I don't think we run type checkers on the source code yet, so this may actually be broken but at least the unit tests still runs fine. We can add a type checker later (I have not caught up with how to set up type checkers myself).

  • Unit tests for H35i and T10i are updated, since I already have the golden device info files.

  • added a new 'standby' attribute with the intention of deprecating the running attribute -- this way translation to HA semantics can be centralized to ha_blueair, and we can keep the blueair_api module closer to the actual blueair api.

For coverage on all of the attribute setters and the translation from
info dict to the attributes.
Apparently I cannot trigger it. I think it is also missing a pip install
-e .
- documenting reverse engineering the fields in the device configuration json.

-add senml sensor pack parsing.
If a sensor is not implemented by the device, then DeviceAws sets it
to NotImplemented.
If a sensor is implemented but its value is unavailable, sets it to None.
(the second case, is for example when H35i's fan is in standby, then h
and t are unavaiable)
@rainwoodman rainwoodman changed the title Set NotImplemented from device schema. feat: Set NotImplemented from device schema. Dec 11, 2024
tests/test_device_aws.py Outdated Show resolved Hide resolved
src/blueair_api/ir_aws.py Outdated Show resolved Hide resolved
Also add the forgotten unit test file for it.
@dahlb dahlb merged commit e19faf4 into dahlb:main Dec 14, 2024
2 of 3 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