Shelly Scripting - Overview

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.

  • Hello, hello! It is Dimitar Stanishev here from the Shelly Support team. We would like to provide you with more explanation of the new feature, which our Plus and Pro series will have. It is "Shelly Script" and below you can find more information.

    Developing a solution that uses complex logic or inter-component interactions that are asynchronous in time requires flexibility that can not easily be provided by constantly complicating the underlying OS of the device. As with any other software system, the "user space" software solution(s) are better suited to implement logic that is specific to the use case and can be developed by the end-user.

    The natural solution to the complexity of users' "job to be done" is to distribute the computational load of the solution building process. We here just can't be that smart to come up with all the right formulas. So we empower our users to create solutions by deploying scripts on Shelly devices (second generation). Actually, we don't know of any other device that offers that at the moment.

    Now you can have even more of the _creative autonomy_, which has been one of the main success product themes of our products. We don't want to tell you how to solve the problem, we don't want you to use a third-party integration, we don't want you to buy a hub.

    ## What is a "Shelly script"?

    A script is a program, written in a subset of JavaScript, which is a tried and proven technology - Mongoose OS, the same stack that we have the rest of our devices built on. The secret sauce is the exposure of the RPC APIs to the script. And the extra needed functionality - HTTP.GET (soon POST), Timers for scheduling, the ability to use the local web interface of the device to upload, edit and manage running scripts.

    We will publish links to the documentation and repository with examples in the coming days.

  • iamheretohelp 17. September 2021 um 09:29

    Hat den Titel des Themas von „Shelly Scripting - Overview and explanation“ zu „Shelly Scripting - Overview“ geändert.
  • Hi..

    i am missing some example code for "HTTPServer" i have found "https://shelly-api-docs.shelly.cloud/gen2/Scripts/S…ures#httpserver" and it does work some.. but it seems, i have to send back 200 http code(header) to get the browser to stop hanging(it waits).. i have try'd some i have prev used..and i have not been able to finde anything via google.

    also im unsure how to get the http post/get data info as a variable.. im GET like so "http://10.0.1.153/script/1/tester?test3"

    i can normalle code in php/python/javascript/bash but i am unfamiliar with msj/HTTPServer.

  • Hi..

    i am missing some example code for "HTTPServer" i have found "https://shelly-api-docs.shelly.cloud/gen2/Scripts/S…ures#httpserver" and it does work some.. but it seems, i have to send back 200 http code(header) to get the browser to stop hanging(it waits).. i have try'd some i have prev used..and i have not been able to finde anything via google.

    also im unsure how to get the http post/get data info as a variable.. im GET like so "http://10.0.1.153/script/1/tester?test3"

    i can normalle code in php/python/javascript/bash but i am unfamiliar with msj/HTTPServer.

    Hi Harryl,

    I have just posted a working example with HTTPServer.registerEndpoint for a Shelly Plus 2PM here: Endlich: HTTPServer.registerEndpoint - User Scripte - Offizielles Shelly Support Forum (shelly-forum.com)

    Maybe this helps you a bit? The text is in German, but the most important things are commented in the script itself in English.

    Good luck

    Christian

    ----------

    ... wir regeln das!

  • Hi Harryl,

    I have just posted a working example with HTTPServer.registerEndpoint for a Shelly Plus 2PM here: Endlich: HTTPServer.registerEndpoint - User Scripte - Offizielles Shelly Support Forum (shelly-forum.com)

    Maybe this helps you a bit? The text is in German, but the most important things are commented in the script itself in English.

    Good luck

    Christian

    ChrisK2 Thank you for the example. Unfortunately, it does not work for me at all. I have a Plus 1PM and a Plus 2PM with 0.10 3 firmware. I tried on both. I get the following error and the script does not start: "MJS error: [HTTPServer] is not defined". Do you have any idea why? Does it require any configuration setting?

    Harryl Could you get it to work?

    2 Mal editiert, zuletzt von Tamas (16. Oktober 2022 um 12:34)

  • Dieses Thema enthält 8 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.