Jump to content

Recommended Posts

Posted

here you go this is a script for that a shelly 1 

 

let onTime = 60 * 1000;  // ON duration in milliseconds (60 seconds)
let offTime = 30 * 60 * 1000;  // OFF duration in milliseconds (30 minutes)

function controlRelay() {
    // Turn relay ON
    Shelly.call("Switch.Set", { id: 0, on: true });
    print("Relay turned ON");
    
    Timer.set(onTime, false, function () {
        // Turn relay OFF
        Shelly.call("Switch.Set", { id: 0, on: false });
        print("Relay turned OFF");
        
        // Schedule next ON
        Timer.set(offTime, false, function () {
            controlRelay();  // Restart the process
        });
    });
}

// Start the process when the script runs
controlRelay();

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...