@scrypted/client
TypeScript icon, indicating that this package has built-in type declarations

1.3.5 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @scrypted/client

Weekly Downloads

410

Version

1.3.5

License

ISC

Unpacked Size

655 kB

Total Files

79

Last publish

Collaborators

  • billyzoellers
  • bjia56
  • koush