No description
Find a file
2019-12-16 17:21:18 -03:00
dist fix apps create 2019-09-07 18:54:49 -03:00
examples/weather-controlled-light Updating request & request-promise libraries 2019-02-10 16:05:56 -08:00
src fix apps create 2019-09-07 18:54:49 -03:00
.gitignore Adding package description. Removing dist/ and node_modules/ from npm published package 2018-02-17 13:44:23 -08:00
LICENSE Adding license file 2018-02-17 11:40:19 -08:00
package-lock.json Create package-lock.json 2019-12-16 17:21:18 -03:00
package.json fixing smartthings create app 2019-09-07 18:32:35 -03:00
README.md Updating README to fix how to use the library using CommonJS 2019-02-10 15:59:24 -08:00
tsconfig.json fixing smartthings create app 2019-09-07 18:32:35 -03:00

smartthings-node

Node.js Client for Samsung SmartThings API

//ES6
import { SmartThings } from "smartthings-node";
let st = new SmartThings("PERSONAL_ACCESS_TOKEN"));

//CommonJS
const smartthings = require("smartthings-node");
let st = new smartthings("PERSONAL_ACCESS_TOKEN");

Installation

This module is available through npm and requires version > 7.x

$ npm install smartthings-node

Quick Start

Install the smartthings-node module

$ npm install smartthings-node

Import the module

If you are using Typescript or ES6 with it's import syntax:

import { SmartThings } from "smartthings-node";
let st = new SmartThings("PERSONAL_ACCESS_TOKEN"));

If you are using the CommonJS syntax:

const smartthings = require("smartthings-node");
let st = new smartthings.SmartThings("PERSONAL_ACCESS_TOKEN");

Use a sub-module. For example, to get a list of devices with switch capability:

st.devices.listDevicesByCapability('switch')
.then(deviceList => {
  console.log(deviceList);
})

Example

An example on how to create Automation SmartApp to control a light bulb using based on current weather can be found at: https://github.com/hijha/smartthings-node/tree/master/examples/weather-controlled-light