Scrypted Documentation / DeviceManager
Interface: DeviceManager
DeviceManager is the interface used by DeviceProvider to report new devices, device states, and device events to Scrypted.
Methods
getDeviceLogger()
getDeviceLogger(
nativeId
?):Logger
Get the logger for a device given a native id.
Parameters
• nativeId?: ScryptedNativeId
Returns
getDeviceConsole()
getDeviceConsole(
nativeId
?):Console
Get the console for the device given a native id.
Parameters
• nativeId?: ScryptedNativeId
Returns
Console
getMixinConsole()
getMixinConsole(
mixinId
,nativeId
?):Console
Get the console for the device given a native id.
Parameters
• mixinId: string
• nativeId?: ScryptedNativeId
Returns
Console
getDeviceState()
getDeviceState(
nativeId
?):DeviceState
Get the device state maintained by Scrypted. Setting properties on this state will update the state in Scrypted.
Parameters
• nativeId?: ScryptedNativeId
Returns
createDeviceState()
createDeviceState(
id
,setState
):WritableDeviceState
Create a device state object that will trap all state setting calls. Used internally by mixins and fork.
Parameters
• id: string
• setState
Returns
getMixinStorage()
getMixinStorage(
id
,nativeId
?):Storage
Get the storage for a mixin.
Parameters
• id: string
The id of the device being mixined.
• nativeId?: ScryptedNativeId
The nativeId of the MixinProvider.
Returns
Storage
onMixinEvent()
onMixinEvent(
id
,mixinDevice
,eventInterface
,eventData
):Promise
<void
>
Fire an event for a mixin provided by this plugin.
Parameters
• id: string
• mixinDevice: any
• eventInterface: string
• eventData: any
Returns
Promise
<void
>
getDeviceStorage()
getDeviceStorage(
nativeId
?):Storage
Get the device Storage object.
Parameters
• nativeId?: ScryptedNativeId
Returns
Storage
getNativeIds()
getNativeIds():
string
[]
Get all the native ids that have been reported by this plugin. This always includes "undefined", the plugin itself.
Returns
string
[]
onDeviceDiscovered()
onDeviceDiscovered(
device
):Promise
<string
>
onDeviceDiscovered is used to report new devices that are trickle discovered, one by one, such as via a network broadcast.
Parameters
• device: Device
Returns
Promise
<string
>
onDeviceEvent()
onDeviceEvent(
nativeId
,eventInterface
,eventData
):Promise
<void
>
Fire an event for a device provided by this plugin.
Parameters
• nativeId: ScryptedNativeId
• eventInterface: string
• eventData: any
Returns
Promise
<void
>
onDeviceRemoved()
onDeviceRemoved(
nativeId
):Promise
<void
>
onDeviceRemoved is used to report when discovered devices are removed.
Parameters
• nativeId: ScryptedNativeId
Returns
Promise
<void
>
onDevicesChanged()
onDevicesChanged(
devices
):Promise
<void
>
onDevicesChanged is used to sync Scrypted with devices that are attached to a hub, such as Hue or SmartThings. All the devices should be reported at once.
Parameters
• devices: DeviceManifest
Returns
Promise
<void
>
requestRestart()
requestRestart():
Promise
<void
>
Restart the plugin. May not happen immediately.
Returns
Promise
<void
>