How to write a URL script for a Shelly Botton using a Shelly 1PM to turn a light on or off

  • Hi,

    My name is Terry and i am new to this and love the product.

    I am doing some testing with a Shelly 1PM and a Shelly Botton controlling a light. I wanted to turn the light on and off using the Shelly button.

    I know you need to put in the IP and some script telling it to turn on or off.

    Just can't find anything that can teach me the simple scripts I need.

    My home IP just say is 10.20.30.10 to 10.20.30.100

    My Botton is 10.20.30.15

    My1PM is 10.20.30.20

    Any help would be great.

    Thanks

    Terry

  • Hello Terry and welcome to forum

    You can create a webhook command to shelly button1 actions (I presume you mean to have Shelly Button1?) with following syntax:
    http://[Shelly1PM_IP]/relay/0?turn=toggle

    replace [Shelly1PM_IP] with relay IP address (10.20.30.20)
    That will toggle relay on/off with each press

  • Thanks for the welcome.

    Just tried it and it worked so thanks for the script.

    I assume I can add this to all the buttons just changing the IP address of each device in the script.

    I tried finding this line but couldn't. Do you have a link or documentation so I can try and learn more of the commands.

  • HI mitrossilis, welcome to the forum. :)

    Please get used to using correct terms straight away:

    The proposed solution or your question is not a script but http requests for webhooks (formerly called actions in Shelly of the 1st generation)

    Scripts are also optionally used with Shelly of the 2nd generation (= PLUS and Pro devices).

    Do you have a link or documentation

    Have a look here:

    HTTP-Request - overview

    Have a nice sunday.