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

Hinweis zur Nutzung von Skripten (für Nutzer)

Die Verwendung von Skripten erfolgt ausdrücklich auf eigene Gefahr. Weder Shelly noch die jeweiligen Autoren oder Entwickler der Skripte übernehmen irgendeine Form der Haftung für mögliche Schäden, Fehlfunktionen, Datenverluste oder anderweitige Beeinträchtigungen, die durch die Nutzung dieser Skripte entstehen könnten. Bitte stellen Sie vor dem Einsatz sicher, dass Sie den Quellcode verstehen und sich der möglichen Auswirkungen bewusst sind. Die Skripte werden ohne Gewähr bereitgestellt und unterliegen keiner regelmäßigen Wartung oder offiziellen Unterstützung.


Hinweis für Entwickler

Wenn Sie eigene Skripte bereitstellen, achten Sie bitte darauf, eine klare Beschreibung, eventuelle Einschränkungen und Sicherheitsaspekte zu dokumentieren. Beachten Sie zudem, dass Nutzer Ihre Skripte grundsätzlich auf eigenes Risiko verwenden. Eine Haftung für Schäden ist ausgeschlossen, sofern diese nicht vorsätzlich oder grob fahrlässig verursacht wurden oder gesetzlich anderweitig geregelt ist.

VPN/Proxy erkannt

Es scheint, dass Sie einen VPN- oder Proxy-Dienst verwenden. Bitte beachten Sie, dass die Nutzung eines solchen Dienstes die Funktionalität dieser Webseite einschränken kann.

  • 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.