<?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[Help with MMM-PIR-Sensor tvservice logical evaluation]]></title><description><![CDATA[<p dir="auto">Can someone help shed some light on this piece of code in the MMM-PIR-Sensor module? In the node_helper.js there is:</p>
<pre><code>      // Check if hdmi output is already on
      exec("/opt/vc/bin/tvservice -s").stdout.on('data', function(data) {
        if (data.indexOf("0x120002") !== -1)
          exec("/opt/vc/bin/tvservice --preferred &amp;&amp; chvt 6 &amp;&amp; chvt 7", null);
</code></pre>
<p dir="auto">I understand what it is doing. It is checking if the monitor is in standby [TV is off] and if so then it turns it on. This bit of code also executes when the monitor is on though which is the part that I am having trouble with. I understand that  0x120002 is what tvservice reports when the monitor is off. I don’t understand the<code>!== -1</code></p>
<p dir="auto">Any help? I would like to change the logic so it doesn’t execute that line when the monitor is on (0x12000a)</p>
]]></description><link>https://forum.magicmirror.builders/topic/4505/help-with-mmm-pir-sensor-tvservice-logical-evaluation</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 04:50:33 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/4505.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 20 Jul 2017 10:41:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help with MMM-PIR-Sensor tvservice logical evaluation on Fri, 21 Jul 2017 11:46:32 GMT]]></title><description><![CDATA[<p dir="auto">I figured it out. There are missing brackets for the if statement. In node_helper.js:</p>
<p dir="auto">From:</p>
<pre><code>        if (data.indexOf("0x120002") !== -1)
          exec("/opt/vc/bin/tvservice --preferred &amp;&amp; chvt 6 &amp;&amp; chvt 7", null);
</code></pre>
<p dir="auto">To:</p>
<pre><code>        if (data.indexOf("0x120002") !== -1){
          exec("/opt/vc/bin/tvservice --preferred &amp;&amp; chvt 6 &amp;&amp; chvt 7", null);
       }
</code></pre>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paviro" aria-label="Profile: paviro">@<bdi>paviro</bdi></a></p>
]]></description><link>https://forum.magicmirror.builders/post/25613</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/25613</guid><dc:creator><![CDATA[orayoflighto]]></dc:creator><pubDate>Fri, 21 Jul 2017 11:46:32 GMT</pubDate></item><item><title><![CDATA[Reply to Help with MMM-PIR-Sensor tvservice logical evaluation on Thu, 20 Jul 2017 21:20:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/orayoflighto" aria-label="Profile: orayoflighto">@<bdi>orayoflighto</bdi></a> if there is no occurence of the string <code>0x120002</code>, the method <code>indexOf</code> returns <code>-1</code>. So he checks if the string <code>0x120002</code> is part of the variable data.</p>
]]></description><link>https://forum.magicmirror.builders/post/25577</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/25577</guid><dc:creator><![CDATA[strawberry 3.141]]></dc:creator><pubDate>Thu, 20 Jul 2017 21:20:02 GMT</pubDate></item></channel></rss>