Skip to content

My local switchbot api project to prevent using their cloud based open API.

Notifications You must be signed in to change notification settings

Yinzy00/local-switchbot-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Switchbot Api

My Node.js local switchbot api project to prevent using their cloud based open API. No longer dependent on an internet connection or switchbot servers.

Project created using node-switchbot package.

To use the project you need:

  • Linux device
  • BTE compatible adapter

Currently suupported

Switchbot Curtain

  • Open
  • Close
  • runToPos
  • pause

Custom device names

I added an optional feature to add custom names using the api.

Turn on by adding env prop (USE_MYSQL = "true") to .env file

Routes

/devices

Returns list of all found devices.

/devices/id/:id

Returns device by device id

/devices/id/:id/setName/:name

Sets custom device name (use_mysql required!)

/devices/name/:name

Returns device by custom name (use_mysql required!)

/devices/id/:id/open

Open curtain by device id

/devices/id/:id/close

Close curtain by device id

/devices/id/:id/runToPos/:position

Set curtain position by device id

Installation

Installing required bluetooth library

Ubuntu, Debian, Raspbian
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev

See the document of the @abandonware/noble for other operating systems details.

Configuration

.Env properties

Requird Settings

  • SERVER_PORT port used by the api

Optional Settings

  • USE_MYSQL turn on use of mysql database for custom names.
  • DB_HOST database host for mysql database
  • DB_USER database user for mysql database
  • DB_PASSWORD database password for mysql database
  • DB_NAME database name for mysql database

Integration

Hubitat

I created hubitat drivers to integrate local switchbot and added documentation how to use them.

Todo:

  • Add support for curtain moving mode
  • Other device types?

Community

About

My local switchbot api project to prevent using their cloud based open API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published