Skip to content

Node.js app and SmartApp-based API for remotely controlling switches in SmartThings

License

Notifications You must be signed in to change notification settings

jonscheiding/st-web-switches

Repository files navigation

SmartThings Web Switches

SmartThings solution for remotely controlling smart switches via a web interface.

Build Status

Architecture

This solution consists of the following components:

FNLLC

If run with an environment variable FNLLC=1, the app will authenticate with Schedule Master (used by FNLLC for airplane scheduling). It does this through my other project, schedulemaster-api.

Installation

To set up, you need to install the SmartApp in a SmartThings environment. The best way to do this is to install from GitHub. General instructions can be found here. You can also install by copying and pasting the code directly into the SmartThings IDE, see instructions here.

Configuration

The app requires the following environment variables:

Variable Description
SESSION_SECRET A secret key for Express sessions
SM_OAUTH_ID The client ID for the Schedule Master API
SM_OAUTH_SECRET The client secret for the Schedule Master API
SM_API_URL The URL for the Schedule Master API
SMARTAPP_ACCESS_TOKEN An OAuth2 access token from SmartThings
SMARTAPP_BASE_URL The installation endpoint for the SmartThings Smartapp
TIMER_DEFAULT Optional time of day to default for timers in the application (Example: TIMER_DEFAULT=7:00AM)
LOGGLY_TOKEN Optional token for logging to Loggly
LOGGLY_SUBDOMAIN Subdomain for logging to Loggly, required if LOGGLY_TOKEN is provided

The SmartThings access token and base URL must be obtained from SmartThings using Postman or a similar tool. See the documentation for more information.

Running

To run the web application:

npm install
npm start

To run it with the FNLLC authentication enabled:

npm run start:fnllc

About

Node.js app and SmartApp-based API for remotely controlling switches in SmartThings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published