Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Telegram: Reihenfolge der empfangenen Nachrichten stimmt nicht

NEWS

  • Neuer ioBroker-Blog online: Monatsrückblick März/April 2026
    BluefoxB
    Bluefox
    5
    1
    109

  • Verwendung von KI bitte immer deutlich kennzeichnen
    HomoranH
    Homoran
    8
    1
    152

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    865

Telegram: Reihenfolge der empfangenen Nachrichten stimmt nicht

Scheduled Pinned Locked Moved Skripten / Logik
4 Posts 2 Posters 621 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bahnuhrB Online
    bahnuhrB Online
    bahnuhr
    Forum Testing Most Active
    wrote on last edited by
    #1

    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


    Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
    Danke.
    gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
    ScreenToGif :https://www.screentogif.com/downloads.html

    1 Reply Last reply
    0
    • paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by
      #2

      Die nachfolgenden Befehle müssen in einer Callback-Funktion ausgeführt werden:

      ...
          } else {
              sendTo('telegram', "Wetterwarnung Anzahl: " + anzahl, function() {
                  if (anzahl === 1) {
                  ...
              });   
      
      

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      1 Reply Last reply
      0
      • bahnuhrB Online
        bahnuhrB Online
        bahnuhr
        Forum Testing Most Active
        wrote on last edited by
        #3

        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


        Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
        Danke.
        gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
        ScreenToGif :https://www.screentogif.com/downloads.html

        1 Reply Last reply
        0
        • bahnuhrB Online
          bahnuhrB Online
          bahnuhr
          Forum Testing Most Active
          wrote on last edited by
          #4

          Also, ich bekomms nicht hin.

          Könnte ihr doch nochmal mein Script im Beitrag 1 vorher anschauen.

          mfg

          Dieter


          Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
          Danke.
          gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
          ScreenToGif :https://www.screentogif.com/downloads.html

          1 Reply Last reply
          0

          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
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          Support us

          ioBroker
          Community Adapters
          Donate

          514

          Online

          32.8k

          Users

          82.7k

          Topics

          1.3m

          Posts
          Community
          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
          ioBroker Community 2014-2025
          logo
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Home
          • Recent
          • Tags
          • Unread 0
          • Categories
          • Unreplied
          • Popular
          • GitHub
          • Docu
          • Hilfe