Skip to content

@camera.ui/sdk / sensor / defineBinarySensor

Function: defineBinarySensor() ​

defineBinarySensor<T, K>(type, assignmentKey, deviceClass): object

Defined in: sensor/binary.ts:68

Declares the metadata of a binary sensor type: a detected flag that arms the automation cascade for as long as it is set.

Type Parameters ​

T ​

T extends SensorType

K ​

K extends string

Parameters ​

type ​

T

The sensor type.

assignmentKey ​

K

Key under which a camera stores its assignment for the type.

deviceClass ​

string

Device class consumers such as Home Assistant use for the type.

Returns ​

object

The metadata, with type and assignmentKey preserved as literal types.

assignmentKey ​

assignmentKey: K

cascadeTrigger ​

readonly cascadeTrigger: object

cascadeTrigger.property ​

readonly property: "detected" = 'detected'

cascadeTrigger.sustained ​

readonly sustained: true = true

cascadeTrigger.value ​

readonly value: true = true

category ​

readonly category: Sensor = SensorCategory.Sensor

isDetectionType ​

readonly isDetectionType: false = false

multiProvider ​

readonly multiProvider: true = true

properties ​

readonly properties: object

properties.detected ​

readonly detected: object

properties.detected.type ​

readonly type: "boolean" = 'boolean'

properties.detected.writable ​

readonly writable: true = true

semantics ​

readonly semantics: object

semantics.commandProperty ​

readonly commandProperty: "detected" = 'detected'

semantics.deviceClass ​

deviceClass: string

semantics.domain ​

readonly domain: Binary = SensorDomain.Binary

semantics.stateProperty ​

readonly stateProperty: "detected" = 'detected'

shortcutable ​

readonly shortcutable: true = true

type ​

type: T

virtual ​

readonly virtual: object

virtual.properties ​

readonly properties: object

virtual.properties.detected ​

readonly detected: false = false

Example ​

ts
export const smokeMeta = defineBinarySensor(SensorType.Smoke, 'smoke', 'smoke');