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.
native_unit_of_measurementstringNoneThe unit of measurement that the sensor's value is expressed in. If the native_unit_of_measurement is °C or °F, and its device_class is temperature, the sensor's unit_of_measurement will be the preferred temperature unit configured by the user and the sensor's state will be the native_value after an optional unit conversion.

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.

ConstantSupported unitsDescription
NumberDeviceClass.APPARANT_POWERVAApparent power
NumberDeviceClass.AQINoneAir Quality Index
NumberDeviceClass.ATMOSPHERIC_PRESSUREcbar, bar, hPa, inHg, kPa, mbar, Pa, psiAtmospheric pressure, statistics will be stored in Pa.
NumberDeviceClass.BATTERY%Percentage of battery that is left
NumberDeviceClass.CARBON_DIOXIDEppmConcentration of carbon dioxide.
NumberDeviceClass.CARBON_MONOXIDEppmConcentration of carbon monoxide.
NumberDeviceClass.CURRENTA, mACurrent
NumberDeviceClass.DATA_RATEbit/s, kbit/s, Mbit/s, Gbit/s, B/s, kB/s, MB/s, GB/s, KiB/s, MiB/s, GiB/sData rate
NumberDeviceClass.DATA_SIZEbit, kbit, Mbit, Gbit, B, kB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiBData size
NumberDeviceClass.DISTANCEkm, m, cm, mm, mi, yd, inGeneric distance
NumberDeviceClass.ENERGYWh, kWh, MWh, MJ, GJEnergy, this device class should used to represent energy consumption, for example an electricity meter. Represents power over time. Not to be confused with power.
NumberDeviceClass.ENERGY_STORAGEWh, kWh, MWh, MJ, GJStored energy, this device class should be used to represent stored energy, for example the amount of electric energy currently stored in a battery or the capacity of a battery. Represents power over time. Not to be confused with power.
NumberDeviceClass.FREQUENCYHz, kHz, MHz, GHzFrequency
NumberDeviceClass.GASm³, ft³, CCFVolume of gas. Gas consumption measured as energy in kWh instead of a volume should be classified as energy.
NumberDeviceClass.HUMIDITY%Relative humidity
NumberDeviceClass.ILLUMINANCElxLight level
NumberDeviceClass.IRRADIANCEW/m², BTU/(h⋅ft²)Irradiance
NumberDeviceClass.MONETARYISO 4217Monetary value with a currency.
NumberDeviceClass.NITROGEN_DIOXIDEµg/m³Concentration of nitrogen dioxide
NumberDeviceClass.NITROGEN_MONOXIDEµg/m³Concentration of nitrogen monoxide
NumberDeviceClass.NITROUS_OXIDEµg/m³Concentration of nitrous oxide
NumberDeviceClass.OZONEµg/m³Concentration of ozone
NumberDeviceClass.PM1µg/m³Concentration of particulate matter less than 1 micrometer
NumberDeviceClass.PM25µg/m³Concentration of particulate matter less than 2.5 micrometers
NumberDeviceClass.PM10µg/m³Concentration of particulate matter less than 10 micrometers
NumberDeviceClass.POWERW, kWPower.
NumberDeviceClass.POWER_FACTOR%, NonePower Factor
NumberDeviceClass.PRECIPITATIONcm, in, mmPrecipitation
NumberDeviceClass.PRECIPITATION_INTENSITYin/d, in/h, mm/d, mm/hPrecipitation intensity
NumberDeviceClass.PRESSUREcbar, bar, hPa, inHg, kPa, mbar, Pa, psiPressure.
NumberDeviceClass.REACTIVE_POWERvarReactive power
NumberDeviceClass.SIGNAL_STRENGTHdB, dBmSignal strength
NumberDeviceClass.SOUND_PRESSUREdB, dBASound pressure
NumberDeviceClass.SPEEDft/s, in/d, in/h, km/h, kn, m/s, mph, mm/dGeneric speed
NumberDeviceClass.SULPHUR_DIOXIDEµg/m³Concentration of sulphure dioxide
NumberDeviceClass.TEMPERATURE°C, °F, KTemperature.
NumberDeviceClass.VOLATILE_ORGANIC_COMPOUNDSµg/m³Concentration of volatile organic compounds
NumberDeviceClass.VOLTAGEV, mVVoltage
NumberDeviceClass.VOLUMEL, mL, gal, fl. oz., m³, ft³, CCFGeneric volume, this device class should be used to represent a consumption, for example the amount of fuel consumed by a vehicle.
NumberDeviceClass.VOLUME_STORAGEL, mL, gal, fl. oz., m³, ft³, CCFGeneric stored volume, this device class should be used to represent a stored volume, for example the amount of fuel in a fuel tank.
NumberDeviceClass.WATERL, gal, m³, ft³, CCFWater consumption
NumberDeviceClass.WEIGHTkg, g, mg, µg, oz, lb, stGeneric mass; weight is used instead of mass to fit with every day language.
NumberDeviceClass.WIND_SPEEDft/s, km/h, kn, m/s, mphWind speed

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."""