Skip to content

Instantly share code, notes, and snippets.

@liddiard
Last active August 8, 2025 19:56
Show Gist options
  • Select an option

  • Save liddiard/b7f80a18b9713dbf5489f85f3077f95d to your computer and use it in GitHub Desktop.

Select an option

Save liddiard/b7f80a18b9713dbf5489f85f3077f95d to your computer and use it in GitHub Desktop.

Revisions

  1. liddiard revised this gist Aug 8, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shelly_door_unlock.js
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    // Simultaneously close for a few seconds, then open multiple relays to simulate an "open door" button press

    const relays = [0, 1]
    const relays = [0, 1];

    for (const relayID of relays) {
    // https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Switch/#switchset
  2. liddiard renamed this gist Aug 7, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. liddiard created this gist Aug 7, 2025.
    17 changes: 17 additions & 0 deletions door_unlock.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // 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()
    });