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

Add Aidoo sensors to Airzone Cloud #93541

Merged
merged 6 commits into from May 29, 2023

Conversation

Noltari
Copy link
Contributor

@Noltari Noltari commented May 25, 2023

Proposed change

Add Aidoo temperature sensors to Airzone Cloud.
Humidity doesn't seem to be supported on these devices.

Aidoo devices control a single HVAC machine, as opposed to Airzone Flexa devices, which control different zones (rooms) on Air Ducts.

  • Airzone Flexa: WebServer <-> System(s) <-> Zones
  • Airzone Aidoo: WebServer <-> Aidoo

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This is not working as expected and will require minor library changes.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Comment on lines 55 to 59
value = None
if aidoo := self.coordinator.data[AZD_AIDOOS].get(self.aidoo_id):
if key in aidoo:
value = aidoo[key]
return value
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
value = None
if aidoo := self.coordinator.data[AZD_AIDOOS].get(self.aidoo_id):
if key in aidoo:
value = aidoo[key]
return value
if aidoo := self.coordinator.data[AZD_AIDOOS].get(self.aidoo_id):
return aidoo.get(key)
return None

You could do the above if there isn't a difference between aidoo[key] being non-existent and None and it saves one dict lookup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the only disadvantage is the code coverage, since line 57 won't be tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 0b76625 with a minor modification to keep 100% coverage.

Copy link
Member

Choose a reason for hiding this comment

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

You could probably also write it as

return (aidoo := self.coordinator.data[AZD_AIDOOS].get(self.aidoo_id)) and aidoo.get(key)

Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming the data looks like this

dict = {"key": {"subkey": "value"}}

which effectively makes it

return (subdict := dict.get("key")) and subdict.get("subkey")

@frenck frenck marked this pull request as draft May 29, 2023 19:03
@frenck
Copy link
Member

frenck commented May 29, 2023

I've marked this PR, as changes are requested that need to be processed.
Please un-draft it once it is ready for review again by clicking the "Ready for review" button.

Thanks! 👍

../Frenck

Learn more about our pull request process.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
@Noltari Noltari marked this pull request as ready for review May 29, 2023 19:13
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@frenck frenck merged commit 6aa01e1 into home-assistant:dev May 29, 2023
24 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2023
@Noltari Noltari deleted the airzone-cloud-aidoo-sensors branch August 17, 2023 09:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants