Home AssistantHome AssistantContributors
On this page

An entity is the smallest thing in Home Assistant that has a state: one temperature reading, one light, one lock. Users build their automations, dashboards, and voice commands out of entities, so they are the most visible part of any integration you write.

Entities come in domains, like sensor, light, or climate. Each domain is an entity platform: a base class with its own properties, features, and states, that every integration implements in the same way. That shared shape is what makes a light from one brand work exactly like a light from another one, in the interface, in automations, and in voice assistants.

These pages are for developers who build or maintain an integration, or work on an entity platform itself. They assume you know Python and have a development environment running. To learn how an integration sets up its platforms and creates entities in the first place, start with integrations.

How an entity works

  1. Your integration creates entity objects in a platform module, like sensor.py, and passes them to async_add_entities.
  2. Home Assistant registers each entity in the entity registry, links it to its device, and gives it an entity ID.
  3. The entity keeps its data up to date, by polling or push, and writes its state to the state machine.
  4. Users control it through actions, which call methods on your entity, like async_turn_on.
  5. When the integration unloads, the entity is removed, and cleans up after itself.

Basics

Read these first. They apply to every entity, whatever its domain.

Entity platforms

Every platform page has the same structure: what the entity represents, its properties, its supported features, the methods you implement, its states, and an example. Where the frontend shows a domain in its own way, the page links to its more-info view in the Design area.

Sensors and status

  • Sensor: a measured or read value, like a temperature or a power reading.
  • Binary sensor: something that is on or off, like an open door or detected motion.
  • Event: something that happens, like a button press or a doorbell ring.
  • Weather: current conditions and forecasts.
  • Device tracker: where a device is, or whether it is home.
  • Geolocation: events with a location from an external feed.
  • Calendar: events with a start and an end.
  • Air quality: deprecated, use sensors instead.

Lights and climate

Openings and security

Media

  • Media player: speakers, TVs, and receivers.
  • Camera: still images and live streams.
  • Image: a still image that changes now and then.

Remotes and signals

Voice and AI

Appliances

Inputs and helpers

Picking the right platform

Choose the platform that matches what the thing really is, not the one that is easiest to implement. A pump that turns on and off is a switch, but a valve is a valve, and a light is a light, even if both only turn on and off. The right platform gives users the right controls, gives voice assistants the right device type, and gives you the right features as the device grows. Each platform page says when it is, and isn't, the right fit.

If no platform fits, or a platform misses something many devices have, don't work around it with attributes. Propose a change in the architecture discussions first. See proposing changes to an entity model.

Who to talk to

Was this page helpful?

Last updated on .