<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Changing MMM-Traffic into using TomTom API]]></title><description><![CDATA[<p dir="auto">Hi Guys,<br />
Since the Mapbox API is very inaccurate in my region, I want to use the TomTom API.<br />
I am completely new to developing modules, so I am trying to change an existing one.<br />
I tried it with this one: <a href="https://github.com/SamLewis0602/MMM-Traffic" target="_blank" rel="noopener noreferrer nofollow ugc">MMM-Traffic</a></p>
<p dir="auto">The first thing I change is the API Link, for the first tests, I removed the vars from the Link and replaced them with a static API request.<br />
Another thing I changed was the</p>
<pre><code>self.duration = Math.round(json.routes[0].duration / 60);
</code></pre>
<p dir="auto">into:</p>
<pre><code>self.duration = Math.round(json.routes[0].travelTimeInSeconds / 60);
</code></pre>
<p dir="auto">I uploaded an extinct of the API Return  <a href="https://pastebin.com/hR2FqnLf" target="_blank" rel="noopener noreferrer nofollow ugc">here</a></p>
<p dir="auto">But after the changes, the Modules just shows its “Loading” Phrase, so I guess I missed something.</p>
<p dir="auto">I would appreciate any type of help and I will provide further information if needed :)</p>
]]></description><link>https://forum.magicmirror.builders/topic/15554/changing-mmm-traffic-into-using-tomtom-api</link><generator>RSS for Node</generator><lastBuildDate>Sun, 07 Jun 2026 02:29:44 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/15554.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Sep 2021 14:34:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 17:16:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
The Same Error accured for Line 70, so I both commented those 2 lines.<br />
Now I get no Error,  and the Loading disappeared, it now says:<br />
<img src="/assets/uploads/files/1632071778161-screenshot_4.png" alt="Screenshot_4.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.magicmirror.builders/post/94675</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94675</guid><dc:creator><![CDATA[rxlDavid]]></dc:creator><pubDate>Sun, 19 Sep 2021 17:16:46 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 17:08:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
So I forgot to close a bracket, so now its again showing the Loading screen.<br />
I get the following error:<br />
<img src="/assets/uploads/files/1632071023569-screenshot_2.png" alt="Screenshot_2.png" class=" img-fluid img-markdown" /><br />
What does the :69 mean?</p>
<p dir="auto">Edit: this is line 69</p>
<pre><code> .catch(e =&gt; {
        Line 69 self.errorMessage = payload.error.message;
        self.errorDescription = payload.error.description;
        self.loading = false;
        self.updateDom();
      });
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/94674</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94674</guid><dc:creator><![CDATA[rxlDavid]]></dc:creator><pubDate>Sun, 19 Sep 2021 17:08:14 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 16:42:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a> ah, you are doing this in the modulename.js side, not node_helper…</p>
<p dir="auto">all messages in the modulename are shown in the developers window console</p>
<p dir="auto">ctrl-shift-i on the MM screen,</p>
<p dir="auto">select the console tab in the window that pops up</p>
<p dir="auto">u can filter to messages from a module by adding some unique part of the module name to the filter  field (middle above the list of messages)</p>
]]></description><link>https://forum.magicmirror.builders/post/94669</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94669</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 16:42:35 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 16:35:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
I do know I think this project is too hard for me lol<br />
I now changed this:</p>
<pre><code>  getCommute: function (api_url) {
    var self = this;
    fetch('https://api.tomtom.com/routing/1/calculateRoute/4x.xxx%2C9.xxx%3A4x.xxx%2C9.xx/json?avoid=unpavedRoads&amp;key=&lt;key&gt;')
	  .then(console.log('API SUCESS')
      .then(json =&gt; {
        self.duration = Math.round(json.routes[0].duration / 60);
        self.errorMessage = self.errorDescription = undefined;
        self.loading = false;
        self.updateDom();
      })
      .catch(e =&gt; {
        self.errorMessage = payload.error.message;
        self.errorDescription = payload.error.description;
        self.loading = false;
        self.updateDom();
      });

  },
</code></pre>
<p dir="auto">Now the "loading does not even appear I don’t know if that’s good or bad, but I cant even see my (console.log(‘API SUCESS’) in the .txt</p>
]]></description><link>https://forum.magicmirror.builders/post/94668</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94668</guid><dc:creator><![CDATA[rxlDavid]]></dc:creator><pubDate>Sun, 19 Sep 2021 16:35:21 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:52:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a> javascript provides a built in library call JSON</p>
<p dir="auto">which provides 2 useful functions</p>
<p dir="auto">parse (text)  = converts to javascript object<br />
stringify(object,routine(most if the time u would use null ),indentation ) = returns string of text</p>
<p dir="auto">so then u could</p>
<pre><code>console.log("mesage="+JSON.stringify(pointer_to_data_returned_from_api))
</code></pre>
<p dir="auto">to see it on the console (or somefile.txt if u redirect to a file)</p>
]]></description><link>https://forum.magicmirror.builders/post/94667</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94667</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:52:21 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:32:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
Sorry, Tomtom provides a website which returns the data.<br />
So it wasn’t my MagicMirror returning it</p>
]]></description><link>https://forum.magicmirror.builders/post/94666</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94666</guid><dc:creator><![CDATA[rxlDavid]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:32:13 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:29:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a> that is from the updateNotifcation module which has a bug … fixed in next release</p>
<p dir="auto">after u got the data, then what did u do?</p>
]]></description><link>https://forum.magicmirror.builders/post/94665</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94665</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:29:26 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:24:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
this is also the view Tomtom provided me.<br />
but I don’t get what I need to change.<br />
right now I got the following error in the console:<br />
[19.09.2021 17:22.10.688] [ERROR] Failed to fetch git data for MMM-Traffic: Erro                                                                                                                                                   r: block timeout reached</p>
]]></description><link>https://forum.magicmirror.builders/post/94664</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94664</guid><dc:creator><![CDATA[rxlDavid]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:24:33 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:20:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a> if u put it thru the formatter</p>
<pre><code class="language-json">{
  "formatVersion": "0.0.12",
  "routes": [
    {
      "summary": {
        "lengthInMeters": 1147,
        "travelTimeInSeconds": 140,
        "trafficDelayInSeconds": 0,
        "trafficLengthInMeters": 0,
        "departureTime": "2021-09-19T17:16:54+02:00",
        "arrivalTime": "2021-09-19T17:19:14+02:00"
      },
      "legs": [
        {
          "summary": {
            "lengthInMeters": 1147,
            "travelTimeInSeconds": 140,
            "trafficDelayInSeconds": 0,
            "trafficLengthInMeters": 0,
            "departureTime": "2021-09-19T17:16:54+02:00",
            "arrivalTime": "2021-09-19T17:19:14+02:00"
          },
          "points": [
            {
              "latitude": 52.5093,
              "longitude": 13.42937
            },
            {
              "latitude": 52.50904,
              "longitude": 13.42913
            },
            {
              "latitude": 52.50895,
              "longitude": 13.42904
            },
            {
              "latitude": 52.50868,
              "longitude": 13.4288
            },
            {
              "latitude": 52.5084,
              "longitude": 13.42857
            },
            {
              "latitude": 52.50816,
              "longitude": 13.42839
            },
            {
              "latitude": 52.50791,
              "longitude": 13.42825
            },
            {
              "latitude": 52.50757,
              "longitude": 13.42772
            },
            {
              "latitude": 52.50752,
              "longitude": 13.42785
            },
            {
              "latitude": 52.50742,
              "longitude": 13.42809
            },
            {
              "latitude": 52.50735,
              "longitude": 13.42824
            },
            {
              "latitude": 52.5073,
              "longitude": 13.42837
            },
            {
              "latitude": 52.50696,
              "longitude": 13.4291
            },
            {
              "latitude": 52.50673,
              "longitude": 13.42961
            },
            {
              "latitude": 52.50619,
              "longitude": 13.43092
            },
            {
              "latitude": 52.50608,
              "longitude": 13.43116
            },
            {
              "latitude": 52.50574,
              "longitude": 13.43195
            },
            {
              "latitude": 52.50564,
              "longitude": 13.43218
            },
            {
              "latitude": 52.50528,
              "longitude": 13.43299
            },
            {
              "latitude": 52.50513,
              "longitude": 13.43336
            },
            {
              "latitude": 52.505,
              "longitude": 13.43366
            },
            {
              "latitude": 52.50464,
              "longitude": 13.43451
            },
            {
              "latitude": 52.50451,
              "longitude": 13.43482
            },
            {
              "latitude": 52.50444,
              "longitude": 13.43499
            },
            {
              "latitude": 52.50418,
              "longitude": 13.43564
            },
            {
              "latitude": 52.50364,
              "longitude": 13.4369
            },
            {
              "latitude": 52.50343,
              "longitude": 13.43738
            },
            {
              "latitude": 52.5033,
              "longitude": 13.43767
            },
            {
              "latitude": 52.50275,
              "longitude": 13.43873
            }
          ]
        }
      ],
      "sections": [
        {
          "startPointIndex": 0,
          "endPointIndex": 28,
          "sectionType": "TRAVEL_MODE",
          "travelMode": "car"
        }
      ]
    }
  ]
}
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/94663</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94663</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:20:46 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:17:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
I know, it was just an extinct, since it used private Data,<br />
I updated it to the full return with random Data</p>
]]></description><link>https://forum.magicmirror.builders/post/94662</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94662</guid><dc:creator><![CDATA[rxlDavid]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:17:58 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:14:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a> the json data u posted is not valid… something is missing after the trailing comma</p>
]]></description><link>https://forum.magicmirror.builders/post/94661</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94661</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:14:19 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:12:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a> u probably use pm2, so</p>
<pre><code>pm2 stop all
</code></pre>
<p dir="auto">then</p>
<pre><code>cd ~/MagicMirror
</code></pre>
<p dir="auto">then u can</p>
<pre><code>npm start &gt;somefile.txt
</code></pre>
<p dir="auto">ctrl-c to end</p>
<p dir="auto">repeat til working</p>
]]></description><link>https://forum.magicmirror.builders/post/94660</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94660</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:12:25 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:10:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a></p>
<p dir="auto">write message to console<br />
console,log(“some message”+variable+…)</p>
]]></description><link>https://forum.magicmirror.builders/post/94659</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94659</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:10:24 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 15:10:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a><br />
hi,<br />
I changed the API Return, there is an option to get it back in JSON.<br />
What do you mean with write message to the console? &amp; where/when should I execute “npm start &gt;somefile.txt”</p>
]]></description><link>https://forum.magicmirror.builders/post/94658</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94658</guid><dc:creator><![CDATA[rxlDavid]]></dc:creator><pubDate>Sun, 19 Sep 2021 15:10:15 GMT</pubDate></item><item><title><![CDATA[Reply to Changing MMM-Traffic into using TomTom API on Sun, 19 Sep 2021 14:51:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rxldavid" aria-label="Profile: rxldavid">@<bdi>rxldavid</bdi></a> the data is not the same from the two apis…</p>
<p dir="auto">so, you either have to change EVERYTHING that touches the data OR, after receiving change the layout to match the old format.</p>
<p dir="auto">json is pretty nice to work with …</p>
<p dir="auto">use the validator here <a href="https://codebeautify.org/jsonvalidator?/jsonvalidate" target="_blank" rel="noopener noreferrer nofollow ugc">https://codebeautify.org/jsonvalidator?/jsonvalidate</a><br />
click the top left button and it will format the data in a nice readable format</p>
<p dir="auto">loading… is the initial message, til the actual data arrives…<br />
so, the data didn’t arrive</p>
<p dir="auto">I assume that the request for the data is done in the node_helper</p>
<p dir="auto">u can write messages to the console and see them in the window where u start MM</p>
<p dir="auto">during development, use npm start &gt;somefile.txt</p>
<p dir="auto">and then u can see all the messages in somefile.txt</p>
<p dir="auto">I use ssh connection to pi, so I can edit on my desktop<br />
when using windows desktop i use bitvise ssh client or winscp<br />
as they provide a networked disk page like file explorer so I can just doubleclick to edit,</p>
<p dir="auto">when using linux, most of the file browsers will allow access to ssh connected systems the same way…</p>
]]></description><link>https://forum.magicmirror.builders/post/94657</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/94657</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Sun, 19 Sep 2021 14:51:32 GMT</pubDate></item></channel></rss>