page ( 'mainPage', ( context, page, configData ) => ) on the SmartApp object. enableEventLogging ( 2 ) // logs all lifecycle event requests and responses as pretty-printed JSON. InstallationĬonst SmartApp = require ( ) const express = require ( 'express' ) const server = express ( ) const PORT = 8080 /* Define the SmartApp */ const smartapp = new SmartApp ( ). To learn more about SmartApps, including choosing the best hosting solution for your SmartApp, visit the SmartApp developer documentation. Webhook SmartApps are any publicly-accessible web server that will receive a POST request payload.ĪWS Lambda SmartApps are hosted in the Amazon Web Services cloud and are invoked by ARN instead of a public-DNS address. There are two distinct options for hosting your SmartApp: AWS Lambda and Webhook. Creating a SmartApp allows you to control and get status notifications from SmartThings devices using the SmartThings API. Your application will respond to lifecycle events sent from SmartThings to perform actions on behalf of your users and will execute any scheduled tasks that you have created in the SmartApp. The complexity of execution and the number of expected users will need to be examined to understand the hardware or execution requirements your app needs to handle. All of the SmartApp execution will happen on the server or Lambda that you control. SmartApps are custom applications that execute outside of the SmartThings Platform. ✅ Firebase Cloud Firestore plugin ( usage).✅ Context Store plugins – easily scale access token management (and more) to support many users.✅ Winston framework manges log messages.✅ Integrated i18n framework provides configuration page localization.✅ Configuration page API simplifies page definition.✅ Event handler framework dispatches lifecycle events to named event handlers.✅ Javascript API hides details of REST calls and authentication.This SDK includes a set of Node.js libraries for building Webhook and AWS Lambda SmartApps, and interacting with the public SmartThings API. See the Version 2.0.0 release notes for more information. Axios is now used rather than request-promise-native for making HTTP calls, resulting in changes to the error.Methods that return lists now return arrays instead of objects with the properties items and _links.The major non-backwards compatible changes include: This major release is not fully backwards compatible with version 1.X, though for most SmartApps the changes required should be relatively minor. If it is closed, turn it off.For a detailed look at the API, check out the reference documentation. Monitor the door device - if it is opened, turn the light on.Gather the devices (door and light) to use for this app.Our example is going to be pretty simple - we will create an app that triggers a light to come on when a door opens. Typically just unsubscribes and re-subscribes to events, since the preferences have changed. updated is the method that is called when the preferences are updated.Typically this is where we subscribe to events from configured devices.
installed is the method that is called when this app is installed.preferences is where we configure what information we need from the user to run this app.There are three core methods that must be defined for SmartApps:
#SMARTTHINGS DELETE SMARTAPP CODE#
This will take you to the IDE, where you will see some code has been filled in for you. Give your app a name, author, and description.
Press the “New SmartApp” button on the right of the page: This will take you to your SmartApps page, where you can view and manage your SmartApps.