NEWS
gelöst Awtrix Display Spielstand per JS Post senden
-
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); });
Danke
-
@ralla66
Du hast es schon mit einem Objekt statt JSON versucht?body: {text: Spielstand}
Wenn es JSON sein soll:
body: JSON.stringify({text: Spielstand})
-
@paul53 sagte in Awtrix Display Spielstand per JS Post senden:
body: JSON.stringify({text: Spielstand})
Danke, damit läuft es.
TopAls Info noch,
wer es in Tasmota Scripting benötigt gehts hiermit:=>WebQuery http://meine IP/api/notify POST {"text":"%var%"}