Skip to main content

Number Entity

A number is an entity that allows the user to input an arbitrary value to an integration. Derive entity platforms from homeassistant.components.number.NumberEntity



Properties should always only return information from memory and not do I/O (like network requests). Implement update() or async_update() to fetch data.

device_classstringNoneType of number.
modestringautoDefines how the number should be displayed in the UI. It's recommended to use the default auto. Can be box or slider to force a display mode.
native_max_valuefloat100The maximum accepted value in the number's native_unit_of_measurement (inclusive)
native_min_valuefloat0The minimum accepted value in the number's native_unit_of_measurement (inclusive)
native_stepfloatSee belowDefines the resolution of the values, i.e. the smallest increment or decrement in the number's
native_valuefloatRequiredThe value of the number in the number's native_unit_of_measurement.


Other properties that are common to all entities such as icon, name etc are also applicable.

The default step value is dynamically chosen based on the range (max - min) values. If the difference between max_value and min_value is greater than 1.0, then the default step is 1.0. If, however, the range is smaller, then the step is iteratively divided by 10 until it becomes lower than the range.

Available device classes

If specifying a device class, your number entity will need to also return the correct unit of measurement.

TypeSupported unitsDescription
temperature°C, °FTemperature.

Restoring number states

Numbers which restore the state after restart or reload should not extend RestoreEntity because that does not store the native_value, but instead the state which may have been modifed by the number base entity. Numbers which restore the state should extend RestoreNumber and call await self.async_get_last_number_data from async_added_to_hass to get access to the stored native_min_value, native_max_value, native_step, native_unit_of_measurement and native_value.


Set value

Called when the user or an automation wants to update the value.

class MyNumber(NumberEntity):
# Implement one of these methods.

def set_native_value(self, value: float) -> None:
"""Update the current value."""

async def async_set_native_value(self, value: float) -> None:
"""Update the current value."""