Scrypted Documentation / SystemManager
Interface: SystemManager
SystemManager is used by scripts to query device state and access devices.
Methods
getComponent()
getComponent(
id):Promise<any>
Retrieve a system service.
Parameters
• id: string
Returns
Promise<any>
getDeviceById()
getDeviceById(id)
getDeviceById(
id):ScryptedDevice
Find a Scrypted device by id.
Parameters
• id: string
Returns
getDeviceById(id)
getDeviceById<
T>(id):ScryptedDevice&T
Find a Scrypted device by id.
Type Parameters
• T
Parameters
• id: string
Returns
ScryptedDevice & T
getDeviceById(pluginId, nativeId)
getDeviceById(
pluginId,nativeId?):ScryptedDevice
Find a Scrypted device by pluginId and optionally the nativeId.
Parameters
• pluginId: string
• nativeId?: ScryptedNativeId
Returns
getDeviceById(pluginId, nativeId)
getDeviceById<
T>(pluginId,nativeId?):ScryptedDevice&T
Find a Scrypted device by pluginId and optionally the nativeId.
Type Parameters
• T
Parameters
• pluginId: string
• nativeId?: ScryptedNativeId
Returns
ScryptedDevice & T
getDeviceByName()
getDeviceByName(name)
getDeviceByName(
name):ScryptedDevice
Find a Scrypted device by name.
Parameters
• name: string
Returns
getDeviceByName(name)
getDeviceByName<
T>(name):ScryptedDevice&T
Find a Scrypted device by name.
Type Parameters
• T
Parameters
• name: string
Returns
ScryptedDevice & T
getSystemState()
getSystemState():
object
Get the current state of every device.
Returns
object
listen()
listen(
callback):EventListenerRegister
Passively (without polling) listen to property changed events.
Parameters
• callback: EventListener
Returns
listenDevice()
listenDevice(
id,event,callback):EventListenerRegister
Subscribe to events from a specific interface on a device id, such as 'OnOff' or 'Brightness'. This is a convenience method for ScryptedDevice.listen.
Parameters
• id: string
• event: string | EventListenerOptions
• callback: EventListener
Returns
removeDevice()
removeDevice(
id):Promise<void>
Remove a device from Scrypted. Plugins should use DeviceManager.onDevicesChanged or DeviceManager.onDeviceRemoved to remove their own devices
Parameters
• id: string
Returns
Promise<void>
