A small collection of JavaScript scripts for Shelly Gen2/Gen3 devices and home automation use cases.
The repository consolidates three previously separate repositories:
| Folder | Purpose | Main files |
|---|---|---|
scripts/wifi-presence |
Turn on a Shelly-controlled light when a car Wi-Fi SSID or BSSID is detected nearby. | wifi-ssid-presence.js, wifi-bssid-presence.js |
scripts/hue-control |
Control Philips Hue lights from Shelly wall switches, with physical relay fallback if the Hue Bridge or Wi-Fi is unavailable. | hue-api-v1-control.js, hue-api-v2-control.js |
scripts/impulse-relay |
Integrate Shelly devices with existing impulse / step-by-step relays while preserving physical button control. | impulse-relay-control.js |
Each folder contains a dedicated README with setup and configuration details.
These scripts may control mains-powered lights, relays, or devices. Electrical work can be dangerous and must follow local regulations. Disconnect power before wiring, use properly rated hardware, and involve a qualified electrician when in doubt. Test each script with a safe load before relying on it in production.
These scripts target Shelly devices with scripting support, especially Shelly Plus / Pro / Gen3 devices. Check the README in each script folder for device-specific prerequisites.
| Script folder | Expected devices | Notes |
|---|---|---|
wifi-presence |
Shelly Plus / Pro / Gen3 devices with scripting and Wi-Fi scanning support | Designed around garage / courtesy-light use cases. |
hue-control |
Shelly Plus / Gen3 relay devices with scripting support | Requires a Philips Hue Bridge and local network access. |
impulse-relay |
Multi-channel Shelly Pro / Gen3 devices with scripting and Virtual Boolean components | Requires correct detached-mode wiring and Auto-OFF output impulses. |
- Open the folder for the script you want to use.
- Read its README and configure the variables at the top of the JavaScript file.
- In the Shelly web interface, go to Scripts.
- Create a new script.
- Paste the JavaScript content.
- Save, enable and test it on the device.
See CONTRIBUTING.md for repository conventions, local checks, and safety notes.
This repository is distributed under the GNU General Public License v3.0. See LICENSE.
The Hue control script is derived from work originally published by Laurent Broering in laurentbroering/shelly_hue. See scripts/hue-control/ATTRIBUTION.md.