home-assistant/core · error · HomeAssistantError

failed_to_set_hvac_mode

failed_to_set_hvac_mode

Error message

Failed to set HVAC mode

What it means

HomeAssistantError with translation_key 'failed_to_set_hvac_mode', raised in async_set_hvac_mode when the client's set_hvac_mode() returns falsy — the gateway did not acknowledge/apply the mode change. HEAT_COOL is transparently mapped to AUTO before sending. The entity state is only updated after a successful set.

Source

Thrown at homeassistant/components/bryant_evolution/climate.py:213

                        return HVACAction.COOLING
                    return HVACAction.HEATING
        raise HomeAssistantError(
            translation_domain=DOMAIN,
            translation_key="failed_to_parse_hvac_action",
            translation_placeholders={
                "mode_and_active": mode_and_active,
                "current_temperature": str(self.current_temperature),
                "target_temperature_low": str(self.target_temperature_low),
            },
        )

    @override
    async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
        """Set new target hvac mode."""
        if hvac_mode == HVACMode.HEAT_COOL:
            hvac_mode = HVACMode.AUTO
        if not await self._client.set_hvac_mode(hvac_mode):
            raise HomeAssistantError(
                translation_domain=DOMAIN, translation_key="failed_to_set_hvac_mode"
            )
        self._attr_hvac_mode = hvac_mode
        self._async_write_ha_state()

    @override
    async def async_set_temperature(self, **kwargs: Any) -> None:
        """Set new target temperature."""
        if value := kwargs.get(ATTR_TARGET_TEMP_HIGH):
            temp = int(value)
            if not await self._client.set_cooling_setpoint(temp):
                raise HomeAssistantError(
                    translation_domain=DOMAIN, translation_key="failed_to_set_clsp"
                )
            self._attr_target_temperature_high = temp

        if value := kwargs.get(ATTR_TARGET_TEMP_LOW):
            temp = int(value)

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Confirm the gateway is online (check the thermostat's local UI)
  2. Reload the integration to re-establish the session, then retry the mode change
  3. Change the mode at the wall thermostat once to verify the system accepts it, then retry from HA
  4. Update integration/library if set_hvac_mode failures are a known regression
Defensive patterns

Strategy: try-catch

Validate before calling

# Command only when the entity is available and responsive
if climate.available:
    await climate.async_set_hvac_mode(HVACMode.HEAT)

Try / catch

try:
    await climate.async_set_hvac_mode(HVACMode.HEAT)
except HomeAssistantError as err:
    if 'failed_to_set_hvac_mode' in str(err):
        # gateway rejected the write; verify connectivity and retry

Prevention

When it happens

Trigger: User switches the climate entity to heat/cool/auto/off while the gateway is unreachable or rejects the write; websocket session stale so the command never lands; invalid mode for the current system configuration.

Common situations: Mode change attempts during gateway outages; HA UI mode toggle failing after long uptime with a dead session; system in a lockout (e.g. during defrost) refusing mode writes.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/a2048504d3d58723. Report an issue: GitHub.