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. (Echte) Stau-Erkennung mit Bing

NEWS

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

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

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

(Echte) Stau-Erkennung mit Bing

Scheduled Pinned Locked Moved Skripten / Logik
57 Posts 22 Posters 19.1k Views 4 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.
  • H Offline
    H Offline
    Hangloose20
    wrote on last edited by
    #48

    Hallo zusammen.

    bin neu hier gerade in den Genuss eines RP mit Iobroker gekommen.

    Ich würde nun gerne eine Fahrzeitenberechnung haben ( HometoWork ). Mit Widget das mir die Fahrzeit ausgibt oder mir alternative Routen vorschlägt :shock:

    Ich habe mir das hier alles soweit durchgelesen, verstehe aber leider nicht wirklich viel. Gibt es eine Anleitung für Anfänger ? Denke, es wäre besser, wenn ich Schritt für Schritt mich durch eine

    Anleitung kämpfen kann.

    Freue mich auf Eure Antworten.

    Gruss Tobias

    1 Reply Last reply
    0
    • R Offline
      R Offline
      root_
      wrote on last edited by
      #49

      Nach langer Zeit mal wieder was hier ;)

      Ich hab den Flow von sissiwupps angepasst das es wieder funzt. Nun gibts nur ein kleines Problem mit der Übergabe der Daten an ioBroker. Das Problem muss aber schon immer bei dem flow bestanden haben da ich an der Stelle nichts geändert hab.

      Fehlermeldung im log: [error] [function:extractData] Function tried to send a message of type string

      Function extraData:

      /*
      returns:
      1\. travelDurationTraffic in min
      2\. travelDuration in min
      3\. traveDelay in min
      4\. trafficJam boolean
      5\. trafficCongestion string
      6\. travelDistance in km
      7\. msg object (for debugging and return to the loop)
      */
      var travelDurationTraffic = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDurationTraffic / 60);
      var travelDuration = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDuration / 60);
      
      var shortname = msg.name+":"+msg.payload.resourceSets[0].resources[0].routeLegs[0].description+"/"+msg.payload.resourceSets[0].resources[0].travelDistance+" km";
      
      var msgTraffic = [
          {
              topic: msg.topic_prefix + ".name",
              payload: msg.name
          },
          {
              topic: msg.topic_prefix + ".travelDurationTraffic",
              payload: travelDurationTraffic
          },
          {    
              topic: msg.topic_prefix + ".travelDuration",
              payload: travelDuration
          },
          {    
              topic: msg.topic_prefix + ".travelDelay",
              payload: travelDurationTraffic - travelDuration
          },
          {    
              topic: msg.topic_prefix + ".trafficJam",
              payload: (travelDurationTraffic - travelDuration >= msg.threshold)
          },
          {    
              topic: msg.topic_prefix + ".trafficCongestion",
              payload: msg.payload.resourceSets[0].resources[0].trafficCongestion
          },
          {    
              topic: msg.topic_prefix + ".travelDistance",
              payload: msg.payload.resourceSets[0].resources[0].travelDistance
          },
          {    
              topic: msg.topic_prefix + ".travelDescription",
              payload: msg.payload.resourceSets[0].resources[0].routeLegs[0].description
          }
      ];
      
      return [shortname,msgTraffic,msg.payload.resourceSets[0].resources[0].routeLegs,msg];
      

      Was wird da falsch übergeben? Meine skills reichen da leider noch nicht aus aber ich lerne gerne :)

      SabotiS 1 Reply Last reply
      0
      • thexbrainT Offline
        thexbrainT Offline
        thexbrain
        wrote on last edited by
        #50

        @Fitti:

        Okay und Danke. Aber da fehlt ja noch eine Menge, oder?

        Was habe ich gemacht:

        1.) Mit Meiner MS ID eingelogt, mir eine Route ausgewählt, einen Bing Key erstellt (dazu musste ich diese Route erstellen).

        1a.) Mir die Routenstartpunkt und und Endpunkt kopiert.

        2.) Node-Red installiert

        3.) Den FLOW-Code http://www.iobroker.net/?page_id=57&lang=de kopiert.

        4.) In Node-RED auf "Import Clipboard" gegeangen und den kopierten Text eingefügt.

        Darauf hin erhielt ich eine Grafik wie oben mit den ganzen Nodes.

        4a.) Im Menu Workspace/Rename ausgewählt und den Ganzem den Namen "BingMaps" gegeben. Im Reiter dieses Programmes (oder wie man das nennt) steht nun auch der Name BingMaps.

        5.) Dann im Node setConfig NUR meinen bing_key eingefügt.

        6.) Nun im Node defineRoutes…

        Im Beriech msg.routes

        bei from: Die kopierten Texte meiner Bing-StartRoute reinkopiert.

        ebenso bei to:

        Den Namen noch angepasst: Home2Schule

        Das Ganze, nur mit From und To getauscht, im nächsten Block {} gemacht, aber hier den Namen Schule2Home verwendet.

        Nun frage ich mich, ob ich das irgendwie speichern muss, da beim Schließen des Browsers eine Warnmeldung kommt. Habe noch nie Node verwendet. Bei .vis muss man ja auch nichts speichern.

        7.) In .vis habe ich dann gemäß deiner Info zuvor das Widget importiert. Ich habe einen "Rahmen" in der Anzeige

        8.) Nun lässt es sich vermuten, dass bei der Inhalt ID: ich mit der Auswahl meinen Node sehen müsste. Aber ich finde diesen nirgends. Liegt das am fehlenden Speichern in Punkt 6?

        Achso: Gemäß http://www.iobroker.net/?page_id=166&lang=de ist bei mir KEIN eigener Node- Reiter in der Admin-Oberfläche! Ich kann aber bei den Instanzen auf Node-Red klicken und es öffnet sich ein eigener Browser-Tab.

        Gruß,

        Fitti `

        Ich möchte das auch gerne umsetzten aber irgendwie blicke ich da nicht durch.

        Im bing habe ich mich eingeloggt und zwei keys erstellt.

        Was müsste man dort auswählen ?

        Basic?

        Laut der Anleitung müsste die Route erstellt werden und dann den key aber irgendwie finde ich es nicht.

        Danke schonmal und schöne Weihnachtstage wünsche ich euch allen.
        4720_bing_key.jpg

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aw1980
          wrote on last edited by
          #51

          wollte gerade den Nodered Flow importieren, aber irgendwie bleibt der Import Button Rot hinterlegt.

          Muss ich irgendwelche Module noch zusätzlich installieren bei Nodered? Das importieren anderer Flows funktioniert problemlos.

          SabotiS 1 Reply Last reply
          0
          • A aw1980

            wollte gerade den Nodered Flow importieren, aber irgendwie bleibt der Import Button Rot hinterlegt.

            Muss ich irgendwelche Module noch zusätzlich installieren bei Nodered? Das importieren anderer Flows funktioniert problemlos.

            SabotiS Offline
            SabotiS Offline
            Saboti
            wrote on last edited by
            #52

            @aw1980 Das Problem hatte ich auch. Das JSON passt nicht.
            Ich wollte den geposteten Flow von Sven2013 nehmen.

            Kopiere den Code und mach eine validierung z.B. über folgende Webseite: https://jsonlint.com/
            Er meckert dann "func": an. Einfach alles dahinter gegen "" austauschen. Danach den JSON kopieren und importieren. Der Button sollte jetzt rot werden.
            Danach einfach in Node-Red die Funktion bearbeiten und den extra geposteten Text von Sven2013 einfügen.

            So klappte auch bei mir der Import.

            Gruß Ssboti

            1 Reply Last reply
            0
            • R root_

              Nach langer Zeit mal wieder was hier ;)

              Ich hab den Flow von sissiwupps angepasst das es wieder funzt. Nun gibts nur ein kleines Problem mit der Übergabe der Daten an ioBroker. Das Problem muss aber schon immer bei dem flow bestanden haben da ich an der Stelle nichts geändert hab.

              Fehlermeldung im log: [error] [function:extractData] Function tried to send a message of type string

              Function extraData:

              /*
              returns:
              1\. travelDurationTraffic in min
              2\. travelDuration in min
              3\. traveDelay in min
              4\. trafficJam boolean
              5\. trafficCongestion string
              6\. travelDistance in km
              7\. msg object (for debugging and return to the loop)
              */
              var travelDurationTraffic = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDurationTraffic / 60);
              var travelDuration = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDuration / 60);
              
              var shortname = msg.name+":"+msg.payload.resourceSets[0].resources[0].routeLegs[0].description+"/"+msg.payload.resourceSets[0].resources[0].travelDistance+" km";
              
              var msgTraffic = [
                  {
                      topic: msg.topic_prefix + ".name",
                      payload: msg.name
                  },
                  {
                      topic: msg.topic_prefix + ".travelDurationTraffic",
                      payload: travelDurationTraffic
                  },
                  {    
                      topic: msg.topic_prefix + ".travelDuration",
                      payload: travelDuration
                  },
                  {    
                      topic: msg.topic_prefix + ".travelDelay",
                      payload: travelDurationTraffic - travelDuration
                  },
                  {    
                      topic: msg.topic_prefix + ".trafficJam",
                      payload: (travelDurationTraffic - travelDuration >= msg.threshold)
                  },
                  {    
                      topic: msg.topic_prefix + ".trafficCongestion",
                      payload: msg.payload.resourceSets[0].resources[0].trafficCongestion
                  },
                  {    
                      topic: msg.topic_prefix + ".travelDistance",
                      payload: msg.payload.resourceSets[0].resources[0].travelDistance
                  },
                  {    
                      topic: msg.topic_prefix + ".travelDescription",
                      payload: msg.payload.resourceSets[0].resources[0].routeLegs[0].description
                  }
              ];
              
              return [shortname,msgTraffic,msg.payload.resourceSets[0].resources[0].routeLegs,msg];
              

              Was wird da falsch übergeben? Meine skills reichen da leider noch nicht aus aber ich lerne gerne :)

              SabotiS Offline
              SabotiS Offline
              Saboti
              wrote on last edited by
              #53

              @root_ ich hab den gleichen Fehler, hast Du da was rausgefunden woran das liegt?
              Gruß Saboti

              1 Reply Last reply
              0
              • R Offline
                R Offline
                root_
                wrote on last edited by
                #54

                Hab meinen Flow umgebaut und übergebe nicht mehr seriell.

                1 Reply Last reply
                0
                • sigi234S Online
                  sigi234S Online
                  sigi234
                  Forum Testing Most Active
                  wrote on last edited by
                  #55

                  Hallo, kann wer den funktionierenden Flow reinstellen?

                  Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                  Immer Daten sichern!

                  SabotiS 1 Reply Last reply
                  1
                  • sigi234S sigi234

                    Hallo, kann wer den funktionierenden Flow reinstellen?

                    SabotiS Offline
                    SabotiS Offline
                    Saboti
                    wrote on last edited by Saboti
                    #56

                    @sigi234 anbei wie es nun bei mir läuft.
                    hab den extractData von MegrCurry mit dem Addon von rurh70 genommen. Hat zwar kein Debug aber funktioniert damit:

                    /*
                    
                    returns:
                    
                    1\. travelDurationTraffic in min
                    
                    2\. travelDuration in min
                    
                    3\. traveDelay in min
                    
                    4\. trafficJam boolean
                    
                    5\. trafficCongestion string
                    
                    6\. travelDistance in km
                    
                    7\. msg object (for debugging and return to the loop)
                    
                    */
                    
                    var travelDurationTraffic = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDurationTraffic / 60);
                    
                    var travelDuration = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDuration / 60);
                    
                     
                    
                    var msgTraffic = [
                    
                        {
                    
                            topic: msg.topic_prefix + ".name",
                    
                            payload: msg.name
                    
                        },
                    
                        {
                    
                            topic: msg.topic_prefix + ".travelDurationTraffic",
                    
                            payload: travelDurationTraffic
                    
                        },
                    
                        {    
                    
                            topic: msg.topic_prefix + ".travelDuration",
                    
                            payload: travelDuration
                    
                        },
                    
                        {    
                    
                            topic: msg.topic_prefix + ".travelDelay",
                    
                            payload: travelDurationTraffic - travelDuration
                    
                        },
                    
                        {    
                    
                            topic: msg.topic_prefix + ".trafficJam",
                    
                            payload: (travelDurationTraffic - travelDuration >= msg.threshold)
                    
                        },
                    
                        {    
                    
                            topic: msg.topic_prefix + ".trafficCongestion",
                    
                            payload: msg.payload.resourceSets[0].resources[0].trafficCongestion
                    
                        },
                    
                        {    
                    
                            topic: msg.topic_prefix + ".travelDistance",
                    
                            payload: msg.payload.resourceSets[0].resources[0].travelDistance
                    
                        },
                        
                        {    
                    
                            topic: msg.topic_prefix + ".travelDescription",
                    
                            payload: msg.payload.resourceSets[0].resources[0].routeLegs[0].description
                    
                        }
                    
                    ];
                    
                    return [msgTraffic,msg];
                    

                    Und hier nochmal der komplette Flow:

                    [
                        {
                            "id": "f38be5c5.594708",
                            "type": "tab",
                            "label": "BingMaps Traffic",
                            "disabled": false,
                            "info": ""
                        },
                        {
                            "id": "ec0cc8e4.d21bf8",
                            "type": "http request",
                            "z": "f38be5c5.594708",
                            "name": "askBing",
                            "method": "GET",
                            "ret": "obj",
                            "url": "",
                            "x": 460,
                            "y": 400,
                            "wires": [
                                [
                                    "65099a04.fa68e4",
                                    "bf572708.026bb8",
                                    "671cf5a3.93243c"
                                ]
                            ]
                        },
                        {
                            "id": "457c032a.c977cc",
                            "type": "inject",
                            "z": "f38be5c5.594708",
                            "name": "Trigger",
                            "topic": "",
                            "payload": "",
                            "payloadType": "date",
                            "repeat": "600",
                            "crontab": "",
                            "once": false,
                            "x": 181.88883209228516,
                            "y": 144.00007438659668,
                            "wires": [
                                [
                                    "f8b6cb8e.148ff8"
                                ]
                            ]
                        },
                        {
                            "id": "f56d10d3.1a8c6",
                            "type": "function",
                            "z": "f38be5c5.594708",
                            "name": "defineRoutes",
                            "func": "/*\nDefine routes:\nfrom: starting address, encode spaces with %20\nto: destination address, encode spaces with %20\nthreshold: in minutes, if duration with traffic is larger than threshold, set trafficJam to true\nname: name :-)\n*/\n\nmsg.routes = [\n    {\n        way: \"wayPoint.1='xxxxxxxxx'&\" +\n             \"viaWayPoint.2='xxxxxxxxxx'&\" +\n             \"viaWayPoint.3='xxxxxxxxxxx'&\" +\n             \"wayPoint.4='xxxxxxxxxxxxx'\",\n        threshold: 5,\n        name: 'Home2Office'\n    },\n    {\n        way: \"wayPoint.1='xxxxxxxx'&\" +\n             \"viaWayPoint.2='xxxxxxxxxx'&\" +\n             \"viaWayPoint.3='xxxxxxxxxxx'&\" +\n             \"wayPoint.4='xxxxxxxxxx'\",\n        threshold: 5,\n        name: 'Office2Home'\n    }\n];\n\nreturn msg;",
                            "outputs": 1,
                            "noerr": 0,
                            "x": 518.8889770507812,
                            "y": 144.0000762939453,
                            "wires": [
                                [
                                    "ed4644fd.7f8808"
                                ]
                            ]
                        },
                        {
                            "id": "47798bfa.dc51e4",
                            "type": "function",
                            "z": "f38be5c5.594708",
                            "name": "prepareIteration",
                            "func": "// msg.method = \"GET\";\n\nmsg.url = encodeURI(\"http://dev.virtualearth.net/REST/v1/Routes?\" + msg.payload.way + \"&optimize=timeWithTraffic&key=\" + msg.config.bing_key);\n\nmsg.topic_prefix = msg.config.topic_prefix + msg.payload.name;\n\nmsg.name = msg.payload.name; \n\nmsg.threshold = msg.payload.threshold;\n\nreturn msg;",
                            "outputs": 1,
                            "noerr": 0,
                            "x": 298.22222900390625,
                            "y": 400.5555419921875,
                            "wires": [
                                [
                                    "ec0cc8e4.d21bf8",
                                    "4bb3a641.55bbd8"
                                ]
                            ]
                        },
                        {
                            "id": "f8b6cb8e.148ff8",
                            "type": "function",
                            "z": "f38be5c5.594708",
                            "name": "setConfig",
                            "func": "msg.config = {\n    bing_key: \"xxxxxxxxxxx\",\n    topic_prefix: \"node-red.0.traffic.\"\n};\nreturn msg;",
                            "outputs": 1,
                            "noerr": 0,
                            "x": 344.11106872558594,
                            "y": 144.5556182861328,
                            "wires": [
                                [
                                    "f56d10d3.1a8c6",
                                    "bbfabcd1.22792"
                                ]
                            ]
                        },
                        {
                            "id": "ed4644fd.7f8808",
                            "type": "function",
                            "z": "f38be5c5.594708",
                            "name": "loopRoutes",
                            "func": "context.routes = context.routes || msg.routes;\n\n// iterate through all the routes\nif (context.routes.length > 0) {\n    msg.payload = context.routes.shift();\n    return [null, msg];\n}\n\n// Reset routes-context, otherwise we immediately stop in the next run\ncontext.routes = false;\n// we are done with the loop\nreturn [msg, null];",
                            "outputs": "2",
                            "noerr": 0,
                            "x": 208.6666259765625,
                            "y": 338.22222900390625,
                            "wires": [
                                [],
                                [
                                    "47798bfa.dc51e4"
                                ]
                            ]
                        },
                        {
                            "id": "bbfabcd1.22792",
                            "type": "debug",
                            "z": "f38be5c5.594708",
                            "name": "",
                            "active": false,
                            "tosidebar": true,
                            "console": false,
                            "complete": "true",
                            "x": 728.6666259765625,
                            "y": 264.22222900390625,
                            "wires": []
                        },
                        {
                            "id": "51df14db.22edcc",
                            "type": "ioBroker out",
                            "z": "f38be5c5.594708",
                            "name": "toIoBroker",
                            "topic": "",
                            "ack": "true",
                            "autoCreate": "true",
                            "x": 663.6666259765625,
                            "y": 599.2222290039062,
                            "wires": []
                        },
                        {
                            "id": "ae4bbdde.5e5c6",
                            "type": "catch",
                            "z": "f38be5c5.594708",
                            "name": "",
                            "scope": null,
                            "x": 740,
                            "y": 140,
                            "wires": [
                                [
                                    "bbfabcd1.22792"
                                ]
                            ]
                        },
                        {
                            "id": "c6a64342.37eab",
                            "type": "comment",
                            "z": "f38be5c5.594708",
                            "name": "Define your config and routes here.           ",
                            "info": "Define your config and routes here.",
                            "x": 422.6666259765625,
                            "y": 107.2222900390625,
                            "wires": []
                        },
                        {
                            "id": "4bb3a641.55bbd8",
                            "type": "debug",
                            "z": "f38be5c5.594708",
                            "name": "WEB",
                            "active": false,
                            "tosidebar": true,
                            "console": false,
                            "complete": "url",
                            "x": 711,
                            "y": 312.00006103515625,
                            "wires": []
                        },
                        {
                            "id": "65099a04.fa68e4",
                            "type": "debug",
                            "z": "f38be5c5.594708",
                            "name": "Answer",
                            "active": false,
                            "tosidebar": true,
                            "console": false,
                            "complete": "true",
                            "x": 721,
                            "y": 366.00006103515625,
                            "wires": []
                        },
                        {
                            "id": "dc7542ef.84429",
                            "type": "delay",
                            "z": "f38be5c5.594708",
                            "name": "Pause",
                            "pauseType": "delay",
                            "timeout": "3",
                            "timeoutUnits": "seconds",
                            "rate": "1",
                            "rateUnits": "second",
                            "randomFirst": "1",
                            "randomLast": "5",
                            "randomUnits": "seconds",
                            "drop": false,
                            "x": 370,
                            "y": 540,
                            "wires": [
                                [
                                    "ed4644fd.7f8808"
                                ]
                            ]
                        },
                        {
                            "id": "bf572708.026bb8",
                            "type": "switch",
                            "z": "f38be5c5.594708",
                            "name": "Error?",
                            "property": "payload.statusCode",
                            "rules": [
                                {
                                    "t": "neq",
                                    "v": "200"
                                },
                                {
                                    "t": "else"
                                }
                            ],
                            "checkall": "true",
                            "outputs": 2,
                            "x": 181,
                            "y": 570.0000610351562,
                            "wires": [
                                [
                                    "dc7542ef.84429"
                                ],
                                [
                                    "59391f0e.ac165"
                                ]
                            ]
                        },
                        {
                            "id": "671cf5a3.93243c",
                            "type": "debug",
                            "z": "f38be5c5.594708",
                            "name": "StatusCode",
                            "active": false,
                            "tosidebar": true,
                            "console": false,
                            "complete": "payload.statusCode",
                            "x": 700,
                            "y": 410.00006103515625,
                            "wires": []
                        },
                        {
                            "id": "4ca548a6.1616f8",
                            "type": "catch",
                            "z": "f38be5c5.594708",
                            "name": "",
                            "scope": null,
                            "x": 160,
                            "y": 784.0000610351562,
                            "wires": [
                                [
                                    "59391f0e.ac165"
                                ]
                            ]
                        },
                        {
                            "id": "e2c4beb7.0393",
                            "type": "comment",
                            "z": "f38be5c5.594708",
                            "name": "defineRoutes Backup",
                            "info": "/*\nDefine routes:\nfrom: starting address, encode spaces with %20\nto: destination address, encode spaces with %20\nthreshold: in minutes, if duration with traffic is larger than threshold, set trafficJam to true\nname: name :-)\n*/\n\nmsg.routes = [\n    {\n        way: \".1='xxxxxxxx'&\" +\n             \".2='xxxxxxx'\",\n        threshold: 5,\n        name: 'Home2Office'\n    },\n    {\n        way: \".1='Horsterfeld 1,31542 Bad Nenndorf'&\" +\n             \"via.2='Mindener Straße 4, 30890 Nordgoltern'&\" +\n             \"via.3='Landwehrkreisel / Frankfurter Allee, 30459 Hannover'&\" +\n             \".4='Laatzener Str. 1,30539 Hannover'\",\n        threshold: 5,\n        name: 'Home2OfficeLandstr'\n    },\n    {\n      way: \".1='Horsterfeld 1,31542 Bad Nenndorf'&\" +\n             \"via.2='Autobahnkreuz Hannover-Buchholz, 30659 Hannover'&\" +\n             \".3='Laatzener Str. 1,30539 Hannover'\",\n        threshold: 5,\n        name: 'Home2OfficeA2'\n    },\n    {\n        way: \".1='Laatzener Str. 1,30539 Hannover'&\" +\n             \"via.2='Landwehrkreisel / Frankfurter Allee, 30459 Hannover'&\" +\n             \"via.3='Mindener Straße 4, 30890 Nordgoltern'&\" +\n             \".4='Horsterfeld 1,31542 Bad Nenndorf'\",\n        threshold: 5,\n        name: 'Office2HomeLandstr'\n    },\n    {\n        way: \".1='Laatzener Str. 1,30539 Hannover'&\" +\n             \".2='Horsterfeld 1,31542 Bad Nenndorf'\",\n        threshold: 5,\n        name: 'Office2Home'\n    },\n       {\n        way: \".1='Laatzener Str. 1,30539 Hannover'&\" +\n             \"via.2='A37, 30655 Gross Buchholz'&\" +\n             \".3='Horsterfeld 1,31542 Bad Nenndorf'\",\n        threshold: 5,\n        name: 'Office2HomeA2'\n    }\n];\n\nreturn msg;",
                            "x": 460,
                            "y": 60,
                            "wires": []
                        },
                        {
                            "id": "59391f0e.ac165",
                            "type": "function",
                            "z": "f38be5c5.594708",
                            "name": "extractData",
                            "func": "/*\n\nreturns:\n\n1\\. travelDurationTraffic in min\n\n2\\. travelDuration in min\n\n3\\. traveDelay in min\n\n4\\. trafficJam boolean\n\n5\\. trafficCongestion string\n\n6\\. travelDistance in km\n\n7\\. msg object (for debugging and return to the loop)\n\n*/\n\nvar travelDurationTraffic = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDurationTraffic / 60);\n\nvar travelDuration = Math.ceil(msg.payload.resourceSets[0].resources[0].travelDuration / 60);\n\n \n\nvar msgTraffic = [\n\n    {\n\n        topic: msg.topic_prefix + \".name\",\n\n        payload: msg.name\n\n    },\n\n    {\n\n        topic: msg.topic_prefix + \".travelDurationTraffic\",\n\n        payload: travelDurationTraffic\n\n    },\n\n    {    \n\n        topic: msg.topic_prefix + \".travelDuration\",\n\n        payload: travelDuration\n\n    },\n\n    {    \n\n        topic: msg.topic_prefix + \".travelDelay\",\n\n        payload: travelDurationTraffic - travelDuration\n\n    },\n\n    {    \n\n        topic: msg.topic_prefix + \".trafficJam\",\n\n        payload: (travelDurationTraffic - travelDuration >= msg.threshold)\n\n    },\n\n    {    \n\n        topic: msg.topic_prefix + \".trafficCongestion\",\n\n        payload: msg.payload.resourceSets[0].resources[0].trafficCongestion\n\n    },\n\n    {    \n\n        topic: msg.topic_prefix + \".travelDistance\",\n\n        payload: msg.payload.resourceSets[0].resources[0].travelDistance\n\n    },\n    \n    {    \n\n        topic: msg.topic_prefix + \".travelDescription\",\n\n        payload: msg.payload.resourceSets[0].resources[0].routeLegs[0].description\n\n    }\n\n];\n\nreturn [msgTraffic,msg];\n\n ",
                            "outputs": 2,
                            "noerr": 0,
                            "x": 330,
                            "y": 680,
                            "wires": [
                                [
                                    "51df14db.22edcc"
                                ],
                                [
                                    "dc7542ef.84429"
                                ]
                            ]
                        }
                    ]
                    
                    1 Reply Last reply
                    1
                    • R Offline
                      R Offline
                      root_
                      wrote on last edited by
                      #57

                      Ich habe neuerdings ein tolles Phänomen. Ich habe 2 Routen bei denen seit ca einer Woche teilweise minus Werte bei der Route statt minimal 0. Die werte werden aber abgefragt und es wird auch Stau angezeigt.

                      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

                      557

                      Online

                      32.7k

                      Users

                      82.6k

                      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