Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Error/Bug
    4. Timestamps Defect

    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

    Timestamps Defect

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

      Hallo,

      Java-Script kommt mit den neuen Timestamps nicht klar:

      48368-07-28 00:31:08 VS-16 EG Trepphaus ZU

      48368-07-27 23:32:55 VS-16 EG Trepphaus AUF

      48368-07-26 16:12:03 VS-19 EG Schlafzimmer ZU

      48368-07-25 10:38:40 VS-19 EG Schlafzimmer AUF

      48368-06-24 11:48:34 VS-01 EG Eingangstür ZU

      48368-06-24 06:11:39 VS-01 EG Eingangstür AUF

      function timestamp(ts) {
          var now=new Date(ts);
          var day = now.getDate();
          var month = now.getMonth() + 1;
          var year = now.getFullYear();
          var weekday = now.getDay();
          var hours = now.getHours();
          var minutes = now.getMinutes();
          var seconds = now.getSeconds();
          var day0  = ((day < 10) ? "0" : "");
          var month0  = ((month < 10) ? "0" : "");
          var hours0  = ((hours < 10) ? "0" : "");
          var minutes0  = ((minutes < 10) ? "0" : "");
          var seconds0  = ((seconds < 10) ? "0" : "");
          var output = year + "-" + month0 + month + "-" + day0 + day + " " + hours0 + hours + ":" + minutes0 + minutes + ":" + seconds0 + seconds;  
          return output;
      
      }
      
      

      Liefert nichts vernünftiges …

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

        Hallo,

        hab den Fehler gefunden…

        ... bisher mußte man den TimeStamp im JavaScript immer mal 1000 nehmen. Das muss jetzt raus:

        vAlarmanlage.on(function(obj) {
          var aktion="Haus alles gesichert";
          if (obj.newState.val == 1) {
            aktion="im Haus/Lüften";
          }
          if (obj.newState.val == 2) {
            aktion="OFF";
          }
          // alt: var ts=timestamp(obj.newState.ts * 1000);
          var ts=timestamp(obj.newState.ts);
            ereignis(ts + " Alarmstatus: " + aktion);
        //    log("OBJ=" + JSON.stringify(obj,null,2));
        })
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        Support us

        ioBroker
        Community Adapters
        Donate

        791
        Online

        31.8k
        Users

        80.0k
        Topics

        1.3m
        Posts

        1
        2
        402
        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