home-assistant/core · error · ServiceValidationError

Failed to set value.

Error message

Failed to set value.

What it means

Raised by the Airobot number entity's async_set_native_value when entity_description.set_value_fn raises any AirobotError. ServiceValidationError with translation key set_value_failed stops the service call with a clean message; the coordinator refresh only runs on success (else branch).

Source

Thrown at homeassistant/components/airobot/number.py:94

    ) -> None:
        """Initialize the number entity."""
        super().__init__(coordinator)
        self.entity_description = description
        self._attr_unique_id = f"{coordinator.data.status.device_id}_{description.key}"

    @property
    @override
    def native_value(self) -> float:
        """Return the current value."""
        return self.entity_description.value_fn(self.coordinator)

    @override
    async def async_set_native_value(self, value: float) -> None:
        """Set the value."""
        try:
            await self.entity_description.set_value_fn(self.coordinator, value)
        except AirobotError as err:
            raise ServiceValidationError(
                translation_domain=DOMAIN,
                translation_key="set_value_failed",
            ) from err
        else:
            await self.coordinator.async_request_refresh()

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Retry with a value within the entity's min/max (check native_min_value/native_max_value)
  2. Confirm the robot is online
  3. Reload the integration if auth may have expired (coordinator will surface reauth separately)
  4. Check the chained AirobotError in logs for the exact API reason
Defensive patterns

Strategy: validation

Validate before calling

attrs = hass.states.get(entity_id).attributes
value = min(max(value, attrs["min"]), attrs["max"])  # native min/max attrs

Try / catch

from homeassistant.exceptions import ServiceValidationError

try:
    await hass.services.async_call("number", "set_value", {...}, blocking=True)
except ServiceValidationError as err:
    _LOGGER.warning("Airobot set_value rejected: %s", err)

Prevention

When it happens

Trigger: Setting a numeric configuration (e.g. target temperatures/settings values) via number.set_value when the cloud API rejects the value or the connection fails — out-of-range value for the device, robot offline, or transient error.

Common situations: Slider set beyond what the robot accepts, commands during robot downtime, or stale auth (AirobotError parent class also covers auth failures caught generically here).

Related errors


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