<?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[MRX-Work-Traffic - Shows the time you need to get to work]]></title><description><![CDATA[<h1>Description:</h1>
<p dir="auto">Hey ho,<br />
I wrote my first module wich is showing the current time to my workplace.<br />
You can add more than one.<br />
I think, its not the best code at all… but it works :)<br />
Uses google REST API to get the details…</p>
<h1>Screenshot</h1>
<p dir="auto"><img src="/assets/uploads/files/1489741328155-screen.png" alt="0_1489741327810_Screen.PNG" class=" img-fluid img-markdown" /></p>
<h1>Download:</h1>
<p dir="auto">[card:domsen123/mrx-work-traffic]</p>
]]></description><link>https://forum.magicmirror.builders/topic/2092/mrx-work-traffic-shows-the-time-you-need-to-get-to-work</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 21:13:59 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/2092.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 17 Mar 2017 09:04:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Tue, 02 May 2017 13:15:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/domsen123" aria-label="Profile: domsen123">@<bdi>domsen123</bdi></a> A bit more hacking on this and I got it to work.  I changed how the date comparison is done:</p>
<pre><code>    var now = moment();
    var startTimeSplit = this.config.startTime.split(":");
    var endTimeSplit = this.config.endTime.split(":");

    var startTime = moment().hour(startTimeSplit[0]).minute(startTimeSplit[1]);
    var endTime = moment().hour(endTimeSplit[0]).minute(endTimeSplit[1]);

    if( now.isSameOrAfter(startTime) &amp;&amp; now.isSameOrBefore(endTime) ){

</code></pre>
<p dir="auto">I had to do this in three places:</p>
<ol>
<li>in the <code>start()</code> function</li>
<li>in the <code>getDom()</code> function</li>
<li>in the <code>getHeader()</code> function</li>
</ol>
<p dir="auto">I’m no seasoned programmer, so I’m sure there is a better way to do this, but this at least works for me, and I can verify that Canadian addresses seem to work fine.</p>
<p dir="auto">Any chance you can add a configuration to each destination for the travel mode?  i.e.: Driving, Transit, Biking, Walking.  I have two destinations currently configured, my wife’s commute, which she drives, and mine, for which I take transit.  I’d like mine to show transit time, not driving time.</p>
]]></description><link>https://forum.magicmirror.builders/post/20971</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/20971</guid><dc:creator><![CDATA[j.e.f.f]]></dc:creator><pubDate>Tue, 02 May 2017 13:15:57 GMT</pubDate></item><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Tue, 02 May 2017 12:43:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/domsen123" aria-label="Profile: domsen123">@<bdi>domsen123</bdi></a> I followed your instructions and I still can’t get it to work for me.</p>
<p dir="auto">I did a little digging into your code, and it seems like this line is evaluating to false every time:</p>
<p dir="auto">mrx-work-traffic.js: Line 43</p>
<pre><code>if( now &gt;= this.config.startTime &amp;&amp; now &lt; = this.config.endTime )
</code></pre>
<p dir="auto">(space between &lt; and = added by me.  Otherwise it broke markdown…)</p>
<p dir="auto">I added a console.log at line 57:</p>
<pre><code>else{
      console.log("====================== hiding...");
      this.hide(0);
}
</code></pre>
<p dir="auto">and I see that in my console.  It looks like <code>now</code> is not interpreted to be between <code>config.startTime</code> and <code>config.endTime</code>.</p>
<p dir="auto">My config has them set as follows:</p>
<pre><code>        startTime: '00:00',
        endTime: '23:59',
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/20969</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/20969</guid><dc:creator><![CDATA[j.e.f.f]]></dc:creator><pubDate>Tue, 02 May 2017 12:43:49 GMT</pubDate></item><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Tue, 02 May 2017 08:18:17 GMT]]></title><description><![CDATA[<p dir="auto">Hey j.e.f.f…</p>
<ol>
<li>clone in modules directory (remove the npm files you created through npm install)</li>
<li>go back to root…</li>
<li>type “npm install”, if “request” not installed yet (should be installed by default)</li>
<li>request api key (you have already, looks good)</li>
</ol>
<p dir="auto">your config looks good too…</p>
<p dir="auto">just to be sure, plz use :</p>
<pre><code>origin: 'Platz der Republik 1, 11011 Berlin',
destinations: [
			{
				destination: 'Platzl 9, 80331 München',
				label: 'Hofbräuhaus'
			}
		]
</code></pre>
<p dir="auto">But it shouldn’t be a problem, using Canadian addresses…</p>
]]></description><link>https://forum.magicmirror.builders/post/20957</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/20957</guid><dc:creator><![CDATA[domsen123]]></dc:creator><pubDate>Tue, 02 May 2017 08:18:17 GMT</pubDate></item><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Sat, 29 Apr 2017 23:39:32 GMT]]></title><description><![CDATA[<p dir="auto">For the life of me, I can’t get this to work… I don’t even get the header label. Here’s what I did:</p>
<ol>
<li>
<p dir="auto">Cloned the repo into my modules directory with<br />
<code>git clone https://github.com/domsen123/mrx-work-traffic.git</code></p>
</li>
<li>
<p dir="auto">In the new directory first I tried to run <code>npm install</code> but I got the error that <code>package.json</code> didn’t exist.  So I tried to install request directly by running <code>npm install request</code>but I got the same error.</p>
</li>
<li>
<p dir="auto">I tried creating <code>package.json</code> by running <code>npm init</code>.  then I was able to install Request by running <code>npm install request</code>.</p>
</li>
<li>
<p dir="auto">I requested a Google API key from here:<br />
<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank" rel="noopener noreferrer nofollow ugc">https://developers.google.com/maps/documentation/javascript/get-api-key</a></p>
</li>
<li>
<p dir="auto">My config looks like this:</p>
</li>
</ol>
<pre><code>    {
      module: 'mrx-work-traffic',
      position: 'top_left',
      header: 'Traffic',
      config: {
        apikey: '*** My API Key ***',
        origin: '135 Bellefair Ave, Toronto ON M4L 3V1',
        startTime: '00:00',
        endTime: '23:59',
        destinations: [
          {
            destination: '37 Holland Dr Bolton, ON L7E 5S4',
            label: 'Mars'
          }
        ]
      }
    },    

</code></pre>
<p dir="auto">I don’t see any errors in the console.  All I get on my screen is the header’s underline, but not even the label text.</p>
<p dir="auto">I suspect that the problem is either that Request is not installed properly, or that this won’t work with Canadian addresses.  Any thoughts?</p>
<p dir="auto">Thanks!<br />
-Jeff</p>
]]></description><link>https://forum.magicmirror.builders/post/20776</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/20776</guid><dc:creator><![CDATA[j.e.f.f]]></dc:creator><pubDate>Sat, 29 Apr 2017 23:39:32 GMT</pubDate></item><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Fri, 17 Mar 2017 10:12:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/strawberry-3.141" aria-label="Profile: strawberry-3.141">@<bdi>strawberry-3.141</bdi></a> thats the next module I will write (MMM-MagicBeam) with Alexa support…<br />
Mirror, beam me up to Oktoberfest…</p>
]]></description><link>https://forum.magicmirror.builders/post/17699</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/17699</guid><dc:creator><![CDATA[domsen123]]></dc:creator><pubDate>Fri, 17 Mar 2017 10:12:03 GMT</pubDate></item><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Fri, 17 Mar 2017 10:09:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/domsen123" aria-label="Profile: domsen123">@<bdi>domsen123</bdi></a> bummer thought you are probably related to captain kirk with access to warp speed</p>
]]></description><link>https://forum.magicmirror.builders/post/17698</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/17698</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Fri, 17 Mar 2017 10:09:24 GMT</pubDate></item><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Fri, 17 Mar 2017 09:54:25 GMT]]></title><description><![CDATA[<p dir="auto">haha this screen is with an other config :D</p>
<p dir="auto">Its from the Main Trainstation in Munich :)</p>
]]></description><link>https://forum.magicmirror.builders/post/17697</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/17697</guid><dc:creator><![CDATA[domsen123]]></dc:creator><pubDate>Fri, 17 Mar 2017 09:54:25 GMT</pubDate></item><item><title><![CDATA[Reply to MRX-Work-Traffic - Shows the time you need to get to work on Fri, 17 Mar 2017 09:34:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/domsen123" aria-label="Profile: domsen123">@<bdi>domsen123</bdi></a> Interesting how you get in 11mins from Berlin to Hofbräuhaus in Munich :rofl:</p>
]]></description><link>https://forum.magicmirror.builders/post/17696</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/17696</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Fri, 17 Mar 2017 09:34:34 GMT</pubDate></item></channel></rss>