StackState is built to deal with a wide variety of different situations. StackState comes with functions to stay flexible enough to account for different types of logic.
Functions are predefined scripts that transform input into an output. Functions are called by StackState on-demand. For example, when a component changed state, some new telemetry flowed in or when the user triggered an action.
Functions give power-users the ability to customize StackState fully. However, everyday users of StackState should not need to know that they exist.
StackPacks pre-package functions and automatically install functions on StackState whenever the StackPack gets installed. You can develop your function in StackState. When you are confident that it does what you want, you can export it and package it with a StackPack. Read more about it on how to create StackPacks page.
Traditionally functions in StackState were written in a synchronous blocking manner. This limited the capability of what these functions can achieve and how many of these functions can be run in parallel. StackState started supporting a new kind of function called async functions that allow anyone to access the Script APIs. The following functions have started supporting the async mode and no longer allows you to edit the older (legacy) synchronous function anymore, though the older synchronous functions will remain working.
The following functions do not support async mode: