0.3.0 ā€¢ Published 10 days ago

@lucadiba/switchbot-client v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 days ago

A JavaScript client for SwitchBot 1.1 APIs with built-in TypeScript types. This package supports both ESM and CommonJS.

Installation

Install the package using your preferred package manager:

npm install @lucadiba/switchbot-client

Usage

Initialize the client

Import the package in your application.

import SwitchBot from "@lucadiba/switchbot-client";

Initialize the client with your open token and secret key. You can find these values in the SwitchBot app.

const switchbot = new SwitchBot({
  openToken: "openToken",
  secretKey: "secretKey",
});

Device

To interact with a device, you need to know its ID. You can find it in the SwitchBot app or by calling the devices method.

const devices = await switchbot.devices();
// [{
//   deviceId: "deviceId",
//   ...
// }]

Then, you can interact with the device.

// Press SwitchBot Bot
switchbot.bot("deviceId").press();

Scene

// Execute SwitchBot Scene
switchbot.scene("sceneId").execute();

Support

The following devices are supported:

  • Blind Tilt
  • Bot
  • Ceiling Light
  • Ceiling Light Pro
  • Color Bulb
  • Contact Sensor
  • Curtain
  • Curtain 3
  • Hub
  • Hub 2
  • Hub Plus
  • Hub Mini
  • Humidifier
  • Indoor Cam
  • Keypad
  • Keypad Touch
  • Lock
  • Meter
  • Meter Plus
  • Outdoor meter
  • Motion Sensor
  • Pan/Tilt Cam
  • Pan/Tilt Cam 2K
  • Plug
  • Plug Mini (US)
  • Plug Mini (JP)
  • Remote
  • Robot Vacuum Cleaner S1
  • Robot Vacuum Cleaner S1 Plus
  • Strip Light
  • šŸ“˜ Full documentation

The following devices are currently not supported:

  • Battery Circulator Fan
  • Virtual infrared remote devices

Author

šŸ‘¤ Luca Dibattista

šŸ¤ Contributing

Contributions, issues and feature requests are welcome! Feel free to check issues page. Please run npx changeset and follow the instructions to create a new changeset before opening a pull request.

Show your support

Give a ā­ļø if this project helped you!

šŸ“ License

Copyright Ā© 2022 Luca Dibattista. This project is MIT licensed.


This README was generated with ā¤ļø by readme-md-generator

0.3.0

10 days ago

0.2.0

2 months ago

0.1.0

2 months ago

0.0.9

3 months ago

0.0.8

10 months ago

0.0.7

12 months ago

0.0.6

1 year ago

0.0.3

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.2

1 year ago

0.0.1

2 years ago