tag:taskings.svbtle.com,2014:/feedAutomator Bonsai2014-02-12T17:28:17-08:00Automator Bonsaihttps://taskings.svbtle.comfaraz3116@gmail.comSvbtle.comtag:taskings.svbtle.com,2014:Post/voice-controlling-my-nest-thermostat2014-02-12T17:28:17-08:002014-02-12T17:28:17-08:00Voice Controlling My NEST Thermostat<p>First, the example:</p>
<iframe width="420" height="315" src="//www.youtube.com/embed/CUaAHtIQEx0"></iframe>
<p><em>2 updates since this was written:</em></p>
<ol>
<li>Nest now has a public API</li>
<li>You don’t need to root your phone to do any of this.
I will be updating this guide soon to reflect the above
—</li>
</ol>
<p>NEST, for whatever reason, has yet to publicly release their API. At the moment, it seems like Nest Labs is focusing on giving early access to <a href="https://nest.com/blog/2013/09/25/calling-all-developers/">rich-people-things companies like Control4</a>. There is also the NEST <a href="http://androidcommunity.com/google-glass-nest-app-brings-voice-controlled-thermostat-adjustments-20130524/">Google Glass app that you can </a> control using your voice. In both cases, I did not feel like shelling out thousands of dollars to beta test something seemingly simple. </p>
<p>I am sure it will be soon that NEST releases the public APl, but at the time of writing, it isn’t so. Luckily, good folks like <a href="https://github.com/smbaker/pynest">Scott Baker</a>, have reverse engineered how NEST control works over the internet. I decided to use Scott’s unofficial NEST API and integrate it into the vastly popular automation app Tasker.</p>
<h2 id="how_2">How? <a class="head_anchor" href="#how_2">#</a>
</h2>
<p>Requirements:</p>
<ul>
<li><p>Android Device(I did this on my Moto X and Nexus 7)</p></li>
<li><p><a href="https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=en">Tasker</a></p></li>
<li><p><a href="https://play.google.com/store/apps/details?id=com.joaomgcd.autovoice&hl=en">Autovoice Plugin for Tasker</a></p></li>
<li><p><a href="https://code.google.com/p/android-scripting/downloads/detail?name=sl4a_r6.apk&can=2&q=">SL4A- Python</a> </p></li>
</ul>
<p><strong>Then …</strong> </p>
<ol>
<li>Install the <a href="https://code.google.com/p/android-scripting/downloads/detail?name=sl4a_r6.apk&can=2&q=">SL4A</a> Framework apk.<a href="https://svbtleusercontent.com/qrj5e5fmkrvtsa.gif"><img src="https://svbtleusercontent.com/qrj5e5fmkrvtsa_small.gif" alt="SL24a.gif"></a>
</li>
</ol>
<p>You are going to need to install a Python Interpreter in order to be able to able to run the python scripts.</p>
<ol>
<li><p>Copy the <a href="https://dl.dropboxusercontent.com/u/39781787/Tasker/NEST%20Tasker.zip">nest.py and settemp.py</a> to your sdcard’s SL4A/scripts location.<a href="https://svbtleusercontent.com/hbpzm7av8glvq.gif"><img src="https://svbtleusercontent.com/hbpzm7av8glvq_small.gif" alt="sd.gif"></a> </p></li>
<li><p>Edit the settemp.py to include your NEST login account name and password. <em>Disclaimer: My password is in plain text. In the future, I will probably salt it.</em></p></li>
<li>
<p>Import the following Profile and Scene into Tasker.</p>
<ul>
<li><a href="https://dl.dropboxusercontent.com/u/16140/tasker/NEST_Control.prf.xml">NEST Control</a></li>
<li><a href="https://dl.dropboxusercontent.com/u/16140/tasker/Nest.scn.xml">Nest Scene</a></li>
</ul>
</li>
<li><p>Test with Autovoice prompt. Command filters are:<br>
<strong>“set thermostat to”</strong><br>
and <strong>“set thermostat”</strong><br>
Anything else will not work, but feel free to edit the Tasker profile to your liking.</p></li>
</ol>
<h2 id="what39s-happening-behind-the-scenes_2">What’s Happening Behind The Scenes? <a class="head_anchor" href="#what39s-happening-behind-the-scenes_2">#</a>
</h2>
<p>In a nutshell, Autovoice is listening for the command “set thermostat to” and whatever comes after that is set as a variable (%temp) that is passed on to the python script that interfaces with NEST. Once the python script receives the value for the %temp variable, it then uses Scott’s nest.py to do the legwork of changing the temperature on your NEST.</p>
<p>*Moto X Always Listening- Please note that the Moto X has a low power chip that is always listening to the trigger word ‘OK Google’. I am currently using <a href="http://forum.xda-developers.com/showthread.php?t=2554173">an Xposed module to integrate Autovoice with Google Now</a>; This allows for custom commands to be picked up by Autovoice from Google Now and passed to Tasker. </p>