Skip to main content

Welcome!

Scene Scripting enables programmable logic within automation workflows. It extends standard scene capabilities by supporting dynamic behaviors, runtime condition evaluation, device state management, and multi-device orchestration.

This documentation covers script architecture, device interaction, and implementation practices for advanced automation scenarios.

The scripting transforms the scenes from static configurations into flexible, programmable automation units that can adapt to a wide range of scenarios.

info

All Scene Scripts are written in JavaScript, allowing you to use familiar syntax and logic structures to build powerful automations.


Example

The following script demonstrates the basic structure of a Scene Script. It triggers once when a specific device turns ON and logs a message to the console.

hello-world.script.js
var light = Shelly.getDevice("x"); // Replace "x" with your Device ID

light.setTriggerOnce("on");

Shelly.sendPhoneStandardNotification("Hello World! The light has been turned on.");

To deploy this:

  1. Open the Script Editor.
  2. Create a new Custom Script.
  3. Map your device ID to the light variable.
  4. Save and Start the script.