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,

    Running on a Shelly Pro 1PM with firmware 1.11 (20220830-131534/0.11.0-gfa1bc37), I gave KVS a try.

    I have noticed several times, where all KVS variables were lost:

    Code
    $ curl -s 'http://$SHELLY/rpc/KVS.List' | jq .
    {
      "keys": {
        "scripts-library": {
          "etag": "64qBCCQKaC"
        }
      },
      "rev": 35
    }

    I have identified two cases where it happens:

    * The 1st one, when doing some tests I've made a syntax error inside the callback function of a KVS.Get call. The script has crashed (that's normal) but all the KVS storage was voided immediately after. only the rev field was kept.

    * The 2nd one has happened this night, the house has suffered a power outage during a storm. Once Shelly was back to life, all KVS storage was empty.

    If it can help, here the script I'm currently running:

    https://git.grandou.net/gilles/shelly_…ch/main/pool.js

    * 2 KVS.Get calls are performed on startup

    * 1 KVS.Set upon a new temperature change from a mqtt message, a few times per day

    * 2 KVS Set after midnight

    Thanks for any hint to improve reliabilty ;)

  • Hi ggilles!

    Ever tried to delay the request from the storage after start? Maye there are some internal tasks to be done before you can access the storage? Just an idea... What happens if you restart your script a second time? Is the data then valid?

    Good luck!


    Regards from Vienna

    Christian

    ----------

    ... wir regeln das!

  • Zitat

    Ever tried to delay the request from the storage after start? What happens if you restart your script a second time?

    nope, once it's gone it permanent, restarting the script changes nothing. And KVS looks like to be ready at startup, because it's not really empty: it's pre-poluated with default content (script-library entry for instance), it's just that all user entries have disappeared.


    I was wondering if, in my script, two parallel KVS.Get calls could be an issue. but:
    * it looks like to work in normal case

    * the 1st fail I've seen (with the typo error) was created from a test script with only call.

  • I've seen the same thing.

    For me it seems to be related to storing objects in the KVS value.

    If object properties are access directly the script crashes and clears the KVS store.

    This works:

    Code
    Shelly.call (
         "KVS.GetMany"
         { match: 'M_*' },
         function (result, error_code, error_msg, ud) {
            if (result) {
               for (let KVS in result.items) {
                    let data = result.items[KVS];
                    data = data.value
                    if ( data.DoW !== DayOfWeek(ud.ts) || data.HoD !== HourOfDay(ud.ts) ) {

    This causes the bug to manifest for me:

    Code
    Shelly.call (
         "KVS.GetMany"
         { match: 'M_*' },
         function (result, error_code, error_msg, ud) {
            if (result) {
               for (let KVS in result.items) {
                    let data = result.items[KVS].value;
                    if ( data.DoW !== DayOfWeek(ud.ts) || data.HoD !== HourOfDay(ud.ts) ) {

    It's a bit strange.....