cycling a relay with commands or a script

  • My intrusion system can send http get commands, but has no pause option between commands.

    If I send the Pro the command to turn on for 2 seconds

    followed by the command to turn off the relay for 2 seconds the 2nd command overrides the on command...


    which led me to discover if the relay is off, and you send a 2-second off command the relay will power on in 2 seconds.

    (that seems to be odd) If the relay is off, then it should not turn the relay on after 2-seconds..

    It seems I may need a script that will cycle the relay on & off a number of times.

    I found a sample script in the library, but it uses a switch input.

    htto

    I am a shelly newbie, and was wondering if a script can be triggered from an HTTP command?

  • What are the individual http commands they you use and what cycle are you trying to achieve for what duration?

  • and was wondering if a script can be triggered from an HTTP command?

    example here:

    Seven of Nine
    10. März 2023 um 18:06

    >100 Shellies, darunter so gut wie alles was der Hersteller produziert hat. ;)
    :!: ich beantworte grundsätzlich keine Fragen per persönlicher Nachricht:!:

  • What are the individual http commands they you use and what cycle are you trying to achieve for what duration?

    Hi there!

    I have been trying to figure out how to use Shelly scripting to mimic some Tasmota functionality (specifically the Blink command). Thanks for sharing (in your signature) a link to some useful HTTP requests. Rather than flashing my Shelly Plus 1 devices with Tasmota, I was hoping to achieve the following via direct http requests or by creating some scripts I can call via http request. However, documentation is a bit confusing for n00bs such as myself and was hoping to get some guidance from the pros.

    I need to blink (pulse the shelly relay switch) a certain number of times - ideally I could define this number within the request rather than having to create a new script for each option. Basically, in some cases I will need to pulse the relay 5 times, sometimes 10 times etc - so being able to define this "Blink Count" as in Tasmota would be ideal. Here's an example of a Tasmota request I'm using right now:

    Code
    GET:http://192.168.xxx.xxx:80/cm?cmnd=Backlog%20BlinkCount%202%3B%20BlinkTime%202%3B%20Power%203

    This command will tell the Shelly to pulse/blink the relay 2 times, in 0.2 second increments, and then return the power state back to its pre-blink state.

    For reference, here's the command list for Tasmota (https://tasmota.github.io/docs/Commands/#commands-list)

    Is something like this achievable with Shelly Scripting? If so - any guidance would be appreciated - I am not looking for the code (although would graciously accept it if provided :) ) - I'm happy to learn and figure it out with some pointers.

    Thanks in advance for any help!

    UPDATE: I was able to leverage some examples in the wild and ChatGPT to craft a script to do what I need. However, unlike the Tasmota request which passes the variable values in the HTTP request, the script has the values for BlinkCount and BlinkTime in there. Is there a way to pass variables values via the web request to a script?

    Something like:

    Code
    GET http://192.168.33.1/rpc/Script.Start?id=1&BlinkCount=10&BlinkTime=2

    Thanks!

    Einmal editiert, zuletzt von sparq (21. Juni 2023 um 22:07)