Reboot and/or powerdown event possible?

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.

  • Hello,

    I have a question

    Is it possible to get an event in the script before a reboot or an abort due to a power failure?

  • Hallo Mamajuana,

    If there's a power failure or reboot, all connections will close right away, so events won't be helpful.

    But you could try streaming your debug log via UDP or MQTT if that of any help for you.

    You can also check the last crash issue of scripts by using "http://192.168.178.23/rpc/Script.GetStatus?id=1" after a Crash on a forced stopped script

    Einmal editiert, zuletzt von _[Deleted]_ (21. Februar 2024 um 11:44)

  • @De kat

    Dear Dekat,

    My requirement is not to recognize whether a reboot or power failure has occurred.

    I would like to carry out an action on each of these events before carrying out these events.

    As a rule, values are saved in the flash. (KVS)

    The reason is that the write cycles of the flash are limited until it becomes defective.

    For example, saving balanced [saldieren] kwh values with as few inaccuracies as possible.

    (Normally it is saved every 15 minutes.

    Example: if 14 minutes are missing with 25 kW power (due to reboot or power failure) > 6 kWh are lost in the result.)

    An event before performing a reboot is basically just a software matter.

    An event after a power failure could trigger an event if the processor continues to live for a few milliseconds through a buffer (capacitor).

    I am currently getting around the problem by storing this value in KVS not depending on time but only depending on kWh consumed/produced.

    Keep the possible value-errors and KVS write cycles as low as possible.

    I hope you understand my requirements profile.

  • I would like to carry out an action on each of these events before carrying out these events.

    Yeah, I understand your point. However, a power failure or even a reboot typically results from an unplanned crash, so the Shelly isn't aware of when it will happen. As a result, it can't generate any events for this scenario. In most cases, you'd be fortunate if the device had sufficient time to safeguard itself properly before the crash.

    There are a few exceptions, under certain circumstances, the Shelly itself triggers a reboot, such as during a firmware update or when changing some connection settings, etc. In such cases, an event is probably generated. I've never looked into this direction, but I may have seen one of them in a debug log. However, these are rare occurrences. You could try to catch these events, but there isn't much time to do anything because the device restarts immediately at that event.

    Regards,

    Tim

  • @Mamajuana

    What could really help in your case is this feature here:

    - Implementation of an "Enhanced Security" option to block or disable all RPC, configuration, and connection control commands (MQTT, AP, WIFI), restarts, reset, or other critical RPC commands, regardless of their source (cloud, loopback, local, MQTT, WebSocket, etc... Factory reset via the buttons is, of course, excluded from this.)

    The "Enhanced Security" feature should only be activatable via the local web interface if a valid device password is present.

    How about submitting a feature--> request ticket <--for this, where you also explain why your Shelly shouldn't just restart without your permission?

    The more people advocate for stronger security measures on Shelly devices, the higher the chances are that something will change in this regard.

    --> https://support.shelly.cloud/de/support/tic…r_ideas_only%29

    Einmal editiert, zuletzt von _[Deleted]_ (21. Februar 2024 um 11:58)

  • Dieses Thema enthält einen weiteren Beitrag, der nur für registrierte Benutzer sichtbar ist.