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
Copy file name to clipboardExpand all lines: README.md
+23-24Lines changed: 23 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,55 +60,51 @@ import SmartApp from '@smartthings/smartapp'
60
60
61
61
## Examples
62
62
63
-
The following example is 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.
63
+
The following example automation is the equivalent of a simple Rule (if contact sensor opens/closes, turn lights on/off) which is easily achieved via our [Rules API](https://smartthings.developer.samsung.com/docs/rules/overview.html). It is given here as a brief showcase of the SDK, and not meant to be a good candidate for a SmartApp. Be sure to check if your automation is possible with the Rules API, as it will benefit from speed, stability, and security through future local execution support.
64
64
65
65
### Running it as a web service
66
66
67
67
To run the app with an HTTP server, like Express.js:
68
68
69
69
```javascript
70
-
constexpress=require('express');
71
-
constSmartApp=require('@smartthings/smartapp');
72
-
constserver=module.exports=express();
73
-
constPORT=8080;
70
+
constSmartApp=require('@smartthings/smartapp');
71
+
constexpress=require('express');
72
+
constserver=express();
73
+
constPORT=8080;
74
74
75
-
server.use(express.json());
76
75
77
76
/* Define the SmartApp */
78
77
constsmartapp=newSmartApp()
79
-
// @smartthings_rsa.pub is your on-disk public key
80
-
// If you do not have it yet, omit publicKey()
81
-
.publicKey('@smartthings_rsa.pub') // optional until app verified
82
78
.enableEventLogging(2) // logs all lifecycle event requests and responses as pretty-printed JSON. Omit in production
More detailed examples to use as a starting point can be found in our [app-examples](https://github.com/SmartThingsCommunity/app-examples) repository.
140
+
142
141
### Localization
143
142
144
143
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:
0 commit comments