Capabilities
Binary sensor
Domain binary_sensor: states, services, device classes and features.
Entity ids in this domain look like binary_sensor.<object_id>.
device_class (motion, door, window, smoke, …) tells you what on means; see the device classes below.
Use in preferences
{ key: 'device', label: 'Device', type: 'entity', domainFilter: 'binary_sensor', required: true }States
getState() returns the raw token. subscribe filters, entity.is() and matchesState() also accept the friendly label the app shows (any case; spaces, hyphens and underscores interchangeable).
| Device class | on | off |
|---|---|---|
| any | On | Off |
door | Open | Closed |
motion | Detected | Clear |
window | Open | Closed |
glass_break | Broken | Intact |
moisture | Wet | Dry |
smoke | Detected | Clear |
carbon_monoxide | Detected | Clear |
presence | Present | Not Present |
connectivity | Connected | Disconnected |
vibration | Vibration Detected | Clear |
tamper | Tampered | Clear |
heat | Detected | Clear |
gas | Detected | Clear |
cold | Freezing | Normal |
sound | Sounding | Quiet |
power | Mains OK | No mains |
problem | Problem | OK |
subscribe($g.device, { to: 'on' }, onChange);
subscribe($g.device, { to: 'Open' }, onChange); // same thing, by label
if ($g.device.is('Open')) { /* … */ }Services
No services.
Device classes
none, door, motion, window, glass_break, moisture, smoke, carbon_monoxide, presence, vibration, connectivity, tamper, heat, gas, cold, sound, power, problem
Filter with deviceClassFilter in an entity input.
Attributes
| Attribute | Type | Description |
|---|---|---|
batteryLevel | number | — |
isLow | boolean | — |