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. JavaScript
  5. [gelöst] Online Zeit per TR-064 berechnen und anzeigen

NEWS

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

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    18
    1
    6.2k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.5k

[gelöst] Online Zeit per TR-064 berechnen und anzeigen

Scheduled Pinned Locked Moved JavaScript
blockly
23 Posts 4 Posters 4.2k Views 9 Watching
  • 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.
  • NegaleinN Negalein

    @Kuddel sagte in [gelöst] Online Zeit per TR-064 berechnen und anzeigen:

    @sigi234 habe ich im Skript eingebaut

    Ich bekomm folgende Warn im Log.
    DP wird nicht angelegt.

    javascript.0	2019-08-26 12:47:00.012	warn	at Timer.listOnTimeout (timers.js:290:5)
    javascript.0	2019-08-26 12:47:00.011	warn	at tryOnTimeout (timers.js:323:5)
    javascript.0	2019-08-26 12:47:00.011	warn	at ontimeout (timers.js:498:11)
    javascript.0	2019-08-26 12:47:00.011	warn	at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-schedule/lib/schedule.js:501:7)
    javascript.0	2019-08-26 12:47:00.011	warn	at /opt/iobroker/node_modules/iobroker.javascript/node_modules/node-schedule/lib/schedule.js:543:11
    javascript.0	2019-08-26 12:47:00.011	warn	at Job.invoke (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-schedule/lib/schedule.js:173:10)
    javascript.0	2019-08-26 12:47:00.011	warn	at Job.nodeSchedule.scheduleJob [as job] (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1191:34)
    javascript.0	2019-08-26 12:47:00.011	warn	at Object.<anonymous> (script.js.common.Fritz-Onlinezeit:15:3)
    javascript.0	2019-08-26 12:47:00.011	warn	at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1276:20)
    javascript.0	2019-08-26 12:47:00.011	warn	State "javascript.0.uptime.online-router" not found
    

    Script:

    const ip_router = 'tr-064.0.states.externalIP'; 
    const Onlinezeit = 'javascript.0.uptime.online-router'; 
     
    schedule('* * * * *', function() { // jede Minute
     
    //router
      var diff = Date.now() - getState(ip_router).lc; // Onlinezeit in ms
      var tage = Math.floor(diff / (1000*60*60*24));
      diff = diff % (1000*60*60*24);
      var std = Math.floor(diff / (1000*60*60));
      diff = diff % (1000*60*60);
      var min = Math.round(diff / (1000*60));
      if(std < 10) std = '0' + std;
      if(min < 10) min = '0' + min;
      setState(Onlinezeit, tage + ' Tage, ' + std + ' Std, ' + min + ' Min', true);
     
    });
    
    paul53P Offline
    paul53P Offline
    paul53
    wrote on last edited by paul53
    #21

    @Negalein sagte:

    DP wird nicht angelegt.

    Ist im Skript auch nicht vorgesehen. Lege ihn manuell im Reiter "Objekte" an: javascript.0 selektieren und Datenpunkt hinzufügen, Name: uptime.online-router, Typ: Zeichenkette

    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

    NegaleinN 1 Reply Last reply
    0
    • NegaleinN Offline
      NegaleinN Offline
      Negalein
      Global Moderator
      wrote on last edited by
      #22

      Ahhhhhhh, ich ......!

      ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
      ° Node.js Fixer ---> iob nodejs-update
      ° Fixer ---> iob fix

      1 Reply Last reply
      0
      • paul53P paul53

        @Negalein sagte:

        DP wird nicht angelegt.

        Ist im Skript auch nicht vorgesehen. Lege ihn manuell im Reiter "Objekte" an: javascript.0 selektieren und Datenpunkt hinzufügen, Name: uptime.online-router, Typ: Zeichenkette

        NegaleinN Offline
        NegaleinN Offline
        Negalein
        Global Moderator
        wrote on last edited by
        #23

        @paul53 sagte in [gelöst] Online Zeit per TR-064 berechnen und anzeigen:

        @Negalein sagte:

        DP wird nicht angelegt.

        Ist im Skript auch nicht vorgesehen. Lege ihn manuell im Reiter "Objekte" an: javascript.0 selektieren und Datenpunkt hinzufügen, Name: uptime.online-router, Typ: Zeichenkette

        Danke, funktioniert!

        Ich seh zwar nur wielange die Fritz mit dem Postrouter verbunden ist, aber das sind die Nachteile wenn mann vom Anbieter keinen vernünftigen Router bekommt und man was gescheites dahinter hängen muss.

        ° Node.js & System Update ---> sudo apt update, iob stop, sudo apt full-upgrade
        ° Node.js Fixer ---> iob nodejs-update
        ° Fixer ---> iob fix

        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

        258

        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