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

tip

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

NameTypeDefaultDescription
valuefloatRequiredCurrent value of the entity
min_valuefloat0The minimum accepted value (inclusive)
max_valuefloat100The maximum accepted value (inclusive)
stepfloatSee belowDefines the resolution of the values, i.e. the smallest increment or decrement
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.

Other properties that are common to all entities such as icon, unit_of_measurement, 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.

Methods

Set value

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

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

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

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