{"id":18695360,"url":"https://github.com/smartthingscommunity/smartapp-example-open-close-nodejs","last_synced_at":"2025-08-31T07:31:38.763Z","repository":{"id":43394812,"uuid":"318334309","full_name":"SmartThingsCommunity/smartapp-example-open-close-nodejs","owner":"SmartThingsCommunity","description":"This SmartApp turns on and off a light when something opens and closes.","archived":false,"fork":false,"pushed_at":"2022-10-17T17:28:45.000Z","size":139,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-07T11:14:40.881Z","etag":null,"topics":["smartthings-smartapp-example","webhook"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmartThingsCommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-03T22:17:47.000Z","updated_at":"2024-09-19T00:24:43.000Z","dependencies_parsed_at":"2023-01-20T07:30:25.607Z","dependency_job_id":null,"html_url":"https://github.com/SmartThingsCommunity/smartapp-example-open-close-nodejs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-example-open-close-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-example-open-close-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-example-open-close-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartThingsCommunity%2Fsmartapp-example-open-close-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartThingsCommunity","download_url":"https://codeload.github.com/SmartThingsCommunity/smartapp-example-open-close-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231580603,"owners_count":18395473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["smartthings-smartapp-example","webhook"],"created_at":"2024-11-07T11:14:42.580Z","updated_at":"2024-12-28T03:22:50.606Z","avatar_url":"https://github.com/SmartThingsCommunity.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Open/Close Lighting Control\n\nThe following example SmartApp 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). This simple automation is used here as a brief functional showcase of a SmartApp using the Node SDK, and is 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.\n\n## Start\n\nTo get going quickly with this example, we've provided a few options for hosting below. Follow any one of them to get the app up and accepting requests before moving on to registration instructions.\n\n### Heroku\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)\n\n[View logs](https://devcenter.heroku.com/articles/logging#log-retrieval-via-the-web-dashboard) in the Heroku dashboard.\n\nClick the **Open app** button in the Heroku dashboard app page to copy the public URL for use in steps below.\n\n### Glitch (no account required)\n\n[![Remix on Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button.svg)](https://glitch.com/edit/#!/import/github/SmartThingsCommunity/smartapp-example-open-close-nodejs)\n\n[View logs](https://support.glitch.com/t/console-log-where-to-find-it/14456) in the Glitch editor.\n\nCopy the [Live Site URL](https://glitch.happyfox.com/kb/article/50-how-do-i-find-the-url-for-my-app/) from Glitch for use in steps below.\n\n### Local\n\nTo make this work locally, we recommend using [ngrok](https://ngrok.com/) to create a globally available URL for fast testing.\n\n`npm install`  \n`npm start`  \n`ngrok http 3001`\n\n## Register\n\nFollow the instructions for [registering a SmartApp](https://smartthings.developer.samsung.com/docs/smartapps/app-registration.html) with the SmartThings platform.\n\n- The following OAuth2 scopes are required.\n    - `r:devices:*` \n    - `x:devices:*` \n\nA `CONFIRMATION request` log should show in the log output of the server once registered. Navigate to this link to [verify your domain ownership](https://smartthings.developer.samsung.com/docs/smartapps/webhook-apps.html#Verify-your-domain-ownership) and enable the app to receive events. **This is required for successful installation.**\n\n## Test\n\nFollow the instructions for [testing a SmartApp](https://smartthings.developer.samsung.com/docs/testing/how-to-test.html).\n\n## File Structure\n\n* smartapp.js \u0026mdash; the SmartApp implementation\n* server.js \u0026mdash; the Express server that hosts the SmartApp as a web-hook\n* locales/en.json \u0026mdash; English version of the app configuration page text","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartthingscommunity%2Fsmartapp-example-open-close-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartthingscommunity%2Fsmartapp-example-open-close-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartthingscommunity%2Fsmartapp-example-open-close-nodejs/lists"}