Quantcast
Jump to content

Introducing the New SmartThings Core SDK for JavaScript.


STF News
 Share

Recommended Posts

stCoreSDK_banner9.png

The new SmartThings Core SDK for JavaScript is now available as a developer preview. With the new Core SDK, you can easily integrate the core SmartThings REST APIs into your JavaScript applications. We’ve built the SmartThings Core SDK with professional developers and hobbyists alike in mind - so that you can freely control and automate thousands of Works with SmartThings devices from your web server, Express app, and more.

Let’s say you wanted to build a dashboard and display all of your SmartThings devices. Here is a sample Node app to get you started - you can use the below code with an OAuth or PAT token to get a list of devices:




Getting Started

If you want to jump right in, we recommend using npm to install the Core SDK for JavaScript.

npm install @smartthings/core-sdk

You can use the Core SDK for JavaScript Wiki to learn more about all of the endpoints available. If you are not sure where to start, visit the SmartThings Community for video tutorials and ideas.

The SmartThings development team has put a lot of effort into building this SDK - we are excited to share it with you. Now, we invite you to start building, ask questions on the SmartThings Community, and provide open feedback.

Thank You!

View the full blog at its source

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Similar Topics

    • By STF News
      By Patrick Barrett, Robert Masen, and Zach Varberg
      How we got here
      Last month, we announced the launch of SmartThings Edge! Looking back, SmartThings provided a few different ways to integrate devices onto the platform. For Hub Connected devices we have always used Device Type Handlers (DTHs). These were written in Groovy and would run in a sandboxed environment on the SmartThings Cloud. While Groovy DTHs helped us launch SmartThings, they presented special challenges for local execution on the hub.
      With the ongoing work to modernize the platform and move away from legacy systems, we wanted to provide a better way to handle devices. Similar to DTHs, we looked to provide a way for developers (both internal staff and partners) to define the behavior of a Hub Connected device through some combination of data and code. Given that one of our primary goals is to support the execution of these on hubs—which we see as the edge of the SmartThings platform—we decided to call these “Edge Drivers.”
      We set out to engineer a solution that would be able to deliver the developer and user experience that we were looking for. As you may have guessed from the title, Edge Drivers are built around Lua © as the programming language... So why Lua?
      Simple
      The Hub is a resource-limited environment. With the need for users to potentially run many Edge Drivers at a time, we were looking for something lightweight.
      Lua has a small set of core structures and functionality. This leads to a small footprint, which works well for executing on hubs. With the core language being pretty small, it is pretty easy for developers to learn. Additionally, as an interpreted language, developers building Edge Drivers do not need to worry about compiling their code.
      Embeddable
      It should not come as a surprise that the SmartThings hub platform software is a complex system. It is responsible for managing many aspects of how devices connect and execute within the SmartThings platform. Most of this software is written in Rust and C (stay tuned for more on this in the future!) and we needed something that would work well in this environment.
      When looking for solutions, we began by investigating “prior art” to answer the question: Are there other complex systems out there that needed to solve a similar problem, and if so, what did they do? We have a set of core functionality that needs to execute in a performant manner (HubCore), but want to allow extensions that give developers the tools to build unique use cases (Device Drivers).
      We found that Lua had been extensively used in the video game industry (along with other non-video game software) as a way to allow developers to extend existing functionality—which is exactly what we were looking for! This means that Lua could work well with C and Rust, allowing your Hub to run extensions with a minimal impact to the existing hub software.
      Safe
      Historically, all locally executing DTHs were either written or reviewed by our engineering teams. Allowing users to run code locally on their hub that we did not write, review, and test brings up complex questions about boundaries and guardrails. As a result, it was important to identify a solution that we could sandbox—that is, lock the untrusted code in a room where it cannot hurt anyone else.
      Lua itself provides some opportunities to tweak and limit the runtime. In addition to this, we wrap all Device Drivers in a second, more secure sandbox layer, with a coherent API to further protect hubs in instances where we did not believe the built-in options were enough.
      Learn more
      You can visit the SmartThings Community to learn more about integrating your Zigbee, Z-Wave, and LAN devices with SmartThings Edge. Lua is free software distributed under the terms of the MIT license. If you want to learn more about developing with Lua, we recommend getting involved with the Lua Community.
      View the full blog at its source
    • By STF News
      Last year, we told you that we are transitioning to an API-first SmartThings platform. As a part of this, we started investing deeply in improving stability and security. We are excited to announce the beta release of SmartThings Edge, a new architecture for hubs that uses device drivers and rules to execute hub-connected devices locally.
      What is SmartThings Edge?
      We are taking smart home events that would have happened on the SmartThings Cloud and moving them to your SmartThings Hub. SmartThings Edge uses Lua©-based device drivers and our Rules API to control and automate devices connected directly to a SmartThings Hub. This includes Zigbee, Z-Wave, and LAN devices as well as automations triggered by timers and other hub-connected devices using drivers. In the future, this will expand to include more protocols and features, like the new Matter standard.
      For users, edge processing means reduced latency. For partners and developers, SmartThings Edge also brings new benefits, including reduced cloud costs, an improved device permissioning model, and the ability to deploy updates to their drivers. Local device support is open to everyone—not just WWST partners—enabling easier device support and integration with standard capabilities.
      Hub-Connected devices are defined by a driver package that includes the fingerprints, components, preferences, and Lua source code. With this beta release, you can start testing features and providing us feedback before we start the platform migration. As a WWST partner, you can create your own driver package or add your device’s fingerprint to our predefined supported drivers.
      Building Hub-Connected Devices

      To get started, all you need is a SmartThings Hub with firmware version 000.038.000XX or greater and a Zigbee, Z-Wave, or LAN device. Visit the SmartThings Community to learn how to get started with the SmartThings CLI and building drivers.
      Rules and Automations

      As part of our June SmartThings app release, you may have noticed that some of your automations show a little 🏠. This means the automation is using locally-executing conditions and actions, such as time of day. As your devices begin using drivers and compatible rules, they will begin running on your hub, meaning higher reliability and faster response times.
      We have started expanding the Rules API to include new operations, including: risesAbove / dropsBelow, risesToOrAbove / dropsToOrBelow, and securityState. To learn more, visit these sample rules.
      Sharing and Distribution
      Previously, sharing device type handlers (DTH) required end-users to copy and paste the code for each individual DTH into their accounts. This could be confusing and time-consuming for users to ensure they had the latest updates installed. With SmartThings Edge, we are also introducing driver sharing for device testing and community distribution.
      OEMs can submit their drivers to SmartThings for WWST certification and distribution in the SmartThings catalog. However, hobbyists can now share custom devices with a simple link—no need to copy and paste code! Learn more about driver sharing and how you can start testing Edge drivers.
      Getting Started

      Along with this launch, we’ve also released a new Developer Documentation Portal.
      To learn more about building SmartThings Edge devices and automations, check out our new developer documentation portal. This includes a new Capabilities Reference Guide that clearly delineates between live, proposed, and (soon-to-be) deprecated capabilities. Visit the new Documentation Portal and the SmartThings Community for tutorials, code samples and more.
      Have feedback? Reach out to us on the SmartThings Community and share your projects with @SmartThings on Twitter!
      View the full blog at its source
    • By STF News
      The new SmartThings Core SDK for JavaScript is now available as a developer preview. With the new Core SDK, you can easily integrate the core SmartThings REST APIs into your JavaScript applications. We’ve built the SmartThings Core SDK with professional developers and hobbyists alike in mind - so that you can freely control and automate thousands of Works with SmartThings devices from your web server, Express app, and more.
      Let’s say you wanted to build a dashboard and display all of your SmartThings devices. Here is a sample Node app to get you started - you can use the below code with an OAuth or PAT token to get a list of devices:



      Getting Started
      If you want to jump right in, we recommend using npm to install the Core SDK for JavaScript.
      npm install @smartthings/core-sdk You can use the Core SDK for JavaScript Wiki to learn more about all of the endpoints available. If you are not sure where to start, visit the SmartThings Community for video tutorials and ideas.
      The SmartThings development team has put a lot of effort into building this SDK - we are excited to share it with you. Now, we invite you to start building, ask questions on the SmartThings Community, and provide open feedback.
      Thank You!
      View the full blog at its source
×
×
  • Create New...