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
Add Aidoo sensors to Airzone Cloud #93541
Conversation
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>
value = None | ||
if aidoo := self.coordinator.data[AZD_AIDOOS].get(self.aidoo_id): | ||
if key in aidoo: | ||
value = aidoo[key] | ||
return value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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")
I've marked this PR, as changes are requested that need to be processed. Thanks! 👍 ../Frenck |
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
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.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: