4.0 KiB
title, description, ha_category, ha_release, ha_quality_scale, ha_domain, ha_codeowners, ha_integration_type
| title | description | ha_category | ha_release | ha_quality_scale | ha_domain | ha_codeowners | ha_integration_type | ||
|---|---|---|---|---|---|---|---|---|---|
| Binary sensor | Instructions on how-to setup binary sensors with Home Assistant. |
|
0.9 | internal | binary_sensor |
|
entity |
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.
{% include integrations/building_block_integration.md %}
Device class
Knowing a sensor is binary impacts how the sensor's current state may be represented in Home Assistant's UI (see Dashboards). Opposing states may be given different icons, colors, and value labels to highlight a particular state over the other. This is set by the binary sensor's device class.
Here are a few examples of this representation in the UI:
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 full list of supported binary sensor device classes is below (note: these may also be modified in the customizing section).
- 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.