Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Logging Information auf NAS (Synology)

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Logging Information auf NAS (Synology)

    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      knowhowseeker last edited by Homoran

      Ich habe es geschafft, dass ich in Shelly Skripts Fehlerinformationen auf dem NAS speichern kann.

      Die Einstellungen auf dem NAS benötigen das folgende PHP:

      <?php
      if ($_SERVER['REQUEST_METHOD'] === 'POST') {
          $data = json_decode(file_get_contents("php://input"), true);
          $logfile = "/volume1/web/shelly_logs.txt";  // Speicherort für Logs
      
          if (!empty($data['log'])) {
              $log_entry = date("Y-m-d H:i:s") . " - " . $data['log'] . "\n";
              file_put_contents($logfile, $log_entry, FILE_APPEND);
              echo "Log gespeichert!";
          } else {
              echo "Keine Log-Daten empfangen.";
          }
      } elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
          echo "Log-Receiver läuft! Sende eine POST-Anfrage mit JSON-Daten.";
      } else {
          http_response_code(405);
          echo "Method not allowed";
      }
      ?>
      

      MOD-EDIT: Code in code-tags gesetzt!

      Im Shelly benutze ich dann folgenden Befehl für das Logging auf dem NAS:

      "HTTP.POST", { url: "http://192.168.1.xxx/log_receiver.php", body: JSON.stringify({ log: message }), headers: { "Content-Type": "application/json" } }, function(result, error_code, error_message)
      

      MOD-EDIT: Code in code-tags gesetzt!

      Wie würde das entsprechende Blockly aussehen?
      Sorry hab es selber nicht geschafft.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      891
      Online

      31.7k
      Users

      79.7k
      Topics

      1.3m
      Posts

      1
      1
      62
      Loading More Posts
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      Community
      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
      The ioBroker Community 2014-2023
      logo