Skip to content

Binary Sensor Types

This page lists all binary sensor types supported by the BTHome component. Each type represents an on/off state.

All binary sensors use a single byte: 0x00 = off/false, 0x01 = on/true.

TypeObject IDOff StateOn StateUse Case
generic_boolean0x0FOffOnGeneric on/off
power0x10OffOnPower state
opening0x11ClosedOpenGeneric opening
battery_low0x15NormalLowBattery warning
battery_charging0x16Not chargingChargingCharging state
carbon_monoxide0x17ClearDetectedCO detector
cold0x18NormalColdCold alert
connectivity0x19DisconnectedConnectedConnection state
door0x1AClosedOpenDoor sensor
garage_door0x1BClosedOpenGarage door
gas0x1CClearDetectedGas detector
heat0x1DNormalHotHeat alert
light0x1ENo lightLightLight detector
lock0x1FLockedUnlockedLock state
moisture_binary0x20DryWetWater leak
motion0x21ClearDetectedMotion sensor
moving0x22Not movingMovingMovement
occupancy0x23ClearDetectedOccupancy
plug0x24UnpluggedPlugged inPlug state
presence0x25AwayHomePresence
problem0x26OKProblemProblem indicator
running0x27Not runningRunningRunning state
safety0x28UnsafeSafeSafety state
smoke0x29ClearDetectedSmoke detector
sound0x2AClearDetectedSound detector
tamper0x2BOffOnTamper alert
vibration0x2CClearDetectedVibration
window0x2DClosedOpenWindow sensor
bthome:
binary_sensors:
- type: motion # PIR motion detector
id: pir_sensor
advertise_immediately: true
- type: door # Door contact
id: door_sensor
advertise_immediately: true
- type: window # Window contact
id: window_sensor
advertise_immediately: true
- type: tamper # Tamper switch
id: tamper_sensor
advertise_immediately: true
bthome:
binary_sensors:
- type: smoke # Smoke detector
id: smoke_sensor
advertise_immediately: true
- type: carbon_monoxide # CO detector
id: co_sensor
advertise_immediately: true
- type: gas # Gas leak detector
id: gas_sensor
advertise_immediately: true
- type: moisture_binary # Water leak
id: water_sensor
advertise_immediately: true
bthome:
binary_sensors:
- type: light # Light/dark detection
id: light_sensor
- type: occupancy # Room occupancy
id: occupancy_sensor
- type: presence # Home/away
id: presence_sensor
bthome:
binary_sensors:
- type: power # Device power
id: power_state
- type: plug # Plug connected
id: plug_state
- type: battery_low # Low battery warning
id: battery_low
- type: battery_charging # Charging indicator
id: charging
binary_sensor:
- platform: gpio
pin:
number: GPIO5
mode: INPUT_PULLUP
id: front_door
name: "Front Door"
device_class: door
- platform: gpio
pin:
number: GPIO6
mode: INPUT_PULLUP
id: back_window
name: "Back Window"
device_class: window
bthome:
binary_sensors:
- type: door
id: front_door
advertise_immediately: true
- type: window
id: back_window
advertise_immediately: true
binary_sensor:
- platform: gpio
pin: GPIO4
id: pir_motion
name: "Motion"
device_class: motion
filters:
- delayed_off: 30s
- platform: template
id: room_occupied
name: "Room Occupied"
device_class: occupancy
lambda: return id(pir_motion).state;
filters:
- delayed_off: 5min # Stay occupied for 5 min after last motion
bthome:
binary_sensors:
- type: motion
id: pir_motion
advertise_immediately: true
- type: occupancy
id: room_occupied
binary_sensor:
- platform: gpio
pin: GPIO4
id: motion
device_class: motion
filters:
- delayed_off: 30s
- platform: gpio
pin:
number: GPIO5
mode: INPUT_PULLUP
id: door
device_class: door
- platform: gpio
pin:
number: GPIO6
mode: INPUT_PULLUP
id: tamper
device_class: tamper
bthome:
binary_sensors:
- type: motion
id: motion
advertise_immediately: true
- type: door
id: door
advertise_immediately: true
- type: tamper
id: tamper
advertise_immediately: true

For security and safety sensors, always enable advertise_immediately:

bthome:
binary_sensors:
- type: motion
id: motion_sensor
advertise_immediately: true # Don't wait for interval!

This ensures state changes are broadcast instantly, rather than waiting for the next advertising interval.

Binary sensors in ESPHome map to BTHome as follows:

ESPHome StateBTHome ValueDescription
false / OFF0x00Inactive/clear/closed
true / ON0x01Active/detected/open

The meaning depends on the sensor type. For example:

  • door: OFF = closed, ON = open
  • motion: OFF = clear, ON = detected
  • battery_low: OFF = normal, ON = low battery