bioncrafts.blogg.se

Smartthing smartapp environment
Smartthing smartapp environment






  1. #Smartthing smartapp environment install
  2. #Smartthing smartapp environment manual
  3. #Smartthing smartapp environment full
  4. #Smartthing smartapp environment registration
  5. #Smartthing smartapp environment code

  • Proper setup and use of 'dotenv' to safely store security data away from repository.
  • Proper seperation of 'development' vs 'production' libraries for efficient and minimal runtime env.
  • Stable VSCode integration, ready for use with npm, yarn and eslint (and other) VSCode plugins.
  • #Smartthing smartapp environment code

    Complete and Accurate (hopefully, I tried!) SmartThings setup documentation with images and code snippets.Strict ESLint configuration and adherance (NOTE: should integrate ESLint into git commit hooks).Configured to run with new, experimental ESM support coming standard in pending Node minor release.

    #Smartthing smartapp environment full

  • Full TypeScript application, almost entirely accurate TS definitions used.
  • Proper node express server, with middleware options (NOTE: No authorization configured SEE NOTE BELOW).
  • Allows multiple installs of the app, in this example allowing many simlar rulesets to be defined for different locations in a home/office.
  • Implementation of new Rules API that creates rules directly from SmartApp configuration.
  • Functional Samsung SmartApp Developed On Current Platform and API.
  • When you make changes to the server/smartapp, and restart you do not need to uninstall or re-install a working development app.

    #Smartthing smartapp environment registration

    If you do so, you will need to follow steps above to re-verify your App Registration with the new URL after NGrok restarts. You do not want or need to restart the yarn tunnel task.

  • You must do this every time you start/restart yarn tunnel task which includes every time you run the main yarn start commandįinally! You are ready to develop! Once you make changes, you need to stop and start ONLY the yarn server task.
  • (Re)Verify The App In Samsung Developer Workspace.
  • alternatively, you can run individual parts of the yarn start command above to control each part individually.
  • yarn start from the top-level directories will start entire dev environment in a single console session (using concurrently).
  • #Smartthing smartapp environment install

    client & yarn (to install client-level npm dependencies) server & yarn (to install server-level npm dependencies)

  • yarn (to install the top-level npm dependencies).
  • Run all of these from the package.json located in the 'server' directory ( cd server or point-click from VS code UI)

    #Smartthing smartapp environment manual

    (TODO: Find a better way to deal with this manual coupling)Ĭontinue to the 'Everyday development instructions' below.

    smartthing smartapp environment

    Modify package.json edit the yarn tunnel script set YOURPORTFROMENVCONFHERE to the value you set above in Step #3 for PORT.

  • Setup a Samsung PWT (TODO: document this process).
  • Setup The App In Samsung Developer Portal Replace LOCALIPLIST with a comma-separated list of IPV4, IPV6 and CIDR-Range addresses (i.e. Replace in SETLOCALPORTNUMBER with a local port of your choosing (suggest anything 5000-64000).
  • this service sets up a secure tunnel that is required for proper OAuth communication between Samsung Cloud, your SmartThings Hub and your locally running development web-serverĬreate a file named server/.env.local containing the following text.
  • smartthing smartapp environment

    This is required assuming your development environment does not have a public-facing internet address.Latest version of NodeJS installed on your computer (must be version 14+)ĭownload NGrok and put the ngrok.exe program in the /server subdirectory and set up a FREE account, then configure NGrok according to the basic setup instructions on the download page.This example cannot be hosted on automated web hosting platforms like other SmartThings Community examples. I attempt to layout the explicit steps necessary to get a local development environment up and running.

    smartthing smartapp environment

    These steps are intentionally different than may of the example SmartApp Community examples. However, none of those apps really put things together in a real world use-case which is what this example intends to do. For developers just wandering into the Samsung SmartThings developer space it may come across as overly-complicated and you may find better resources at the SmartThings Community GitHub for introductary purposes. This is targeted at hobbiest SmartApp developers who may be interested in a full-scale working application example. This code is a static long-running branch that has been pruned down to illustrate a working SmartApp that interfaces with the Rules API and creates a practical rule-set that I use for my needs. I attempted to branch this while the Rules SmartApp was still fairly isolated before I really move forward mixing it with the FrontEnd and other SmartApp in the main branch. This code is branched off my working main repository which contains a much more complex dual SmartApp setup with a React client Front-End that integrates with another SmartApp that was removed from this branch. SmartThings SmartApp Rules API Example DESCRIPTION








    Smartthing smartapp environment