Skip to content

code4fukui/SwitchBotAPI-deno

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwitchBotAPI-deno

SwitchBotAPI for Deno

Usage

prepare a setting.json (app → profile → settings → tap app version 10 times! to get token & secret)

{
  "token": "xxx...",
  "secret": "xxxxxx...",
}

write and save as devices.js

import { SwitchBotAPI } from "https://code4fukui.github.io/SwitchBotAPI-deno/SwitchBotAPI.js";

const setting = JSON.parse(await Deno.readTextFile("setting.json"));
const api = new SwitchBotAPI(setting);
console.log(await api.getDevices());

run to get deviceId

deno run -A devices.js

to turn on

const api = new SwitchBotAPI(setting);
await api.turnOn(deviceId);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published