Open loongyh opened 1 month ago
Modes aren't really expected to have an ordering.
Hmm do you mean ordering should be done in the frontend regardless of the order passed? It seems there's consensus on this as according to this issue of the climate card I'm using there was an attempt to implement ordering logic.
Still in the context of ESPHome's climate component, is there a reason why Middle is enumed after High?
...
/// The fan mode is set to Medium
CLIMATE_FAN_MEDIUM = 4,
/// The fan mode is set to High
CLIMATE_FAN_HIGH = 5,
/// The fan mode is set to Middle
CLIMATE_FAN_MIDDLE = 6,
...
I'm thinking it's a straightforward fix to simply swap High and Middle. However, we need to make sure there are no dependencies on the enum integers by other components.
The problem
The fan mode Middle is ordered after High which causes this weird quirk in the frontend:
Proper ordering should be Auto, Low, Medium, Middle, High.
Looking at the entity's state attributes, Middle is indeed defined after High in
fan_modes
:Home Assistant orders the fan modes according to what is passed in the entity's
fan_modes
attribute. Could this be caused by Middle being enumed after High in ClimateFanMode?I'm using a custom component as in attached YAML snippet but after skimming through the code I don't see anything relevant to fan mode ordering.
Which version of ESPHome has the issue?
2024.5.2
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2024.5.5
What platform are you using?
ESP32
Board
No response
Component causing the issue
climate
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
This quirk can also be seen in another issue.