Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. gelöst Awtrix Display Spielstand per JS Post senden

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    gelöst Awtrix Display Spielstand per JS Post senden

    This topic has been deleted. Only users with topic management privileges can see it.
    • Ralla66
      Ralla66 Most Active last edited by Ralla66

      Würde gerne per Blockly / JS Post den Spielstand der Variable Spielstand zum
      Display senden. Leider wird die Var nicht im Body übernommen.
      Wie muß im Body der Aufruf der Variable sein ?

      var Spielstand;
      
      // Beschreibe diese Funktion …
      async function Ergebnis() {
          request({
              method: 'POST',
              url: 'http://192.168.2.98/api/notify',
              body: '{"text":Spielstand}'
          }, function(error, respnse, body) {
              if(error) log(error, 'warn');
          });
      }
      
      
      on({ id: '0_userdata.0.Test_Ralla.Schalter_5' /* Schalter 5 */, change: 'any' }, async (obj) => {
        let value = obj.state.val;
        let oldValue = obj.oldState.val;
        Spielstand = ('' + '1 : 0');
        if (getState('0_userdata.0.Test_Ralla.Schalter_5').val == true) {
          await Ergebnis();
        }
        console.log(Spielstand);
      });
      

      Awtrix 2.jpg

      Danke

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

        @ralla66
        Du hast es schon mit einem Objekt statt JSON versucht?

                body: {text: Spielstand}
        

        Wenn es JSON sein soll:

                body: JSON.stringify({text: Spielstand})
        
        Ralla66 1 Reply Last reply Reply Quote 0
        • Ralla66
          Ralla66 Most Active @paul53 last edited by

          @paul53 sagte in Awtrix Display Spielstand per JS Post senden:

              body: JSON.stringify({text: Spielstand})
          

          Danke, damit läuft es.
          Top

          Als Info noch,
          wer es in Tasmota Scripting benötigt gehts hiermit:

          =>WebQuery http://meine IP/api/notify POST {"text":"%var%"}
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          Support us

          ioBroker
          Community Adapters
          Donate

          874
          Online

          31.8k
          Users

          80.0k
          Topics

          1.3m
          Posts

          blockly javascript
          2
          3
          142
          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