SmartDevicesManager.getDevices()

Requires:
@ray-js/panel-sdk≥1.16.0

Description

Get a shallow copy of all registered device instances, indexed by key. Commonly used when you need to operate on instances directly instead of via Hooks, e.g., iterating all devices inside an event callback.

Parameters

None

Return Value

Type: Record<string, SmartDeviceModel>
Record object of all device instances

Examples

Get the device instance collection

const instances = manager.getDevices();
Object.values(instances).forEach(device => {
  device.publishDps({ switch_led: true });
});