shelly-sdk
Version:
Shelly SDK for Node.js with Types definition
49 lines (48 loc) • 1.34 kB
TypeScript
import { Json } from '../util/types';
import { Settings } from './settings';
import { Status } from './status';
import { Type } from './type';
export interface Config {
name?: string;
type?: Type;
id: string;
ip: string;
port: number;
}
export interface RemoteDeviceParams {
ip: string;
port: number;
path: string;
command?: string;
value?: string;
body?: Json;
timeout?: number;
}
export declare class Shelly {
static scanNetwork(baseIp: string, port?: number, timeout?: number): Promise<Config[]>;
static instantiateDevices(configList: Config[]): Promise<Shelly[]>;
protected readonly config: Config;
protected _status?: Status;
protected _settings?: Settings;
constructor(config: Partial<Config> & {
ip: string;
});
init(): Promise<this>;
getConfig(): Config;
settings(): Promise<Settings>;
status(): Promise<Status>;
switchOff(): Promise<Json>;
switchOn(): Promise<Json>;
switch(state: boolean): Promise<Json>;
update(settings: Partial<Settings>): Promise<Json>;
toString(): string;
serialize(): {
settings: Settings | undefined;
status: Status | undefined;
name?: string | undefined;
type?: Type | undefined;
id: string;
ip: string;
port: number;
};
}