@camera.ui/sdk / plugin / SensorDiscoveryProvider
Interface: SensorDiscoveryProvider ​
Defined in: plugin/interfaces.ts:310
Implemented by sensor-providing plugins that face an external inventory (Home Assistant entities, vendor accessories) the user picks from instead of the plugin importing everything. Declare PluginInterface.SensorDiscovery in the contract.
The host owns the adoption: it lists what the plugin discovers, creates the sensor record when the user adopts, hands the plugin its adopted sensors on every start and tells it when the user deletes one. The plugin keeps no list of its own.
Identity is the source's stable id (DiscoveredSensor.id), never an address; the same id means the same sensor across restarts and renames.
Methods ​
configureAdoptedSensors() ​
configureAdoptedSensors(
sensors):Promise<Sensor<any,any,any>[]>
Defined in: plugin/interfaces.ts:333
Called once at startup, right after configureCameras(), with every sensor the user adopted from this plugin. Build and return one runtime sensor per record, always, from the record's type and name alone; the host binds each returned sensor to its record by nativeId. Report what the source looks like on the sensor itself (setSourceState, setAddress) as soon as you know: a record the source no longer has gets setSourceState('removed'), it is never dropped here.
Parameters ​
sensors ​
The adopted sensors of this plugin.
Returns ​
Promise<Sensor<any, any, any>[]>
One runtime sensor per adopted record.
onDiscoverSensors() ​
onDiscoverSensors():
Promise<DiscoveredSensor[]>
Defined in: plugin/interfaces.ts:318
Return every sensor the source currently offers. The host drops the ones already adopted, the plugin does not filter. Called on demand (Sensors page, rescan) and on a polling schedule while the page is open.
Returns ​
Promise<DiscoveredSensor[]>
Sensors currently discoverable by this plugin.
onSensorAdopted() ​
onSensorAdopted(
sensor):Promise<Sensor<any,any,any>>
Defined in: plugin/interfaces.ts:344
The user adopted a discovered sensor and the host created its record. Build and return the runtime sensor for it, same as one entry of configureAdoptedSensors().
Parameters ​
sensor ​
The adopted sensor.
Returns ​
Promise<Sensor<any, any, any>>
The runtime sensor to bind to the record.
onSensorUnadopted() ​
onSensorUnadopted(
nativeId):Promise<void>
Defined in: plugin/interfaces.ts:353
The user deleted an adopted sensor. The host has already unbound the runtime sensor; drop whatever the plugin still holds for it. The entity shows up as discovered again on the next scan.
Parameters ​
nativeId ​
string
The DiscoveredSensor.id the adoption used.
Returns ​
Promise<void>