-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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 climate fan modes for Airzone Cloud Aidoo devices #103574
Add climate fan modes for Airzone Cloud Aidoo devices #103574
Conversation
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
I'm interested in this function. How can I test it? |
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
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.
I've tested this integration and it works perfectly. Aidoo Airzone + Fujitsu ducted air conditioner. The four speeds of the indoor unit are displayed correctly
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 have verified that everything works correctly in my AC with Airzone, I use an LG AC and the operation is perfect, as if it were the official app.
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.
Looks good, just a couple of small issues / unclarities
fan_speeds[1] = FAN_LOW | ||
fan_speeds[int(round((max_speed + 1) / 2, 0))] = FAN_MEDIUM | ||
fan_speeds[max_speed] = FAN_HIGH |
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.
Why do we want the list to be:
[
FAN_AUTO,
FAN_LOW,
"40%",
FAN_MEDIUM,
"80%",
FAN_HIGH,
]
Instead of:
[
FAN_AUTO,
"20%",
"40%",
"60%",
"80%",
"100%",
]
If there's a good reason, it wouldn't hurt to explain it in a comment.
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.
Because only the default speeds are exposed via Homekit/Alexa, and this is the only way of having N speeds and also getting the default ones exposed.
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 0f4566f
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.
only the default speeds are exposed via Homekit/Alexa
The Alexa integration does not support fan speeds for climate entities.
For homekit there is such a limitation though
core/homeassistant/components/homekit/type_thermostats.py
Lines 313 to 317 in 9b11807
if fan_modes and PRE_DEFINED_FAN_MODES.intersection(fan_modes): | |
self.ordered_fan_speeds = [ | |
speed for speed in ORDERED_FAN_SPEEDS if speed in fan_modes | |
] | |
self.fan_chars.append(CHAR_ROTATION_SPEED) |
I'd like a second opinion on this design, integrations should not have to solve limitations in voice assistant integrations.
gree
adds additional fan modes with a list like this, but maybe it doesn't work here if there can be many fan speeds:
FAN_MODES = {
FanSpeed.Auto: FAN_AUTO,
FanSpeed.Low: FAN_LOW,
FanSpeed.MediumLow: FAN_MEDIUM_LOW,
FanSpeed.Medium: FAN_MEDIUM,
FanSpeed.MediumHigh: FAN_MEDIUM_HIGH,
FanSpeed.High: FAN_HIGH,
}
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'd like a second opinion on this design, integrations should not have to solve limitations in voice assistant integrations.
@emontnemery this was already proposed by @bdraco during the same review for the local Airzone integration, see #92840
The Airzone local integration code:
core/homeassistant/components/airzone/climate.py
Lines 158 to 177 in 7c4747b
def _set_fan_speeds(self) -> None: | |
self._attr_supported_features |= ClimateEntityFeature.FAN_MODE | |
speeds = self.get_airzone_value(AZD_SPEEDS) | |
max_speed = max(speeds) | |
if _speeds := FAN_SPEED_MAPS.get(max_speed): | |
self._speeds = _speeds | |
else: | |
for speed in speeds: | |
if speed == 0: | |
self._speeds[speed] = FAN_AUTO | |
else: | |
self._speeds[speed] = f"{int(round((speed * 100) / max_speed, 0))}%" | |
self._speeds[1] = FAN_LOW | |
self._speeds[int(round((max_speed + 1) / 2, 0))] = FAN_MEDIUM | |
self._speeds[max_speed] = FAN_HIGH | |
self._speeds_reverse = {v: k for k, v in self._speeds.items()} | |
self._attr_fan_modes = list(self._speeds_reverse) |
gree adds additional fan modes with a list like this, but maybe it doesn't work here if there can be many fan speeds
According to Airzone there can be up to 8 speeds (+ Auto).
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.
The Alexa integration does not support fan speeds for climate entities.
You're right, comment fixed in 681967f
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.
this was already proposed by @bdraco during the same review for the local Airzone integration
That's not a good proposal though, other integrations should not have to implement workarounds because of limitations in homekit
, please change to a consistent naming both in this PR and in the airzone
integration.
Maybe the climate integration could make use of some clarification of the fan modes, or splitting between an ordered list of fan speed and fan modes (such as auto), that'd need an architecture discussion though.
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.
That's not a good proposal though, other integrations should not have to implement workarounds because of limitations in
homekit
, please change to a consistent naming both in this PR and in theairzone
integration.
Done in 438c5b6.
I don't think that doing it for the local integration is a good idea since it will break the compatibility for existing users...
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.
OK, maybe you're right that the breaking change is not worth it.
We should maybe add a comment in the local integration saying we don't want that pattern in other integrations though?
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Instead of mixing "low", "medium" and "high" with percentages, let's use only percentages if there are more speeds. 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.
Thanks, @Noltari 👍
Proposed change
Add climate fan modes for Airzone Cloud Aidoo devices.
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: