Sensor
Sensors are a basic integration in Home Assistant. They monitor the states and conditions of a variety of entities. An entity can be many things. This can include a physical device like a motion sensor that reports the battery level, a web service that retrieves the weather temperature, a built-in function that calculates the sun’s elevation relative to your GPS position, or even a custom sensor you may have created to report the free space on your laptop. These are all things reporting different types of information.
Some of these sensors are built-in to Home Assistant, some are created automatically when you add an integration (see this list), and some can be created manually. The Statistics and Template sensors are two examples of the last case.
Sensor states
The stateThe state holds the information of interest of an entity, for example, if a light is on or off. Each entity has exactly one state and the state only holds one value at a time. However, entities can store attributes related to that state such as brightness, color, or a unit of measurement. [Learn more] of a sensor entity is its current value. The type of sensor determines how Home Assistant stores the value and how the interface shows it:
- Numeric sensors store the number without its unit, for example,
21.5. The interface shows the number in your local number format, with its unit if it has one, for example, 21.5 °C. - Timestamp sensors store the date and time in UTC, for example,
2026-01-01T12:00:00+00:00. The interface shows it in your local date and time format. - Other sensors store text. If the integration translates the possible values, the interface shows the translated label instead of the stored text.
In addition, the entity can have the following states. Each item shows the interface label, followed by the stored state:
-
Unavailable (
unavailable): The entity is currently unavailable. -
Unknown (
unknown): The state is not yet known.
State class
The state class tells Home Assistant what kind of value a sensor has. Home Assistant uses it mainly to keep long-term statisticsHome Assistant keeps statistics for sensors that have a state class, such as measurement, total, or total increasing. Every 5 minutes, it saves short-term statistics, which are deleted after 10 days by default. Every hour, it saves long-term statistics, which are never deleted automatically. The Energy dashboard and statistics cards use them. [Learn more] for the sensor, which you see, for example, in the Energy dashboard and in statistic cards.
Not every sensor has a state class. A sensor with a state class must have a number as its state, so a sensor that shows text or a date doesn’t have one. A sensor without a state class has no long-term statistics.
The integration that provides the sensor usually sets the state class. There are four state classes:
- Measurement: A value right now, for example, a temperature or the current power use.
- Measurement angle: An angle right now, in degrees, for example, the wind direction.
- Total: An amount that can go up and down, for example, the energy you put into and take out of a home battery.
- Total increasing: An amount that only goes up, except when it’s reset, for example, an energy meter.
Device class
The device class tells Home Assistant what a sensor measures, such as temperature or energy. Home Assistant uses the device class to choose the icon, the unit, and how the value is shown. The device class also decides where you can use the sensor, such as in triggers and conditions, on the energy dashboard, or as the temperature sensor of an area. If a sensor doesn’t show up where you expect it, check its device class.
The integration that provides the sensor sets the device class. When you create a sensor yourself, for example with a template helper, you choose the device class.
Device classes in automations and templates
- Automations: Some device classes have their own triggers and conditions, such as Temperature changed. Of your sensors, these triggers and conditions only list the ones with that device class. The list below shows the triggers and conditions of each device class.
- Templates: The device class is the
device_classattribute of the entity. Use the stored value, such astemperature. For example, you can find entities by device class.
List of available device classes
A sensor without a device class is a generic sensor.
Each item shows the name you see in the Home Assistant interface, followed by the device class as Home Assistant stores it. The description lists the units the device class supports. If the device class has its own triggers and conditions, they’re listed below the item.
-
Absolute humidity (
absolute_humidity): Amount of water vapor in the air, in g/m³ or mg/m³. -
Apparent power (
apparent_power): Apparent power, in mVA, VA, or kVA. -
Air quality index (
aqi): Air quality index, without a unit. -
Area (
area): Area, in m², cm², km², mm², in², ft², yd², mi², ac, or ha. -
Atmospheric pressure (
atmospheric_pressure): Atmospheric pressure, in mPa, Pa, hPa, kPa, bar, cbar, mbar, mmHg, inHg, inH₂O, or psi. -
Battery (
battery): Battery level, in %.- Triggers: Battery level changed, Battery level crossed threshold
- Condition: Battery level
-
Blood glucose concentration (
blood_glucose_concentration): Blood glucose concentration, in mg/dL or mmol/L. -
Carbon dioxide (
carbon_dioxide): Carbon dioxide (CO₂) concentration, in ppm.- Triggers: Carbon dioxide level changed, Carbon dioxide level crossed threshold
- Condition: Carbon dioxide value
-
Carbon monoxide (
carbon_monoxide): Carbon monoxide (CO) concentration, in ppb, ppm, μg/m³, or mg/m³.- Triggers: Carbon monoxide level changed, Carbon monoxide level crossed threshold
- Condition: Carbon monoxide value
-
Conductivity (
conductivity): Electrical conductivity, in S/cm, mS/cm, or μS/cm. -
Current (
current): Electric current, in A, mA, or μA. -
Data rate (
data_rate): Data rate, in bit/s, kbit/s, Mbit/s, Gbit/s, B/s, kB/s, MB/s, GB/s, KiB/s, MiB/s, or GiB/s. -
Data size (
data_size): Data size, in bit, kbit, Mbit, Gbit, B, kB, MB, GB, TB, PB, EB, ZB, YB, KiB, MiB, GiB, TiB, PiB, EiB, ZiB, or YiB. -
Date (
date): A date. -
Distance (
distance): Distance, in km, m, cm, mm, mi, nmi, yd, ft, or in. -
Duration (
duration): Duration, in d, h, min, s, ms, or μs. -
Energy (
energy): Energy, in J, kJ, MJ, GJ, mWh, Wh, kWh, MWh, GWh, TWh, cal, kcal, Mcal, or Gcal. -
Energy per distance (
energy_distance): Energy used per distance, in kWh/100km, Wh/km, mi/kWh, or km/kWh. -
Stored energy (
energy_storage): Stored energy, such as in a battery, in J, kJ, MJ, GJ, mWh, Wh, kWh, MWh, GWh, TWh, cal, kcal, Mcal, or Gcal. -
Sensor (
enum): A sensor with a fixed list of possible text states. -
Frequency (
frequency): Frequency, in mHz, Hz, kHz, MHz, or GHz. -
Gas (
gas): Gas volume, in L, m³, ft³, CCF, or MCF. -
Humidity (
humidity): Relative humidity of the air, in %.- Triggers: Relative humidity changed, Relative humidity crossed threshold
- Condition: Relative humidity
-
Illuminance (
illuminance): Light level, in lx.- Triggers: Illuminance changed, Illuminance crossed threshold
- Condition: Illuminance
-
Irradiance (
irradiance): Irradiance, such as the power of sunlight on a surface, in W/m² or BTU/(h⋅ft²). -
Moisture (
moisture): Water content of a substance, such as soil, in %.- Triggers: Moisture content changed, Moisture content crossed threshold
- Condition: Moisture level
-
Monetary balance (
monetary): An amount of money, in a currency from ISO 4217. -
Nitrogen dioxide (
nitrogen_dioxide): Nitrogen dioxide concentration, in ppb, ppm, or μg/m³.- Triggers: Nitrogen dioxide level changed, Nitrogen dioxide level crossed threshold
- Condition: Nitrogen dioxide value
-
Nitrogen monoxide (
nitrogen_monoxide): Nitrogen monoxide concentration, in ppb or μg/m³.- Triggers: Nitrogen monoxide level changed, Nitrogen monoxide level crossed threshold
- Condition: Nitrogen monoxide value
-
Nitrous oxide (
nitrous_oxide): Nitrous oxide concentration, in μg/m³.- Triggers: Nitrous oxide level changed, Nitrous oxide level crossed threshold
- Condition: Nitrous oxide value
-
Ozone (
ozone): Ozone concentration, in ppb, ppm, or μg/m³.- Triggers: Ozone level changed, Ozone level crossed threshold
- Condition: Ozone value
-
pH (
ph): pH value of a water solution, without a unit. -
PM1 (
pm1): Concentration of particulate matter smaller than 1 micrometer, in μg/m³.- Triggers: PM1 level changed, PM1 level crossed threshold
- Condition: PM1 value
-
PM2.5 (
pm25): Concentration of particulate matter smaller than 2.5 micrometers, in μg/m³.- Triggers: PM2.5 level changed, PM2.5 level crossed threshold
- Condition: PM2.5 value
-
PM4 (
pm4): Concentration of particulate matter smaller than 4 micrometers, in μg/m³.- Triggers: PM4 level changed, PM4 level crossed threshold
- Condition: PM4 value
-
PM10 (
pm10): Concentration of particulate matter smaller than 10 micrometers, in μg/m³.- Triggers: PM10 level changed, PM10 level crossed threshold
- Condition: PM10 value
-
Power factor (
power_factor): Power factor, without a unit or in %. -
Power (
power): Power, in mW, W, kW, MW, GW, or TW.- Triggers: Power changed, Power crossed threshold
- Condition: Power value
-
Precipitation (
precipitation): Accumulated precipitation, in cm, in, or mm. -
Precipitation intensity (
precipitation_intensity): Precipitation intensity, in in/d, in/h, mm/d, or mm/h. -
Pressure (
pressure): Pressure, in mPa, Pa, hPa, kPa, bar, cbar, mbar, mmHg, inHg, inH₂O, or psi. -
Radon (
radon): Radon concentration, in Bq/m³ or pCi/L. -
Reactive energy (
reactive_energy): Reactive energy, in varh or kvarh. -
Reactive power (
reactive_power): Reactive power, in mvar, var, or kvar. -
Signal strength (
signal_strength): Signal strength, in dB or dBm. -
Sound pressure (
sound_pressure): Sound pressure, in dB or dBA. -
Speed (
speed): Speed, in Beaufort, ft/s, in/d, in/h, in/s, km/h, kn, m/min, m/s, mph, mm/d, mm/h, or mm/s. -
Sulphur dioxide (
sulphur_dioxide): Sulfur dioxide concentration, in ppb or μg/m³.- Triggers: Sulphur dioxide level changed, Sulphur dioxide level crossed threshold
- Condition: Sulphur dioxide value
-
Temperature (
temperature): Temperature, in °C, °F, or K.- Triggers: Temperature changed, Temperature crossed threshold
- Condition: Temperature value
-
Temperature delta (
temperature_delta): Difference between two temperatures, in °C, °F, or K. -
Timestamp (
timestamp): A date and time, such as when something happened.- Trigger: Time
-
Uptime (
uptime): The date and time a device last started. -
Volatile organic compounds (
volatile_organic_compounds): Concentration of volatile organic compounds, in μg/m³ or mg/m³. -
Volatile organic compounds parts (
volatile_organic_compounds_parts): Ratio of volatile organic compounds, in ppm or ppb. -
Voltage (
voltage): Voltage, in V, mV, μV, kV, or MV. -
Volume (
volume): Volume, in L, mL, gal, fl. oz., m³, ft³, CCF, or MCF. -
Volume flow rate (
volume_flow_rate): Volume flow rate, in m³/h, m³/min, m³/s, ft³/min, L/h, L/min, L/s, gal/d, gal/h, gal/min, or mL/s. -
Stored volume (
volume_storage): Stored volume, such as in a tank, in L, mL, gal, fl. oz., m³, ft³, CCF, or MCF. -
Water (
water): Water consumption, in L, gal, m³, ft³, CCF, or MCF. -
Weight (
weight): Weight, in kg, g, mg, μg, oz, lb, or st. -
Wind direction (
wind_direction): Wind direction, in °. -
Wind speed (
wind_speed): Wind speed, in Beaufort, ft/s, in/s, km/h, kn, m/min, m/s, mm/s, or mph.