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
- Open
- Close
- runToPos
- pause
I added an optional feature to add custom names using the api.
Turn on by adding env prop (USE_MYSQL = "true") to .env file
/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
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
See the document of the @abandonware/noble for other operating systems details.
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 databaseDB_USER
database user for mysql databaseDB_PASSWORD
database password for mysql databaseDB_NAME
database name for mysql database
I created hubitat drivers to integrate local switchbot and added documentation how to use them.
- Add support for curtain moving mode
- Other device types?