Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.binary_sensor Namespace Reference

Namespaces

 device_condition
 
 device_trigger
 
 significant_change
 

Classes

class  BinarySensorDeviceClass
 
class  BinarySensorEntity
 
class  BinarySensorEntityDescription
 

Functions

bool async_setup (HomeAssistant hass, ConfigType config)
 
bool async_setup_entry (HomeAssistant hass, ConfigEntry entry)
 
bool async_unload_entry (HomeAssistant hass, ConfigEntry entry)
 

Variables

 __all__ = all_with_deprecated_constants(globals())
 
 __dir__
 
 __getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
 
 _DEPRECATED_DEVICE_CLASS_BATTERY
 
 _DEPRECATED_DEVICE_CLASS_BATTERY_CHARGING
 
 _DEPRECATED_DEVICE_CLASS_CO
 
 _DEPRECATED_DEVICE_CLASS_COLD
 
 _DEPRECATED_DEVICE_CLASS_CONNECTIVITY
 
 _DEPRECATED_DEVICE_CLASS_DOOR
 
 _DEPRECATED_DEVICE_CLASS_GARAGE_DOOR
 
 _DEPRECATED_DEVICE_CLASS_GAS
 
 _DEPRECATED_DEVICE_CLASS_HEAT
 
 _DEPRECATED_DEVICE_CLASS_LIGHT
 
 _DEPRECATED_DEVICE_CLASS_LOCK
 
 _DEPRECATED_DEVICE_CLASS_MOISTURE
 
 _DEPRECATED_DEVICE_CLASS_MOTION
 
 _DEPRECATED_DEVICE_CLASS_MOVING
 
 _DEPRECATED_DEVICE_CLASS_OCCUPANCY
 
 _DEPRECATED_DEVICE_CLASS_OPENING
 
 _DEPRECATED_DEVICE_CLASS_PLUG
 
 _DEPRECATED_DEVICE_CLASS_POWER
 
 _DEPRECATED_DEVICE_CLASS_PRESENCE
 
 _DEPRECATED_DEVICE_CLASS_PROBLEM
 
 _DEPRECATED_DEVICE_CLASS_RUNNING
 
 _DEPRECATED_DEVICE_CLASS_SAFETY
 
 _DEPRECATED_DEVICE_CLASS_SMOKE
 
 _DEPRECATED_DEVICE_CLASS_SOUND
 
 _DEPRECATED_DEVICE_CLASS_TAMPER
 
 _DEPRECATED_DEVICE_CLASS_UPDATE
 
 _DEPRECATED_DEVICE_CLASS_VIBRATION
 
 _DEPRECATED_DEVICE_CLASS_WINDOW
 
 _LOGGER = logging.getLogger(__name__)
 
dictionary CACHED_PROPERTIES_WITH_ATTR_
 
list DEVICE_CLASSES = [cls.value for cls in BinarySensorDeviceClass]
 
 DEVICE_CLASSES_SCHEMA = vol.All(vol.Lower, vol.Coerce(BinarySensorDeviceClass))
 
string DOMAIN = "binary_sensor"
 
string ENTITY_ID_FORMAT = DOMAIN + ".{}"
 
 PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA
 
 PLATFORM_SCHEMA_BASE = cv.PLATFORM_SCHEMA_BASE
 
 SCAN_INTERVAL = timedelta(seconds=30)
 

Detailed Description

Component to interface with binary sensors.

Function Documentation

◆ async_setup()

bool homeassistant.components.binary_sensor.async_setup ( HomeAssistant  hass,
ConfigType  config 
)
Track states and offer events for binary sensors.

Definition at line 221 of file __init__.py.

◆ async_setup_entry()

bool homeassistant.components.binary_sensor.async_setup_entry ( HomeAssistant  hass,
ConfigEntry  entry 
)
Set up a config entry.

Definition at line 231 of file __init__.py.

◆ async_unload_entry()

bool homeassistant.components.binary_sensor.async_unload_entry ( HomeAssistant  hass,
ConfigEntry  entry 
)
Unload a config entry.

Definition at line 236 of file __init__.py.

Variable Documentation

◆ __all__

homeassistant.components.binary_sensor.__all__ = all_with_deprecated_constants(globals())
private

Definition at line 304 of file __init__.py.

◆ __dir__

homeassistant.components.binary_sensor.__dir__
private
Initial value:
1 = partial(
2  dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
3 )

Definition at line 301 of file __init__.py.

◆ __getattr__

homeassistant.components.binary_sensor.__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
private

Definition at line 300 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_BATTERY

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_BATTERY
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.BATTERY, "2025.1"
3 )

Definition at line 133 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_BATTERY_CHARGING

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_BATTERY_CHARGING
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.BATTERY_CHARGING, "2025.1"
3 )

Definition at line 136 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_CO

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_CO
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.CO, "2025.1"
3 )

Definition at line 139 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_COLD

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_COLD
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.COLD, "2025.1"
3 )

Definition at line 142 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_CONNECTIVITY

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_CONNECTIVITY
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.CONNECTIVITY, "2025.1"
3 )

Definition at line 145 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_DOOR

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_DOOR
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.DOOR, "2025.1"
3 )

Definition at line 148 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_GARAGE_DOOR

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_GARAGE_DOOR
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.GARAGE_DOOR, "2025.1"
3 )

Definition at line 151 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_GAS

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_GAS
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.GAS, "2025.1"
3 )

Definition at line 154 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_HEAT

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_HEAT
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.HEAT, "2025.1"
3 )

Definition at line 157 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_LIGHT

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_LIGHT
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.LIGHT, "2025.1"
3 )

Definition at line 160 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_LOCK

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_LOCK
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.LOCK, "2025.1"
3 )

Definition at line 163 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_MOISTURE

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_MOISTURE
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.MOISTURE, "2025.1"
3 )

Definition at line 166 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_MOTION

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_MOTION
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.MOTION, "2025.1"
3 )

Definition at line 169 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_MOVING

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_MOVING
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.MOVING, "2025.1"
3 )

Definition at line 172 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_OCCUPANCY

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_OCCUPANCY
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.OCCUPANCY, "2025.1"
3 )

Definition at line 175 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_OPENING

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_OPENING
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.OPENING, "2025.1"
3 )

Definition at line 178 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_PLUG

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_PLUG
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.PLUG, "2025.1"
3 )

Definition at line 181 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_POWER

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_POWER
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.POWER, "2025.1"
3 )

Definition at line 184 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_PRESENCE

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_PRESENCE
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.PRESENCE, "2025.1"
3 )

Definition at line 187 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_PROBLEM

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_PROBLEM
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.PROBLEM, "2025.1"
3 )

Definition at line 190 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_RUNNING

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_RUNNING
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.RUNNING, "2025.1"
3 )

Definition at line 193 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_SAFETY

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_SAFETY
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.SAFETY, "2025.1"
3 )

Definition at line 196 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_SMOKE

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_SMOKE
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.SMOKE, "2025.1"
3 )

Definition at line 199 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_SOUND

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_SOUND
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.SOUND, "2025.1"
3 )

Definition at line 202 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_TAMPER

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_TAMPER
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.TAMPER, "2025.1"
3 )

Definition at line 205 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_UPDATE

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_UPDATE
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.UPDATE, "2025.1"
3 )

Definition at line 208 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_VIBRATION

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_VIBRATION
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.VIBRATION, "2025.1"
3 )

Definition at line 211 of file __init__.py.

◆ _DEPRECATED_DEVICE_CLASS_WINDOW

homeassistant.components.binary_sensor._DEPRECATED_DEVICE_CLASS_WINDOW
private
Initial value:
1 = DeprecatedConstantEnum(
2  BinarySensorDeviceClass.WINDOW, "2025.1"
3 )

Definition at line 214 of file __init__.py.

◆ _LOGGER

homeassistant.components.binary_sensor._LOGGER = logging.getLogger(__name__)
private

Definition at line 30 of file __init__.py.

◆ CACHED_PROPERTIES_WITH_ATTR_

dictionary homeassistant.components.binary_sensor.CACHED_PROPERTIES_WITH_ATTR_
Initial value:
1 = {
2  "device_class",
3  "is_on",
4 }

Definition at line 247 of file __init__.py.

◆ DEVICE_CLASSES

list homeassistant.components.binary_sensor.DEVICE_CLASSES = [cls.value for cls in BinarySensorDeviceClass]

Definition at line 132 of file __init__.py.

◆ DEVICE_CLASSES_SCHEMA

homeassistant.components.binary_sensor.DEVICE_CLASSES_SCHEMA = vol.All(vol.Lower, vol.Coerce(BinarySensorDeviceClass))

Definition at line 128 of file __init__.py.

◆ DOMAIN

string homeassistant.components.binary_sensor.DOMAIN = "binary_sensor"

Definition at line 32 of file __init__.py.

◆ ENTITY_ID_FORMAT

string homeassistant.components.binary_sensor.ENTITY_ID_FORMAT = DOMAIN + ".{}"

Definition at line 34 of file __init__.py.

◆ PLATFORM_SCHEMA

homeassistant.components.binary_sensor.PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA

Definition at line 35 of file __init__.py.

◆ PLATFORM_SCHEMA_BASE

homeassistant.components.binary_sensor.PLATFORM_SCHEMA_BASE = cv.PLATFORM_SCHEMA_BASE

Definition at line 36 of file __init__.py.

◆ SCAN_INTERVAL

homeassistant.components.binary_sensor.SCAN_INTERVAL = timedelta(seconds=30)

Definition at line 37 of file __init__.py.