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_class attribute of the entity. Use the stored value, such as temperature. 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.