{"record":{"id":"49a454ba77d3410c","repo":"home-assistant/core","slug":"failed-to-set-temperature-to-temperature","errorCode":null,"errorMessage":"Failed to set temperature to {temperature}.","messagePattern":"Failed to set temperature to (.+?)\\.","errorType":"exception","errorClass":"ServiceValidationError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/airobot/climate.py","lineNumber":142,"sourceCode":"        \"\"\"Return current preset mode.\"\"\"\n        if self._settings.setting_flags.boost_enabled:\n            return PRESET_BOOST\n        if self._settings.is_home_mode:\n            return PRESET_HOME\n        return PRESET_AWAY\n\n    @override\n    async def async_set_temperature(self, **kwargs: Any) -> None:\n        \"\"\"Set new target temperature.\"\"\"\n        temperature = kwargs[ATTR_TEMPERATURE]\n\n        try:\n            if self._settings.is_home_mode:\n                await self.coordinator.client.set_home_temperature(float(temperature))\n            else:\n                await self.coordinator.client.set_away_temperature(float(temperature))\n        except AirobotError as err:\n            raise ServiceValidationError(\n                translation_domain=DOMAIN,\n                translation_key=\"set_temperature_failed\",\n                translation_placeholders={\"temperature\": str(temperature)},\n            ) from err\n\n        await self.coordinator.async_request_refresh()\n\n    @override\n    async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:\n        \"\"\"Set HVAC mode.\n\n        This thermostat only supports HEAT mode. The climate platform validates\n        that only supported modes are passed, so this method is a no-op.\n        \"\"\"\n\n    @override\n    async def async_set_preset_mode(self, preset_mode: str) -> None:\n        \"\"\"Set new preset mode.\"\"\"","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/airobot/climate.py#L124-L160","documentation":"Raised by Airobot climate's async_set_temperature when set_home_temperature or set_away_temperature (chosen by the current mode flag) raises AirobotError. It is a ServiceValidationError with translation key set_temperature_failed, so the set_temperature service call shows a validation-style error naming the rejected temperature value.","triggerScenarios":"Calling climate.set_temperature on an Airobot thermostat entity while the cloud API call fails: value rejected by the device (out of the robot's allowed range), robot offline, or transient cloud error.","commonSituations":"Automation sends a temperature the device refuses, robot loses connectivity mid-command, or the coordinator's cached settings are stale so the home/away branch picks the wrong endpoint.","solutions":["Retry with a value inside the device's supported range (check the vendor app for min/max)","Verify the robot is online and retry after a coordinator refresh","If it fails persistently, reload the integration so settings and auth are refreshed","Check the chained AirobotError in logs to see whether the API rejected the value or the connection failed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Clamp the requested value to the entity's range before calling:\nlo = float(hass.states.get(entity_id).attributes[\"min_temp\"])\nhi = float(hass.states.get(entity_id).attributes[\"max_temp\"])\ntemperature = min(max(temperature, lo), hi)","typeGuard":null,"tryCatchPattern":"from homeassistant.exceptions import ServiceValidationError\n\ntry:\n    await hass.services.async_call(\"climate\", \"set_temperature\", {...}, blocking=True)\nexcept ServiceValidationError as err:\n    _LOGGER.warning(\"Airobot set_temperature rejected: %s\", err)","preventionTips":["Always clamp automation temperature values to the entity's min_temp/max_temp","Refresh coordinator data before sending settings when the robot just came online","Treat repeated failures as connectivity/auth problems, not value problems"],"tags":["airobot","home-assistant","climate","service-validation"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}