<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>iPhone Home Controller</title>
	<atom:link href="http://www.iphonehomecontroller.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iphonehomecontroller.com</link>
	<description>For People Who Love Their iPhone and Hate Their Keys.</description>
	<pubDate>Fri, 04 Jul 2008 00:32:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Control Your Home From Your iPhone 2.0 - Full Tutorial</title>
		<link>http://www.iphonehomecontroller.com/2008/07/02/control-your-home-from-your-iphone-2-full-tutorial/</link>
		<comments>http://www.iphonehomecontroller.com/2008/07/02/control-your-home-from-your-iphone-2-full-tutorial/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 02:19:46 +0000</pubDate>
		<dc:creator>chuck</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[Apache]]></category>

		<category><![CDATA[automation]]></category>

		<category><![CDATA[iPhone 2]]></category>

		<category><![CDATA[itouch]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[x10]]></category>

		<guid isPermaLink="false">http://www.iphonehomecontroller.com/?p=12</guid>
		<description><![CDATA[To celebrate the release of the iPhone 2.0 this post is an expansion of my original tutorial and goes through everything you need to do, step by step, to control your lights, doors, etc&#8230; using x10 and PHP technology all from your iPhone 2.0/iTouch. This tutorial assumes that you have a working knowledge of HTML, [...]]]></description>
			<content:encoded><![CDATA[<p>To celebrate the release of the iPhone 2.0 this post is an expansion of my original tutorial and goes through everything you need to do, step by step, to control your lights, doors, etc&#8230; using x10 and PHP technology all from your iPhone 2.0/iTouch. This tutorial assumes that you have a working knowledge of HTML, CSS and PHP, and have downladed the <a href="http://www.iphonehomecontroller.com/examples/iphc-v1-3.zip">iPHC v1.3</a> files.</p>
<p><strong><em>Step One:</em> Web enabled device</strong> - any device that can connect to the Internet will work once you have everything set up. (Note: The iphc1.3 package includes an iPhone/iTouch specific interface, but still looks good in a web browser on a PC.)</p>
<p><strong><em>Step Two:</em> Web Server with PHP</strong> - You&#8217;ll need a web server that has PHP installed on it. Most likely it will be an install on your home PC because you have to have the ActiveHome x10 USB module plugged into the computer controlling the house. The module comes with a driver download which will be necessary as well. My install is on Windows XP running Apache, PHP and MySQL. The interface can work without MySQL but it is cooler with it so I have included an SQL file in the iphc1.3 download.  <a href="http://www.expertsrt.com/tutorials/Matt/install-apache.html">This is the tutorial I used for Apache, PHP, and MySQL install on a Windows PC</a>. I also suggest installing <a href="http://www.phpmyadmin.net/home_page/index.php">phpMyAdmin</a> to make working with your databse(s) and uploading the iphc1.3 SQL file easier. You will need to create a database (I called mine &#8220;fonhome&#8221; - haha) before uploading the SQL file btw.</p>
<p>If your install goes well you should be able to replace the contents of htdocs with the files from the iphc1.3 download, open your browser and type in localhost, and see the interface.  <a href="http://www.iphonehomecontroller.com/examples/iphc-v1-3.zip">Download the iPHC version 1.3 here</a> (the code is not well commented yet but I will be adding more comments soon). If you are using a router you will have to configure it before you can connect to your interface from the Internet via your ip. I am not sure if this is possible for every isp but it works for me.</p>
<p>Look up your computer&#8217;s ip address in the command prompt by typing <strong>ipconfig</strong>. Allow that address on port 80 in your router and you should be able to get through to your interface through any web enabled device using the ip address that is currently provided to your by your isp (<a href="http://whatismyip.com/">check your ip address here</a>). Do this carefully! There are tons of tips on doing a safe and protected Apache install using the .htaccess and Apache&#8217;s htpasswd so check them out. Opening your computer to the public can be risky guy.</p>
<p><strong><em>Step Three:</em> The Hardware</strong> - There are many different modules out there that accept incoming x10 signals. For this tutorial you will need at least the <a href="http://affiliates.x10.com/?property=affiliates&amp;aposition=text3&amp;lineid=xtenafftxt3&amp;affid=x10_11941764331&amp;type=href">ActiveHome Pro USB module</a> plugged into your computer running PHP and into the wall, and one x10 module. I bought a <a href="http://affiliates.x10.com/?property=affiliates&amp;aposition=text3&amp;lineid=xtenafftxt3&amp;affid=x10_11941764331&amp;type=href">package that included several modules</a> (most importantly the USB one) that was perfect for testing. I also purchased a <a href="http://www.x10.com/products/x10_um506.htm">x10 Universal Module</a> and <a href="http://www.smarthome.com/5190S.html">Schlage Electric Door Strike</a> for unlocking my door remotely (the code for which is included in iphc1.3).</p>
<p><em><strong>Step Four:</strong></em> <strong>The Code</strong> - At this point you should at least be able to view &#8220;localhost&#8221; in your web browser and manipulate the pages in your main web folder.</p>
<p>The way the interface works is quite simple. There is an .exe file (ahcmd.exe) that is available in the <a href="http://www.x10.com/activehomepro/sdk/index.html">ActiveHome SDK</a> for the ActiveHome Pro that allows x10 signals to be sent through your house using PHP functions to trigger the events (I have included the exe file in the iphc1.3 package but not the full SDK documentation). This file will need to be included in your main web folder where your index is located (or at least somewhere that you can point to it).<br />
<strong>The PHP: </strong>This is the line of PHP code that turns any x10 module set to address A1, off:</p>
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc"><strong>exec(&#8221;ahcmd.exe sendplc a1 off&#8221;);</strong></p>
<p>ahcmd.exe accepts several commands, sendplc being one of them. There is more documentation on the accepted commands here but this system uses sendplc exclusively. The function is carries out by PHP&#8217;s exec command which you can learn more about <a href="http://us.php.net/function.exec">here</a>. In addition to the &#8220;off&#8221; function there is also &#8220;on&#8221; (duh), dim and bright.</p>
<p>The most efficient way to trigger an event using HTML and PHP is AJAX ( or AJAH more appropriately depending on who you ask). Either way, I decided to go with that in the iphc1.3 code and also featured it in my &#8220;iphc PHP and AJAX Breakdown&#8221; post which you can view <a href="http://www.iphonehomecontroller.com/2007/12/09/iphone-home-controller-v1-php-and-ajax-breakdown/">here</a>.</p>
<p><strong>Macros:</strong> To make a series of x10 events, you really only need to copy the above code for as many events as is needed and change the addresses/statuses. I have found that using PHP&#8217;s sleep function to put a second or two (or more depending) between events makes for a more reliable macro. Once again, my full code is included in the iphc1.3 download.</p>
<p><strong>The CSS, Javascript, HTML:</strong> I have used some Javascript to make the navigation buttons work, as well as to hide the navigation bar on the iPhone. The css provided is a &#8220;green&#8221; theme including several icons that can easily be swapped out. The HTML is well, HTML. If you think it is messed up, let me know. Everything is set up to look spiffy on the iPhone 2 interface.</p>
<p>That&#8217;s all folks! Let me know if you have any questions.</p>
<p>PS - I am still working on a little video to show the interface in action, and a iPHC version 2.0. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonehomecontroller.com/2008/07/02/control-your-home-from-your-iphone-2-full-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone Home Controller v1.3</title>
		<link>http://www.iphonehomecontroller.com/2008/06/24/iphone-home-controller-v13/</link>
		<comments>http://www.iphonehomecontroller.com/2008/06/24/iphone-home-controller-v13/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 01:37:34 +0000</pubDate>
		<dc:creator>chuck</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[AXAH]]></category>

		<category><![CDATA[itouch]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[x10]]></category>

		<guid isPermaLink="false">http://www.iphonehomecontroller.com/2008/06/24/iphone-home-controller-v13/</guid>
		<description><![CDATA[All right everyone, I finally got a chance to post about version 1.3. If you are new to this site then check out the original tutorial here.
In this version I add MySQL to take care of light status and to ease the amount of coding needed for the interface. If you are a MySQL novice [...]]]></description>
			<content:encoded><![CDATA[<p>All right everyone, I finally got a chance to post about version 1.3. If you are new to this site then check out the original tutorial <a href="/2007/11/05/control-your-home-with-your-iphone/">here</a>.</p>
<p>In this version I add MySQL to take care of light status and to ease the amount of coding needed for the interface. If you are a MySQL novice like I am you should probably use <a href="http://www.google.com/url?q=http://www.phpmyadmin.net/home_page/downloads.php&amp;sa=X&amp;oi=smap&amp;resnum=1&amp;ct=result&amp;cd=1&amp;usg=AFQjCNGSArrFO4pL2BK3870UwwBDFjKClQ">phpMyAdmin</a> for easy database and table setup. Set up a database and import the sql file included in the 1.3 package. This will set up tables that correcspond to my current configuation at my house. You can of course set this up however your system requires. If you need to install MySQL, you can get version 5 which I used, <a href="http://dev.mysql.com/downloads/mysql/5.0.html">here</a>. If you want to check out a tutorial on how it all works with PHP and Apache <a href="http://www.expertsrt.com/tutorials/Matt/install-apache.html">check this tutorial</a>.</p>
<p>The database is really just for having icons that reflect the status of the lights. It works fairly well except for the fact that a manual triggering of any light will not update the database and therefore the icon will be incorrect.</p>
<p>In this version I have also rewritten the JavaScript and CSS for the interface, opting to go for a custom look and smaller files rather than the bulky and clunky iUI script. There is no sliding windows in this version but I didn&#8217;t think it was really that needed.</p>
<p>If you check out this version you will also see that I have created a section to control my door. I bought a door lock that would typically be used where the door is unlocked with a buzzer. I am using a x10 relay module and a bit of PHP to send the &#8220;buzz&#8221; and then closing the connection with PHP (<a href="/2007/11/05/control-your-home-with-your-iphone/">check tutorial 1</a> for more info on how this system works).</p>
<p>All in all the new system is lightweight and quite functional. Stay tuned for more as I have begun to collaborate with another developer with a better grasp on PHP and MySQL then I have&#8230; Should be good stuff.</p>
<p><strong>Download:</strong> <a href="/examples/iphc-v1-3.zip">iPHC v1.3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonehomecontroller.com/2008/06/24/iphone-home-controller-v13/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone Home Controller v1 - PHP and AJAX Breakdown</title>
		<link>http://www.iphonehomecontroller.com/2007/12/09/iphone-home-controller-v1-php-and-ajax-breakdown/</link>
		<comments>http://www.iphonehomecontroller.com/2007/12/09/iphone-home-controller-v1-php-and-ajax-breakdown/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 20:46:37 +0000</pubDate>
		<dc:creator>chuck</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[ActiveHome Pro]]></category>

		<category><![CDATA[AHCMD.EXE]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[HTML]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.iphonehomecontroller.com/2007/12/09/iphone-home-controller-v1-php-and-ajax-breakdown/</guid>
		<description><![CDATA[Welcome, if this is your first time here, check out the full tutorial on controlling your home using the iPhone and x10. If you already have set up an x10 interface using your home PC, Apache and PHP, then read on for an easy PHP and AJAX breakdown of the code that drives the interface.
After [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome, if this is your first time here, <a href="/2007/11/05/control-your-home-with-your-iphone/">check out the full tutorial</a> on controlling your home using the iPhone and x10. If you already have set up an x10 interface using your home PC, Apache and PHP, then read on for an easy PHP and AJAX breakdown of the code that drives the interface.</p>
<p>After many hours of playing around with the Activehome Pro CM15a interface and re-writing the code that makes it work on the web about 100 times, I have come up with a very simple few bits of code that anyone, running the CM15a with PHP, and Apache installed on their computer, can use to turn a device, or series of devices  on or off with X10 and an iPhone or iTouch, or any web browser, or using the NIntendo Wii (which I do sometimes for shits and giggles). My main goal was to create a simple on/off button that worked without a page refresh. That required AJAX. Here is the simplest breakdown I have been able to come up with for all the necessary code. I am not going to post any CSS files this time but I will post my latest version, CSS and all, here soon!</p>
<p>The HTML:</p>
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc">&lt;a href=&#8221;javascript:void(0);&#8221; name=&#8221;a1 on&#8221; id=&#8221;a1&#8243; onclick=&#8221;lightUp(this.name)&#8221;&gt;Turn A1 On/Off&lt;/a&gt;<br />
&lt;div id=&#8221;response&#8221;&gt;&lt;/div&gt;</p>
<p>The JavaScript:</p>
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc">var xmlHttp<br />
function lightUp(str)<br />
{<br />
xmlHttp=GetXmlHttpObject()<br />
if (xmlHttp==null)<br />
{<br />
alert (&#8221;Browser does not support HTTP Request&#8221;)<br />
return<br />
}<br />
var url=&#8221;test.php&#8221;<br />
url=url+&#8221;?q=&#8221;+str<br />
url=url+&#8221;&amp;sid=&#8221;+Math.random()<br />
xmlHttp.onreadystatechange=stateChanged<br />
xmlHttp.open(&#8221;GET&#8221;,url,true)<br />
xmlHttp.send(null)<br />
}<br />
function stateChanged()<br />
{<br />
if (xmlHttp.readyState==4 || xmlHttp.readyState==&#8221;complete&#8221;)<br />
{<br />
var result= xmlHttp.responseText;<br />
document.getElementById(&#8217;a1&#8242;).name = result;<br />
var temp = new Array();<br />
temp = result.split(&#8217; &#8216;);<br />
if (temp[1]==&#8217;off&#8217;){<br />
document.getElementById(&#8217;response&#8217;).innerHTML = &#8220;you turned a1 0ff&#8221;;<br />
}<br />
else {<br />
if (temp[1]==&#8217;on&#8217;){<br />
document.getElementById(&#8217;response&#8217;).innerHTML = &#8220;you turned a1 0n&#8221;;<br />
}<br />
}<br />
}<br />
}<br />
function GetXmlHttpObject()<br />
{<br />
var xmlHttp=null;<br />
try<br />
{<br />
xmlHttp=new XMLHttpRequest();<br />
}<br />
catch (e)<br />
{<br />
try<br />
{<br />
xmlHttp=new ActiveXObject(&#8221;Msxml2.XMLHTTP&#8221;);<br />
}<br />
catch (e)<br />
{<br />
xmlHttp=new ActiveXObject(&#8221;Microsoft.XMLHTTP&#8221;);<br />
}<br />
}<br />
return xmlHttp;<br />
}</p>
<p>The PHP (test.php):</p>
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc">$q=$_GET["q"];<br />
$send = &#8220;ahcmd.exe sendplc&#8221;;<br />
if ($q==&#8217;a1 on&#8217;){<br />
exec(&#8221;$send $q&#8221;);<br />
echo &#8220;a1 off&#8221;;<br />
}<br />
else {<br />
exec(&#8221;$send a1 off&#8221;);<br />
echo &#8220;a1 on&#8221;;<br />
}</p>
<p>That&#8217;s it. Pretty simple huh? If you come up with anything that you would like to share please comment here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonehomecontroller.com/2007/12/09/iphone-home-controller-v1-php-and-ajax-breakdown/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone Home Controller - Project 1 v1.2</title>
		<link>http://www.iphonehomecontroller.com/2007/11/28/iphone-home-controller-project-1-v12/</link>
		<comments>http://www.iphonehomecontroller.com/2007/11/28/iphone-home-controller-project-1-v12/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 20:42:32 +0000</pubDate>
		<dc:creator>chuck</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[automation]]></category>

		<category><![CDATA[itouch]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[x10]]></category>

		<guid isPermaLink="false">http://www.iphonehomecontroller.com/2007/11/28/iphone-home-controller-project-1-v12/</guid>
		<description><![CDATA[
We have upgraded version 1.1 with a re-vamp of the AJAX form submit. Goodbye jQuery (for now). I was able to get all the same functionality (and more) out of a smaller script that required no additional JavaScript library to be available for it to work. Now, when a light is turned on/off, the form [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.iphonehomecontroller.com/wp-content/uploads/iphc_p1_v1-2.jpg" alt="iPhone Home Controller version 1.2" style="float: right; margin-left: 10px; width: 200px" /></p>
<p>We have upgraded <a href="/2007/11/13/iphone-home-controller-project-1-v11/" title="iPHC version 1.1">version 1.1</a> with a re-vamp of the AJAX form submit. Goodbye jQuery (for now). I was able to get all the same functionality (and more) out of a smaller script that required no additional JavaScript library to be available for it to work. Now, when a light is turned on/off, the form is posted with AJAX and then the appropriate style of light icon is pulled up and replaces its opposite. The script I made for this purpose is a bit repetitive and therefore bigger than I think it needs to be, but it works so I am happy with that for now. If anyone can suggest a better way to code this please let me know.</p>
<p>Another change in this version is the addition of a MySQL database to hold the status of the lights. This allowed me to combine the on and off buttons on all the lamps and pull in the current status of the lights when the page is first loaded (the rest is handled by the above mentioned script). It was fairly simple to set up the database and with a few tweaks to the PHP.ini file, I was up and running.</p>
<p>We are going to be starting a similar project with the same interface but a Basic Stamp and Parallax PINK server as the base so stay tuned for that. Until then, if you would like you can download the iPhone Home Controller v1.2 PHP, JavaScript and HTML files using the link in the sidebar to the right. Don&#8217;t forget that you will also need the iUI.js file found <a href="http://code.google.com/p/iui/" title="iPhone User Interface">here</a>. Peace!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonehomecontroller.com/2007/11/28/iphone-home-controller-project-1-v12/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone Home Controller - Project 1 v1.1</title>
		<link>http://www.iphonehomecontroller.com/2007/11/13/iphone-home-controller-project-1-v11/</link>
		<comments>http://www.iphonehomecontroller.com/2007/11/13/iphone-home-controller-project-1-v11/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 11:58:01 +0000</pubDate>
		<dc:creator>chuck</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[activehome]]></category>

		<category><![CDATA[automation]]></category>

		<category><![CDATA[itouch]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[x10]]></category>

		<guid isPermaLink="false">http://www.iphonehomecontroller.com/2007/11/13/iphone-home-controller-project-1-v11/</guid>
		<description><![CDATA[Here is version 1.1 of the Home Controller project. In addition and revision to what I posted in &#8220;Control Your Home With Your iPhone&#8220;, I have incorporated the JavaScript and some of the CSS from the iPhone User Interface, aka iUI, project. The iUI gives some of the look and functionality, mainly the sliding panel [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.iphonehomecontroller.com/wp-content/uploads/project1-1.jpg" alt="iPhone Home Controller Project 1 v1.1" style="padding: 10px; float: right" />Here is version 1.1 of the Home Controller project. In addition and revision to what I posted in &#8220;<a href="http://www.iphonehomecontroller.com/2007/11/05/control-your-home-with-your-iphone/">Control Your Home With Your iPhone</a>&#8220;, I have incorporated the JavaScript and some of the CSS from the <a href="http://code.google.com/p/iui/">iPhone User Interface</a>, aka iUI, project. The iUI gives some of the look and functionality, mainly the sliding panel navigation, of the iPhone&#8217;s internal apps to a webpage or webapp for the iTouch and iPhone.<br />
Other than that I have decided to go with Safari&#8217;s native submit button style and simply changed the background colors to suit. The light interface now also includes a dim and brighten option for all light modules that support it.</p>
<ul>
<li><strong>HTML</strong> - some of the markup changed from the first project because of how the iUI works but everything is still forms and input buttons. The one other difference is that I am using the &#8220;bright&#8221; function now so lights can be turned up as well as down:
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc">You can view the HTML file <a href="examples/project1-1.php">here</a>.</p>
</li>
<li><strong>CSS</strong> - the new CSS file incorporates some of my original coding and some plucked from the iUI.
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc">View the complete CSS file <a href="/examples/project1-1.css" title="CSS file for this project">here</a>.</p>
</li>
<li><strong>PHP</strong> - the markup has not changed since <a href="http://www.iphonehomecontroller.com/2007/11/05/control-your-home-with-your-iphone/">version 1</a>. I am still wishing that I could get the ActiveHome SDK software&#8217;s &#8220;queryplc&#8221; function to poll devices and return on/off and dim status.</li>
<li><strong>JavaScript</strong> - as I stated above I have used the iUI <a href="http://code.google.com/p/iui/"><img src="http://www.iphonehomecontroller.com/wp-content/uploads/iui_logo.png" alt="iUI, the iPhone user interface" style="padding: 5px; float: left" /></a>to achieve a interface that is more like the rest of the iPhone&#8217;s native applications. I didn&#8217;t change anything in the iUI script save for changing the slide rate from 20 to 90. With 20 as the slide rate my interface was quite clunky.</li>
</ul>
<p>That&#8217;s it for now. The next update will be soon, once I get my doors to unlock with the system. And then on to the TV! I promise there will be a video demo soon. You can download the files for this version in the sidebar to the right. Peace!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonehomecontroller.com/2007/11/13/iphone-home-controller-project-1-v11/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Control Your Home With Your iPhone</title>
		<link>http://www.iphonehomecontroller.com/2007/11/05/control-your-home-with-your-iphone/</link>
		<comments>http://www.iphonehomecontroller.com/2007/11/05/control-your-home-with-your-iphone/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 16:20:54 +0000</pubDate>
		<dc:creator>chuck</dc:creator>
		
		<category><![CDATA[iphone]]></category>

		<category><![CDATA[activehome]]></category>

		<category><![CDATA[itouch]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[x10]]></category>

		<guid isPermaLink="false">http://www.iphonehomecontroller.com/?p=3</guid>
		<description><![CDATA[Project 1
Welcome. In this project we are going to set up a home automation scheme using x10 automation hardware and a Safari/iPhone/iTouch optimized web interface controller. The cost of this project is minimal, the only monetary input was for the x10 modules ($10 and up depending on what you buy), the ActiveHome Pro USB interface [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/themes/default/images/interface.jpg" style="padding: 10px; float: right" alt="Photo of my iPhone with the home control interface web page up and working" /><strong>Project 1</strong><br />
Welcome. In this project we are going to set up a home automation scheme using x10 automation hardware and a Safari/iPhone/iTouch optimized web interface controller. The cost of this project is minimal, the only monetary input was for the <a href="http://en.wikipedia.org/wiki/X10_%28industry_standard%29" title="What is x10?">x10</a> modules ($10 and up depending on what you buy), the<a href="http://affiliates.x10.com/?property=affiliates&amp;aposition=text3&amp;lineid=xtenafftxt3&amp;affid=x10_11941764331&amp;type=href" ?property="affiliates&amp;aposition=text3&amp;lineid=xtenafftxt3&amp;affid=x10_11941764331&amp;type=href" title="Get your ActiveHome Pro USB interface at x10.com"> ActiveHome Pro USB interface</a> (CM15A - $50), and the not so minimal cost of the iPhone/iTouch (note: this project will serve a web page to any computer but the interface design is specific for the iPhone/iTouch). I bought a simple $100 kit that included the USB module, a lamp dimming module, an appliance module and an RF light socket module among several other parts. The little kit was enough for my tests since I was new to x10 and what it could do. Now the good part about all of this is the rest of this is 100% free outside of your cost in time. Here&#8217;s what you need to do it:</p>
<p><strong>The Hardware and Software</strong></p>
<ul>
<li><a href="http://affiliates.x10.com/?property=affiliates&amp;aposition=text3&amp;lineid=xtenafftxt3&amp;affid=x10_11941764331&amp;type=href" ?property="affiliates&amp;aposition=text3&amp;lineid=xtenafftxt3&amp;affid=x10_11941764331&amp;type=href" title="Get your ActiveHome Pro USB interface at x10.com"> ActiveHome Pro USB interface CM15A</a></li>
<li>The <a href="http://www.x10.com/activehomepro/sdk/index.html" title="A Software Developers Kit from ActiveHome">ActiveHome Pro SDK</a> and ActiveHome Software: the software (that comes with the USB module) includes a driver for the module and an .exe file that allows communication to the USB module allowing developers to create interfaces in C++, VB, JavaScript, PERL and in my case PHP. The SDK includes the ActiveHome Scripting Interface document which goes through the various types of commands that can be sent/received through the interface.</li>
<li><a href="http://www.php.net/downloads.php" title="Download PHP">PHP</a> and <a href="http://httpd.apache.org/download.cgi" title="Download Apache 2.0">Apache</a>: in order to have a web page (accessible anywhere) as the control interface you need a server that has the USB module plugged into it. Since I am familiar with PHP I decided to go with an Apache install on my home PC to host my interface. Important: if you are installing Apache and PHP for this project <strong>use Apache 2.0</strong> not 2.2. The latest version of PHP will work fine. <a href="http://www.expertsrt.com/tutorials/Matt/install-apache.html" title="PHP and Apache install tutorial">Here is the tutorial I used for install</a>. If you are opening your computer up to the internet like this please make sure you do it securely, and search around for ways to do this. <a href="http://www.petefreitag.com/item/505.cfm" title="20 Ways To Secure Apache">Here is one of many tip lists out there</a>.</li>
<li>At least one x10 module set to any address you choose.</li>
<li>iPhone/iTouch or any device that can view web pages</li>
</ul>
<p><strong>The Code</strong> - Please note that my mark-up is based on my basic understandings of PHP and JavaScript as well as the ActiveHome Scripting Interface. Please feel free to school me on better ways to accomplish what I have done here. Also, if anyone else is working on this or a similar project please comment below and share what you have done!</p>
<ul>
<li><strong>HTML</strong> - for this project, all that is needed to trigger an event is a form submit so the HTML markup is quite simple:
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc"><strong>Turn A1 On</strong><br />
&lt;form method=&#8221;post&#8221; action=&#8221;"&gt;&lt;input name=&#8221;input&#8221; value=&#8221;a1 on&#8221; type=&#8221;hidden&#8221; /&gt;&lt;input name=&#8221;onein&#8221; value=&#8221;1&#8243; type=&#8221;hidden&#8221; /&gt;&lt;input type=&#8221;submit&#8221; /&gt;&lt;/form&gt;<br />
<strong>Turn A1 On and Dim A2 to 50%</strong><br />
&lt;form method=&#8221;post&#8221; action=&#8221;"&gt;&lt;input name=&#8221;input&#8221; value=&#8221;a1 on&#8221; type=&#8221;hidden&#8221; /&gt;&lt;input name=&#8221;input2&#8243; value=&#8221;a2 dim 50&#8243; type=&#8221;hidden&#8221; /&gt;&lt;input name=&#8221;2in&#8221; value=&#8221;1&#8243; type=&#8221;hidden&#8221; /&gt;&lt;input type=&#8221;submit&#8221; /&gt;&lt;/form&gt;</p>
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc">View the example HTML file <a href="/examples/project1.php" title="HTML for this project">here</a>.</p>
</li>
<li><strong>CSS</strong> - of course you can skin your project however you like it but I will share what I did using the <a href="http://developer.apple.com/iphone/devcenter/designingcontent.html" title="Apple iPhone Dev Center">Apple iPhone Developer Center&#8217;s</a> tips as a basis. I also incorporate <a href="http://developer.yahoo.com/yui/" title="The Yahoo User Interface. Tons of tools for web developers.">YUI</a>&#8217;s &#8220;reset.css&#8221; into all of my projects so it is included here as well.
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc">View the complete CSS file <a href="/examples/project1.css" title="CSS file for this project">here</a>.</p>
</li>
<li><strong>PHP</strong> - I am not a PHP guru, so luckily the markup is pretty simple to get codes transmitted (if anyone has any suggestions or tips to make this better please let us know):
<p class="code" style="border: 2px dashed black; padding: 10px; background-color: #e3e4cc"><strong>One Input</strong><br />
if (isset($_POST['onein'])){<br />
$cmdstring = $_POST['input'];<br />
exec(&#8221;ahcmd.exe sendplc $cmdstring&#8221;);<br />
}<br />
<strong>Two Inputs with 10 second pause between events</strong><br />
if (isset($_POST['2in'])){<br />
$cmdstring = $_POST['input'];<br />
$cmdstring2 = $_POST['input2'];<br />
exec(&#8221;ahcmd.exe sendplc $cmdstring&#8221;);<br />
sleep(10);<br />
exec(&#8221;ahcmd.exe sendplc $cmdstring2&#8243;);<br />
}</p>
<p>As you can see the code uses PHP&#8217;s exec() command to push the data that was input from the HTML form. The &#8220;sendplc&#8221; part is one of the commands that is included in the ActiveHome Scripting Interface. The other available codes are: sendrf - for sending x10 codes via RF, and queryplc - which is supposed to query the on/dim state of any given x10 module (unfortunately I cannot get this one to work and it seems it is broken according to the support forums - if anyone has any ideas on how to get this to work let me know as I would like the interface to be a bit more dynamic by visually representing which lights are on and off)</li>
<li><strong>JavaScript</strong> - for this project I used the <a href="http://www.jquery.com" title="jquery javascript library">jQuery</a> scripting library in order to submit data without a page refresh. jQuery&#8217;s <a href="http://malsup.com/jquery/form/" title="AJAX Forms are Cool">AJAX form plugin</a> worked great!</li>
</ul>
<p>So that is pretty much all you need to know to get this done at your house. Please feel free to ask questions and make comments. I&#8217;ll add to this page as the project progresses and stay tuned for a video demo coming in the near future&#8230;<br />
Peace!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonehomecontroller.com/2007/11/05/control-your-home-with-your-iphone/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Welcome to iPhoneHomeController.com</title>
		<link>http://www.iphonehomecontroller.com/2007/11/03/welcome-to-iphone-home-controller/</link>
		<comments>http://www.iphonehomecontroller.com/2007/11/03/welcome-to-iphone-home-controller/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 00:45:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[activehome]]></category>

		<category><![CDATA[iphone]]></category>

		<category><![CDATA[itouch]]></category>

		<category><![CDATA[safari]]></category>

		<category><![CDATA[x10]]></category>

		<guid isPermaLink="false">http://208.64.136.51/*rustyps.com/addon/iphonehomecontroller.com/?p=1</guid>
		<description><![CDATA[Here we will be featuring several different home automation projects we have created especially for the iPhone and iPod Touch interface. Our first feature will be based on x10 and ActiveHome Pro technology. The interface for our project(s) is designed to work with and look good on Safari&#8217;s iPhone/iTouch platform. Ok, sure, it&#8217;s just a [...]]]></description>
			<content:encoded><![CDATA[<p>Here we will be featuring several different home automation projects we have created especially for the iPhone and iPod Touch interface. Our first feature will be based on x10 and ActiveHome Pro technology. The interface for our project(s) is designed to work with and look good on Safari&#8217;s iPhone/iTouch platform. Ok, sure, it&#8217;s just a web page, but how can we resist the temptation to control our homes from our favorite little gadget? Stay Tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iphonehomecontroller.com/2007/11/03/welcome-to-iphone-home-controller/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
