You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SDK that wraps the SmartThings REST API and reduces the amount of code necessary
6
-
to write a SmartApp app. Supports both web-hook and AWS Lambda implementations.
7
-
This is a pre-release version of the API and may change over
8
-
time time.
15
+
SDK that wraps the SmartThings REST API and reduces the amount of code necessary to write a SmartApp app. It supports both webhook and AWS Lambda implementations. This is a preview version of the API and will change over time time.
16
+
17
+
## Installation
18
+
19
+
```bash
20
+
npm i @smartthings/smartapp --save
21
+
```
22
+
23
+
## Importing
24
+
25
+
`NodeJS`:
9
26
10
-
## Installation:
27
+
```javascript
28
+
constsmartapp=require('@smartthings/smartapp')
11
29
```
12
-
npm install @smartthings/smartapp --save
30
+
31
+
Or, if you're transpiling to `ES6`/`ES2015`+:
32
+
33
+
```javascript
34
+
importsmartappfrom'@smartthings/smartapp'
13
35
```
14
36
15
-
## Key Features
16
-
* Javascript API hides details of REST calls and authentication.
17
-
* Event handler framework dispatches lifecycle evebnts to named event handlers.
18
-
* Configuration page API simplifies page definition.
Here's the equivalent of the origial SmartThings Groovy _Let There Be Light_ app that
26
-
turns on and off a light when a door opens and closes, set up to run as a Lambda.
27
48
28
-
```
29
-
require('@smartthings/smartapp');
30
-
app.configureI18n()
49
+
Here's the equivalent of the original SmartThings Groovy _Let There Be Light_ app that turns on and off a light when a door opens and closes, set up to run as a Lambda.
Configuration page strings are specified in a separate locales/en.json file, which
57
-
can be automatically created the first time you run the app. Here's a completed English localization file
58
-
for the previous example:
59
-
```
78
+
Configuration page strings are specified in a separate `locales/en.json` file, which can be automatically created the first time you run the app. Here's a completed English localization file for the previous example:
79
+
80
+
```json
60
81
{
61
82
"pages.mainPage.name": "Let There Be Light",
62
83
"pages.mainPage.sections.sensors.name": "When this door or window opens or closes",
@@ -71,12 +92,13 @@ for the previous example:
71
92
72
93
To run the app in a webserver rather than a lambda replace the `exports.handle = ...` function with an HTTP server
0 commit comments