Skip to content

Instantly share code, notes, and snippets.

@liddiard
Last active August 8, 2025 19:56
Show Gist options
  • Save liddiard/b7f80a18b9713dbf5489f85f3077f95d to your computer and use it in GitHub Desktop.
Save liddiard/b7f80a18b9713dbf5489f85f3077f95d to your computer and use it in GitHub Desktop.
Script for the Shelly Plus Uni board that triggers a door unlock when wired to an apartment unit call box.
// Simultaneously close for a few seconds, then open multiple relays to simulate an "open door" button press
const relays = [0, 1];
for (const relayID of relays) {
// https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Switch/#switchset
Shelly.call("Switch.Set", {
id: relayID,
on: true,
toggle_after: 5, // turn off after 5 sec
});
}
// https://shelly-forum.com/thread/20984-how-to-instruct-to-end-script-within-script-itself/
Shelly.call('Script.Stop', {
id: Shelly.getCurrentScriptId()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment