Binary sensor
Binary sensors are similar to other sensors in that they
monitor the states and conditions of different entities. Where binary sensors
differ is they can only return one of two mutually exclusive values.
For example, a binary sensor for a window may report a value
of open or closed, a switch on or off, a condition true or false.
This either/or constraint is what makes these sensors binary. They are digital in nature, whereas analog sensors, like temperature and weight sensors, return a range of values.
Some binary sensors are created automatically when you add a device integration. For example, adding the ecobee integration will create a binary sensor to detect room occupancy. Other binary sensors can be created manually using the template integration or using an input boolean helper.
Building block integration
This binary sensor is a building block integration that cannot be added to your Home Assistant directly but is used and provided by other integrations.
A building block integration differs from the typical integration that connects to a device or service. Instead, other integrations that do integrate a device or service into Home Assistant use this binary sensor building block to provide entities, services, and other functionality that you can use in your automations or dashboards.
If one of your integrations features this building block, this page documents the functionality the binary sensor building block offers.
The state of binary sensor
A binary sensor can have two states: on or off. However, in the frontend, they might not be called on or off, but use an alternative term to be more meaningful in context. For example, hot/cold, locked/unlocked. The meaning of an on or off state depends on the device class.
In addition, the entity can have the following states:
- Unavailable: The entity is currently unavailable.
- Unknown: The state is not yet known.
Device class
A device class is a measurement categorization in Home Assistant. It influences how the entity is represented in the dashboard. This can be modified in the customize section. For example, different states may be represented by different icons, colors, or text.
The screenshot shows a few examples of different device classes for binary sensors:
![]()
Example of various device classes icons in on and off state. The on image
in this example has state_color: true specified in the entities card
configuration to receive the icon coloring.
The following device classes are supported for binary sensors:
- None: Generic on/off. This is the default and doesn’t need to be set.
-
battery:
onmeans low,offmeans normal -
battery_charging:
onmeans charging,offmeans not charging -
carbon_monoxide:
onmeans carbon monoxide detected,offno carbon monoxide (clear) -
cold:
onmeans cold,offmeans normal -
connectivity:
onmeans connected,offmeans disconnected -
door:
onmeans open,offmeans closed -
garage_door:
onmeans open,offmeans closed -
gas:
onmeans gas detected,offmeans no gas (clear) -
heat:
onmeans hot,offmeans normal -
light:
onmeans light detected,offmeans no light -
lock:
onmeans open (unlocked),offmeans closed (locked) -
moisture:
onmeans moisture detected (wet),offmeans no moisture (dry) -
motion:
onmeans motion detected,offmeans no motion (clear) -
moving:
onmeans moving,offmeans not moving (stopped) -
occupancy:
onmeans occupied (detected),offmeans not occupied (clear) -
opening:
onmeans open,offmeans closed -
plug:
onmeans device is plugged in,offmeans device is unplugged -
power:
onmeans power detected,offmeans no power -
presence:
onmeans home,offmeans away -
problem:
onmeans problem detected,offmeans no problem (OK) -
running:
onmeans running,offmeans not running -
safety:
onmeans unsafe,offmeans safe -
smoke:
onmeans smoke detected,offmeans no smoke (clear) -
sound:
onmeans sound detected,offmeans no sound (clear) -
tamper:
onmeans tampering detected,offmeans no tampering (clear) -
update:
onmeans update available,offmeans up-to-date -
vibration:
onmeans vibration detected,offmeans no vibration (clear) -
window:
onmeans open,offmeans closed
For comparison, here are the device classes for analog sensors.