NEWS
Telegram: Reihenfolge der empfangenen Nachrichten stimmt nicht
-
Hallo,
folgendes Script:
! ````
! var anzahl = getState('javascript.0.Status.DWD_Anzahl').val;
var vText = "";if (anzahl === 0) { sendTo('telegram', "Wetterwarnung Anzahl: 0"); } else if (anzahl >= 1) { sendTo('telegram', "Wetterwarnung Anzahl: " + anzahl);! if (anzahl === 1) {
vText = "1: " + getState("dwd.0.warning.headline").val + "\n";
vText = vText + getState("dwd.0.warning.description").val + "\n";
vText = vText + "von " + getState("dwd.0.warning.begin").val + " Uhr \n";
vText = vText + "bis " + getState("dwd.0.warning.end").val + " Uhr";
sendTo('telegram', vText);
}
if (anzahl >= 2) {
for (x=2; x <= anzahl; x++) {
vText = x + ": " + getState("dwd.0.warning" + x-1 + ".headline").val + "\n";
vText = vText + getState("dwd.0.warning" + x-1 + ".description").val + "\n";
vText = vText + "von " + getState("dwd.0.warning" + x-1 + ".begin").val + " Uhr \n";
vText = vText + "bis " + getState("dwd.0.warning" + x-1 + ".end").val + " Uhr";
sendTo('telegram', vText);
}
}
}
! ````Warum wird das Script nicht von oben nach unten abgearbeitet.
Also zuerst die Nachricht "Wetterwarnung Anzahl …"
Und dann die Meldung.
Sondern es kommt:
- erst die Meldung und dann die Anzahl
Frage:
Warum ist das so bzw. wie kann man das ändern.
P.S.
delay, Timeout oder das globale Script (wait -> aus dem Internet) klappt nicht.
mfg
Dieter
-
habs geändert.
var anzahl = getState('javascript.0.Status.DWD_Anzahl').val; var vText = ""; if (anzahl === 0) { sendTo('telegram', "Wetterwarnung Anzahl: 0"); } else { log (anzahl); sendTo('telegram', "Wetterwarnung Anzahl: " + anzahl, function () { if (anzahl === 1) { vText = "1: " + getState("dwd.0.warning.headline").val + "\n"; vText = vText + getState("dwd.0.warning.description").val + "\n"; vText = vText + "von " + getState("dwd.0.warning.begin").val + " Uhr \n"; vText = vText + "bis " + getState("dwd.0.warning.end").val + " Uhr"; sendTo('telegram', vText); } }); }Jetzt kommt gar keine Nachricht mehr an.
mfg
-
Also, ich bekomms nicht hin.
Könnte ihr doch nochmal mein Script im Beitrag 1 vorher anschauen.
mfg
Dieter
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login