Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. On-Funktion: Brauche Hilfe

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    On-Funktion: Brauche Hilfe

    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Strizz last edited by

      Hallo,

      es ist ein altes Thema. Ich habe jedoch auch nach langem Suchen hier keine Lösung für mich gefunden. Deshalb mal wieder eine Frage an die Experten:

      Ich habe den Adapter "Worx Landroid S 2017" von MeisterTR installiert. Dieser gibt mir in einem seiner Objekte den Status meines Rasenroboters ("Otto") an. Den Status kann ich mit dem Befehl

      activity = getState("landroid-s.0.mower.status").val;
      

      korrekt auslesen. Soweit so gut. Ich möchte nun bei bestimmten Statusmeldungen eine Pushover auf meine Handi bzw. (bei Diebstahl) einen Alarm auslösen. Dazu habe ich mir folgens Script gebastelt:

      //Programm wertet den Status des Objektes "landroid-s.0.mower.status" aus und sendet entsprechende Pushover-Mitteilung
      
      //var activity = getState("landroid-s.0.mower.status").val;
      
      var activity = ("landroid-s.0.mower.status");
      console.log(activity);
      
      function Meldung() {
         switch (activity) {
              case 0:  sendTo('pushover.1', 'Otto ist zu Hause und ruht');
              break;
              case 1: sendTo('pushover.1', 'Otto ist zu Hause');
              break;
              case 2:  sendTo('pushover.1', 'Otto startet');
              break;
              case 3:  sendTo('pushover.1', 'Otto verlässt die Ladestation');
              break;
              case 4:  sendTo('pushover.1', 'Otto fährt am Draht entlang');
              break;
              case 5:  sendTo('pushover.1', 'Otto sucht sein Zuhause');
              break;
              case 6:  sendTo('pushover.1', 'Otto sucht den Draht');
              break;
              case 7:  sendTo('pushover.1', {message: 'Otto mäht',sound: 'spacealarm', priority: 1});
              break;
              case 8:  sendTo('pushover.1', 'Achtung! Otto wurde hochgehoben');
              break;
              case 9:  sendTo('pushover.1', 'Otto hat ein dickes Problem');
              break;
              case 10: sendTo('pushover.1', 'Otto: Mähwerk blockiert');
              break;
              case 11: sendTo('pushover.1', 'Debug');
              break;
              case 12: sendTo('pushover.1', 'Fernbedienung');
              break;
              default: sendTo('pushover.1', 'Der Empfangsstatus ist unbekannt');
              break;
          }}
      
      on(activity, Meldung()); 
      

      Die Zuweisung

      var activity = ("landroid-s.0.mower.status");
      

      scheint nicht korrekt zu sein. Denn ich erhalte nur eine Pushover mit der Meldung: "Der Empfangsstauts ist unbekannt". Der Programm funktioniert mit der Zeile

      activity = getState("landroid-s.0.mower.status").val;
      

      Allerdings nur einmal beim Start.

      Kann mit jemand auf die Sprünge helfen und zeigen wie die Zuweisung für activity korrekt aussehen muss? Alle meine Versuche, etwa

      var activity = ("landroid-s.0.mower.status").val;
      

      sind bisher gescheitert.

      Gruß

      Strizz

      1 Reply Last reply Reply Quote 0
      • S
        SchuetzeSchulz last edited by

        Hallo,

        probier es mal so:

        //Programm wertet den Status des Objektes "landroid-s.0.mower.status" aus und sendet entsprechende Pushover-Mitteilung
        on({id: "landroid-s.0.mower.status"}, function(obj)						
        {
        	var activity = getState("landroid-s.0.mower.status").val;
        	switch(String(activity)) {
                case "0":  sendTo('pushover.1', 'Otto ist zu Hause und ruht');
                break;
                case "1": sendTo('pushover.1', 'Otto ist zu Hause');
                break;
                case "2":  sendTo('pushover.1', 'Otto startet');
                break;
                case "3":  sendTo('pushover.1', 'Otto verlässt die Ladestation');
                break;
                case "4":  sendTo('pushover.1', 'Otto fährt am Draht entlang');
                break;
                case "5":  sendTo('pushover.1', 'Otto sucht sein Zuhause');
                break;
                case "6":  sendTo('pushover.1', 'Otto sucht den Draht');
                break;
                case "7":  sendTo('pushover.1', {message: 'Otto mäht',sound: 'spacealarm', priority: 1});
                break;
                case "8":  sendTo('pushover.1', 'Achtung! Otto wurde hochgehoben');
                break;
                case "9":  sendTo('pushover.1', 'Otto hat ein dickes Problem');
                break;
                case "10": sendTo('pushover.1', 'Otto: Mähwerk blockiert');
                break;
                case "11": sendTo('pushover.1', 'Debug');
                break;
                case "12": sendTo('pushover.1', 'Fernbedienung');
                break;
                default: sendTo('pushover.1', 'Der Empfangsstatus ist unbekannt');
                break;
            }
        });
        
        
        1 Reply Last reply Reply Quote 0
        • S
          Strizz last edited by

          Danke für die schnelle Antwort. Habe eine Zeile geändert in

          on("landroid-s.0.mower.status", function(obj
          

          weil er mir sonst im Minutentakt die Pushover geschickt hat. Jetzt erhalte ich sie nur bei einer Änderung des Status.

          Noch mal besten Dank

          Strizz

          1 Reply Last reply Reply Quote 0
          • S
            SchuetzeSchulz last edited by

            Ach verdammt. Sorry, mein Fehler 🙂

            Aber super, wenn es jetzt funktioniert!

            1 Reply Last reply Reply Quote 0
            • paul53
              paul53 last edited by

              ! ````
              //Programm wertet den Status des Objektes "landroid-s.0.mower.status" aus und sendet entsprechende Pushover-Mitteilung
              ! var idactivity = "landroid-s.0.mower.status";
              ! function Meldung(activity) {
              switch (activity) {
              case 0: sendTo('pushover.1', 'Otto ist zu Hause und ruht');
              break;
              case 1: sendTo('pushover.1', 'Otto ist zu Hause');
              break;
              case 2: sendTo('pushover.1', 'Otto startet');
              break;
              case 3: sendTo('pushover.1', 'Otto verlässt die Ladestation');
              break;
              case 4: sendTo('pushover.1', 'Otto fährt am Draht entlang');
              break;
              case 5: sendTo('pushover.1', 'Otto sucht sein Zuhause');
              break;
              case 6: sendTo('pushover.1', 'Otto sucht den Draht');
              break;
              case 7: sendTo('pushover.1', {message: 'Otto mäht',sound: 'spacealarm', priority: 1});
              break;
              case 8: sendTo('pushover.1', 'Achtung! Otto wurde hochgehoben');
              break;
              case 9: sendTo('pushover.1', 'Otto hat ein dickes Problem');
              break;
              case 10: sendTo('pushover.1', 'Otto: Mähwerk blockiert');
              break;
              case 11: sendTo('pushover.1', 'Debug');
              break;
              case 12: sendTo('pushover.1', 'Fernbedienung');
              break;
              default: sendTo('pushover.1', 'Der Empfangsstatus ist unbekannt');
              break;
              }
              }
              ! Meldung(getState(idactivity).val); // Script start

              on(idactivity, function(dp) { // Triggern bei Wertänderung
              Meldung(dp.state.val);
              });

              1 Reply Last reply Reply Quote 0
              • S
                Strizz last edited by

                @paul23: Danke für die Korrektur. Sehe jetzt etwas klarer.

                Gruß

                Strizz

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

                Support us

                ioBroker
                Community Adapters
                Donate

                495
                Online

                31.7k
                Users

                79.8k
                Topics

                1.3m
                Posts

                3
                6
                1080
                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