This SmartApp is an example of how to use the SmartThings API to create a virtual device that represents the current power usage of a home. It also shows how to create a virtual device that represents the power production of a home's solar panels. These devices integrate with the SmartThings Energy service in the SmartThings mobile app.
- definitions
- apps
- lambda.json — example Lambda SmartApp definition
- webhook.json — example WebHook SmartApp definition
- profiles
- i18n
- en.json — defines friendly names for the power meter device profile components
- power-meter.json — power meter device profile definition
- solar-panel.json — solar panel device profile definition
- i18n
- apps
- locales
- en.json — English version of the app configuration page text
- src
- handlers
- monthly-reset.js — scheduled event handler that resets the energy usage at the first of each month
- page1.js — handler for SmartApp configuration page
- uninstaled.js — handler called when the app is removed from a location
- updated.js — handler called when the app is installed or updated
- lib
- device.js — creates energy meter and solar panel devices
- house-model.js — simulates house energy usage
- solar-panel-model.js — simulates solar panel energy production
- index.js — AWS Lambda handler that calls the SmartApp
- server.js — web server that calls the SmartApp
- smartapp.js — the SmartApp implementation
- handlers
- test — unit tests
- .env — environment variables used by the server
- .env.example — example .env file
- .gitignore — files to be ignored by git
- package.json — NodeJS package definition
- README.md — this file
- serverless.yml — Serverless configuration file for deploying to AWS Lambda