Skip to content

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

ScryptedDevice

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

ScryptedDevice

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

ScryptedDevice

getDeviceByName(name)

getDeviceByName<T>(name): ScryptedDevice & T

Find a Scrypted device by name.

Type Parameters

T

Parameters

name: string

Returns

ScryptedDevice & T


getDeviceState()

getDeviceState(id): object

Get the current state of a device.

Parameters

id: string

Returns

object

Deprecated


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

EventListenerRegister


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

EventListenerRegister


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>