How do I force my `climate` entity's `fan_modes` property to be reevaluated after changing `hvac_mode`?

  • I’m writing an integration for my A/C, whose available fan_modes depend on the current hvac_mode.
  • My fan_modes property is written accordingly:
    @property
    def fan_modes(self) -> list[str] | None:
        details = self.__current_mode_details
        allowed_ha_fan_speeds = ...
        _LOG.debug(
            "Allowed fan speeds in mode %r: %r", details.mode, allowed_ha_fan_speeds
        )
        return allowed_ha_fan_speeds
  • When I change modes, I self.async_write_ha_state(); however, my available fan_modes don’t seem to update until a few seconds later, when the DataUpdateCoordinator echoes the new state back from the cloud.
  • I can’t see anything special in DataUpdateCoordinator that would trigger the reevaluation of fan_speeds, but it happens.

Can anyone guide me on how to get my fan_modes reevaluated more quickly, so that when I change my hvac_mode, I can immediately see the correct fan_modes in the adjacent dropdown instead of having to wait a few seconds?

I’ve just realised I also need the min_temp and max_temp properties to be reevaluated, since they also depend on the current mode—so this question isn’t specific to the fan_modes property after all.

It would be better to post a more complete code to see how you are setting available fan modes. If it is coming from the cloud after you change fan mode, are you forcing the data update coordinator to refresh or just waiting for the next scheduled event?