Helpers

Attribute as sensor

The attribute as sensor helper turns one attribute of an entity into a sensor of its own, with a unit, a device class and long-term statistics, without writing a template.

The attribute as sensor helper turns one attribute of an entity into a sensor of its own. The temperature a thermostat is set to, the battery level a phone reports on its tracker, or the setpoint a schedule wants right now. Things you can see in the entity's attributes, but cannot put in a graph, or keep statistics for.

Usually, that takes a template sensor. This helper does it without one.

Creating an attribute as sensor helper

Add one directly to your own instance by selecting the My Home Assistant button below:

Or add one by hand:

  1. Go to Settings > Devices & services, and select the Helpers tab.
  2. Select + Create helper.
  3. Search for attribute, and select Attribute as sensor 👻.
  4. Give it a Name, like "Living room setpoint".
  5. Under Source entity, pick the entity that has the attribute. Any entity works.
  6. Select Next.
The attribute as sensor helper dialog, filled in with a name and the living room thermostat as the source entity.
  1. Under Attribute, pick the attribute. The list shows the attributes the source has right now.
  2. Optionally, pick a Device class, a State class and a Unit of measurement. What they do is explained below.
The second step of the attribute as sensor helper, with the temperature attribute picked, as a temperature in degrees Celsius, with the measurement state class.
  1. Select Submit. Done! 🎉

Changed your mind later? Open the helper from the Helpers tab, and change the attribute, device class, state class or unit in its options. The source entity stays: another entity has other attributes. Want a different source? Create a new helper.

How it works

The helper is a sensor that holds the value of the attribute, and follows it as it changes. It is added to the same device as the source.

The dialog of the living room setpoint sensor, showing the temperature the thermostat is set to, with its history below.
The thermostat's setpoint, as a sensor of its own.
  • Unavailable: when the source is unavailable or missing, or does not have the attribute. The helper does not make up a value.
  • Unknown: when the attribute is there, but empty.
  • Renamed source: the helper follows it, and keeps working under the new name.
  • Removed source: the helper is removed with it. An attribute of an entity that is gone is nothing at all.

Text or a number

What the sensor holds depends on what you filled in.

Nothing but the attribute: the sensor holds the attribute as it is. Text, like heating from a thermostat's hvac_action, a number, true or false, or a moment. An attribute holding a list or a group of values, like hvac_modes, has no one way to be shown as a state, so the sensor is unavailable. The same goes for text longer than 255 characters, the most a state can hold.

A unit, a device class or a state class: the sensor holds a number. An attribute holding a number written as text, like "21.5", counts. Anything else makes the sensor unavailable, until the attribute holds a number again.

State class: pick one, and Home Assistant keeps long-term statistics for the sensor. Graphs over months, and the statistics card, work for it like for any other sensor. Pick Measurement for a value that goes up and down, like a temperature. Pick Total increasing for a meter that only counts up.

Timestamp or date as device class: the sensor holds a moment, or a day. The attribute may hold a moment, or one written as text, like 2026-12-24T07:00:00+01:00. A moment without a time zone could be any of 24, and makes the sensor unavailable. A moment, a date and a state class do not go together, and neither does a unit.

The helper refuses a unit or a state class that does not go with the device class, like kWh for a temperature. The Enum device class is not on offer: it needs a list of every possible value up front, and an attribute does not come with one.

The schedule's setpoint

A schedule helper can carry data for each block of time, like the temperature the heating should be at. That data shows up as attributes of the schedule, for the block that is on right now. Home Assistant keeps no history of them. Make the attribute a sensor, with Temperature as device class and Measurement as state class, and the temperature the schedule wants right now is a sensor with a history, that you can graph and use in a thermostat automation.

Between two blocks, the schedule is off and the data is gone. So is the value: the sensor is unavailable until the next block starts.

The schedule's next_event attribute works too: pick Timestamp as device class, and you have a sensor telling when the schedule changes next.

Attributes

AttributeDescription
entity_idThe source entity.
attributeThe attribute of the source it holds.