Skip to content

jayhjha/smartthings-node

Repository files navigation

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

About

Node.js Client for Samsung SmartThings API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published