Created
April 8, 2021 23:18
-
-
Save nayelyzarazua-bluetrail/9077746fc08eb3c703dc4277052d8f74 to your computer and use it in GitHub Desktop.
SmartApp_pageSettings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open: http://127.0.0.1:3008 | |
/**************************FRESH INSTALL**********************/ | |
/*************************************************************/ | |
2021-04-08T21:54:39.782Z debug: CONFIGURATION/INITIALIZE REQUEST: { | |
"lifecycle": "CONFIGURATION", | |
"executionId": "dbf4e9db-1e0b-2f7d-e79a-40cef67549f1", | |
"appId": "ab16228a-93bf-4dab-...", | |
"locale": "en", | |
"version": "0.1.0", | |
"client": { | |
"os": "ios", | |
"version": "1.6.64", | |
"language": "en-MX", | |
"displayMode": "LIGHT", | |
"timeZoneOffset": "", | |
"supportedTemplates": [], | |
"samsungAccountId": "" | |
}, | |
"configurationData": { | |
"installedAppId": "7badb999-952b-44f6-...", | |
"phase": "INITIALIZE", | |
"pageId": "", | |
"previousPageId": "", | |
"config": {}, | |
"isResubmit": true | |
}, | |
"settings": {} | |
} | |
2021-04-08T21:54:39.786Z debug: RESPONSE: { | |
"statusCode": 200, | |
"configurationData": { | |
"initialize": { | |
"firstPageId": "mainPage", | |
"permissions": [], | |
"disableCustomDisplayName": false, | |
"disableRemoveApp": false | |
} | |
} | |
} | |
2021-04-08T21:54:40.349Z debug: CONFIGURATION/PAGE REQUEST: { | |
"lifecycle": "CONFIGURATION", | |
"executionId": "dbf4e9db-1e0b-2f7d-e79a-40cef67549f1", | |
"appId": "ab16228a-93bf-4dab-...", | |
"locale": "en", | |
"version": "0.1.0", | |
"client": { | |
"os": "ios", | |
"version": "1.6.64", | |
"language": "en-MX", | |
"displayMode": "LIGHT", | |
"timeZoneOffset": "", | |
"supportedTemplates": [], | |
"samsungAccountId": "" | |
}, | |
"configurationData": { | |
"installedAppId": "7badb999-952b-44f6-...", | |
"phase": "PAGE", | |
"pageId": "mainPage", | |
"previousPageId": "", | |
"config": {}, | |
"isResubmit": false | |
}, | |
"settings": {} | |
} | |
2021-04-08T21:54:40.353Z debug: RESPONSE: { | |
"statusCode": 200, | |
"configurationData": { | |
"page": { | |
"name": "pages.mainPage.name", | |
"complete": true, | |
"pageId": "mainPage", | |
"nextPageId": null, | |
"previousPageId": null, | |
"sections": [ | |
{ | |
"name": "pageTwoLink", | |
"settings": [ | |
{ | |
"id": "linkpageTwo", | |
"type": "PAGE", | |
"name": "pages.mainPage.settings.linkpageTwo.name", | |
"description": "pages.mainPage.settings.linkpageTwo.description", | |
"page": "pageTwo" | |
} | |
] | |
} | |
] | |
} | |
} | |
} | |
/*****************GO TO SECOND PAGE*************************/ | |
/***********************************************************/ | |
2021-04-08T21:54:46.351Z debug: CONFIGURATION/PAGE REQUEST: { | |
"lifecycle": "CONFIGURATION", | |
"executionId": "66bb6502-031d-9b6c-b5f9-b8f1f9f60346", | |
"appId": "ab16228a-93bf-4dab-...", | |
"locale": "en", | |
"version": "0.1.0", | |
"client": { | |
"os": "ios", | |
"version": "1.6.64", | |
"language": "en-MX", | |
"displayMode": "LIGHT", | |
"timeZoneOffset": "", | |
"supportedTemplates": [], | |
"samsungAccountId": "" | |
}, | |
"configurationData": { | |
"installedAppId": "7badb999-952b-44f6-...", | |
"phase": "PAGE", | |
"pageId": "pageTwo", | |
"previousPageId": "mainPage", | |
"config": {}, | |
"isResubmit": false | |
}, | |
"settings": {} | |
} | |
2021-04-08T21:54:46.356Z debug: RESPONSE: { | |
"statusCode": 200, | |
"configurationData": { | |
"page": { | |
"name": "pages.pageTwo.name", | |
"complete": true, | |
"pageId": "pageTwo", | |
"nextPageId": null, | |
"previousPageId": "mainPage", | |
"sections": [ | |
{ | |
"name": "sensors", | |
"settings": [ | |
{ | |
"id": "locksensor", | |
"required": true, | |
"type": "DEVICE", | |
"name": "pages.pageTwo.settings.locksensor.name", | |
"description": "Tap to set", | |
"multiple": false, | |
"capabilities": [ | |
"lock" | |
], | |
"permissions": [ | |
"r", | |
"x" | |
] | |
}, | |
{ | |
"id": "doorsensor", | |
"required": true, | |
"type": "DEVICE", | |
"name": "pages.pageTwo.settings.doorsensor.name", | |
"description": "Tap to set", | |
"multiple": false, | |
"capabilities": [ | |
"doorControl" | |
], | |
"permissions": [ | |
"r", | |
"x" | |
] | |
} | |
] | |
} | |
] | |
} | |
} | |
} | |
2021-04-08T21:55:07.531Z debug: INSTALL REQUEST: { | |
"lifecycle": "INSTALL", | |
"executionId": "4ecaa59d-8830-89cd-4f25-34e95260f43e", | |
"appId": "ab16228a-93bf-4dab-...", | |
"locale": "en", | |
"version": "0.1.0", | |
"client": { | |
"os": "ios", | |
"version": "1.6.64", | |
"language": "en-MX", | |
"displayMode": "LIGHT", | |
"timeZoneOffset": "", | |
"supportedTemplates": [], | |
"samsungAccountId": "" | |
}, | |
"installData": { | |
"authToken": "515afa4c-7c80-...", | |
"refreshToken": "c598d174-02b9-....", | |
"installedApp": { | |
"installedAppId": "7badb999-952b-44f6-...", | |
"locationId": "7770e091-79cf-4586-...", | |
"config": { | |
"locksensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "843e5ef4-e948-475f-...", | |
"componentId": "main" | |
} | |
} | |
], | |
"doorsensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "f0e86358-2f59-4ee4-...", | |
"componentId": "main" | |
} | |
} | |
] | |
}, | |
"permissions": [ | |
"x:devices:f0e86358-2f59-4ee4-...", | |
"r:devices:843e5ef4-e948-475f-...", | |
"r:devices:f0e86358-2f59-4ee4-...", | |
"x:devices:843e5ef4-e948-475f-..." | |
] | |
} | |
}, | |
"settings": {} | |
} | |
2021-04-08T21:55:07.539Z debug: RESPONSE: { | |
"statusCode": 200, | |
"installData": {} | |
} | |
/**********************INITIALIZE FOR UPDATE*******************************/ | |
/**************************************************************************/ | |
2021-04-08T21:55:35.089Z debug: CONFIGURATION/INITIALIZE REQUEST: { | |
"lifecycle": "CONFIGURATION", | |
"executionId": "594eadb8-1010-c05f-1bd9-15a7cc012196", | |
"appId": "ab16228a-93bf-4dab-...", | |
"locale": "en", | |
"version": "0.1.0", | |
"client": { | |
"os": "ios", | |
"version": "1.6.64", | |
"language": "en-MX", | |
"displayMode": "LIGHT", | |
"timeZoneOffset": "", | |
"supportedTemplates": [], | |
"samsungAccountId": "" | |
}, | |
"configurationData": { | |
"installedAppId": "7badb999-952b-44f6-...", | |
"phase": "INITIALIZE", | |
"pageId": "", | |
"previousPageId": "", | |
"config": { | |
"locksensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "843e5ef4-e948-475f-...", | |
"componentId": "main" | |
} | |
} | |
], | |
"doorsensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "f0e86358-2f59-4ee4-...", | |
"componentId": "main" | |
} | |
} | |
] | |
}, | |
"isResubmit": true | |
}, | |
"settings": {} | |
} | |
2021-04-08T21:55:35.096Z debug: RESPONSE: { | |
"statusCode": 200, | |
"configurationData": { | |
"initialize": { | |
"firstPageId": "mainPage", | |
"permissions": [], | |
"disableCustomDisplayName": false, | |
"disableRemoveApp": false | |
} | |
} | |
} | |
2021-04-08T21:55:35.623Z debug: CONFIGURATION/PAGE REQUEST: { | |
"lifecycle": "CONFIGURATION", | |
"executionId": "594eadb8-1010-c05f-1bd9-15a7cc012196", | |
"appId": "ab16228a-93bf-4dab-...", | |
"locale": "en", | |
"version": "0.1.0", | |
"client": { | |
"os": "ios", | |
"version": "1.6.64", | |
"language": "en-MX", | |
"displayMode": "LIGHT", | |
"timeZoneOffset": "", | |
"supportedTemplates": [], | |
"samsungAccountId": "" | |
}, | |
"configurationData": { | |
"installedAppId": "7badb999-952b-44f6-...", | |
"phase": "PAGE", | |
"pageId": "mainPage", | |
"previousPageId": "", | |
"config": { | |
"locksensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "843e5ef4-e948-475f-...", | |
"componentId": "main" | |
} | |
} | |
], | |
"doorsensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "f0e86358-2f59-4ee4-...", | |
"componentId": "main" | |
} | |
} | |
] | |
}, | |
"isResubmit": false | |
}, | |
"settings": {} | |
} | |
2021-04-08T21:55:35.631Z debug: RESPONSE: { | |
"statusCode": 200, | |
"configurationData": { | |
"page": { | |
"name": "pages.mainPage.name", | |
"complete": true, | |
"pageId": "mainPage", | |
"nextPageId": null, | |
"previousPageId": null, | |
"sections": [ | |
{ | |
"name": "pageTwoLink", | |
"settings": [ | |
{ | |
"id": "linkpageTwo", | |
"type": "PAGE", | |
"name": "pages.mainPage.settings.linkpageTwo.name", | |
"description": "pages.mainPage.settings.linkpageTwo.description", | |
"page": "pageTwo" | |
} | |
] | |
} | |
] | |
} | |
} | |
} | |
2021-04-08T21:56:05.729Z debug: UPDATE REQUEST: { | |
"lifecycle": "UPDATE", | |
"executionId": "24b0c087-e14e-a920-7170-20c7e27777fb", | |
"appId": "ab16228a-93bf-4dab-...", | |
"locale": "en", | |
"version": "0.1.0", | |
"updateData": { | |
"authToken": "515afa4c-7c80-4e93-86d2-2fd6a667e5af", | |
"refreshToken": "c598d174-02b9-48fe-956e-f0d2dacb7e97", | |
"installedApp": { | |
"installedAppId": "7badb999-952b-44f6-...", | |
"locationId": "7770e091-79cf-4586-...", | |
"config": { | |
"locksensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "843e5ef4-e948-475f-...", | |
"componentId": "main" | |
} | |
} | |
], | |
"doorsensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "f0e86358-2f59-4ee4-...", | |
"componentId": "main" | |
} | |
} | |
] | |
}, | |
"permissions": [ | |
"x:devices:f0e86358-2f59-4ee4-...", | |
"r:devices:843e5ef4-e948-475f-...", | |
"r:devices:f0e86358-2f59-4ee4-...", | |
"x:devices:843e5ef4-e948-475f-..." | |
] | |
}, | |
"previousConfig": { | |
"locksensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "843e5ef4-e948-475f-...", | |
"componentId": "main" | |
} | |
} | |
], | |
"doorsensor": [ | |
{ | |
"valueType": "DEVICE", | |
"deviceConfig": { | |
"deviceId": "f0e86358-2f59-4ee4-...", | |
"componentId": "main" | |
} | |
} | |
] | |
}, | |
"previousPermissions": [ | |
"x:devices:f0e86358-2f59-4ee4-...", | |
"r:devices:843e5ef4-e948-475f-...", | |
"r:devices:f0e86358-2f59-4ee4-...", | |
"x:devices:843e5ef4-e948-475f-..." | |
] | |
}, | |
"settings": {} | |
} | |
2021-04-08T21:56:05.739Z debug: RESPONSE: { | |
"statusCode": 200, | |
"updateData": {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const SmartApp = require('@smartthings/smartapp'); | |
const { json } = require('body-parser'); | |
require('dotenv').config(); | |
const server = module.exports = express(); | |
server.use(bodyParser.json()); | |
const app = new SmartApp() | |
/* Handles lifecycle events from SmartThings */ | |
server.post('/', async (req, res) => { | |
app.handleHttpCallback(req, res); | |
}); | |
let members={Ana:'Ana',Jason:'Jason',Kate:'Kate',Andrew:'Andrew'} | |
/* Defines the SmartApp */ | |
app.enableEventLogging(2) // Log and pretty-print all lifecycle events and responses | |
.page('mainPage', (context, page, configData) => { | |
page.section('pageTwoLink', (section) => { | |
section.pageSetting('linkpageTwo').page('pageTwo'); | |
}); | |
}) | |
.page('pageTwo', (context, pageTwo, configData) => { | |
pageTwo.previousPageId('mainPage'); | |
pageTwo.section('sensors', section => { | |
section.deviceSetting('locksensor').capabilities(['lock']).permissions(['r','x']).required(true); | |
section.deviceSetting('doorsensor').capabilities(['doorControl']).permissions(['r','x']).required(true); | |
}); | |
pageTwo.complete(true) | |
}) | |
.installed(async (context, updateData) => { | |
//... | |
}) | |
.updated(async (context, updateData) => { | |
//... | |
}); | |
/* Starts the server */ | |
let port = process.env.PORT; | |
server.listen(port); | |
console.log(`Open: http://127.0.0.1:${port}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment