@scrypted/client
v1.3.6
Published
```js import { connectScryptedClient, OnOff } from '@scrypted/client';
Downloads
1,917
Readme
Use the Scrypted SDK from the command line or web
import { connectScryptedClient, OnOff } from '@scrypted/client';
async function example() {
const sdk = await connectScryptedClient({
baseUrl: 'https://localhost:10443',
pluginId: "@scrypted/core",
username: process.env.SCRYPTED_USERNAME || 'admin',
password: process.env.SCRYPTED_PASSWORD || 'swordfish',
});
const dimmer = sdk.systemManager.getDeviceByName<OnOff>("Office Dimmer");
dimmer.turnOn();
await new Promise(resolve => setTimeout(resolve, 5000));
await dimmer.turnOff();
// allow node to exit
sdk.disconnect();
}
example();
Running the Example
npm -g install ts-node
ts-node examples/example.ts