Loading...

iPhone Home Controller 2.1 Release and XAMPP Lite Tutorial

The 2.1 iPHC release is here. Not too much as far as styling changes but I have fixed some of the html and css. The application now uses jQuery at its core for event handling. This allowed me to, as is the jQuery way, “write less and do more.” The iPHC package should work a little faster now as jQuery can speed things up a bit. If you already have the iPHC system running, you can simply delete the old files and copy in the new ones (leave your connect.php file intact - there is no need to change it). The database settings have not changed so the switchover should be seamless.

For iPHC newbies, here is a step by step guide of how I got the system up and running at my house using Windows XP, XAMPP Lite, iPHC v2.1, the x10 cm15a, and an x10 module for testing.

1. Purchase the cm15a x10 transmitter. You will need at least one x10 module to control as well (also available from x10.com).

2. Install the cm15a driver/ActiveHome interface. A link to download it comes in an email after you purchase the cm15a. Plug the cm15a into a usb port that is on the computer you will be installing the iPHC system on. Then plug the cm15a into the wall.

3. Download XAMPP lite. There is a zip file or an exe file to grab. Either one is fine. I placed the main xampp folder in my “program files” folder.

4. Open the xampplite folder and click setup_xampp.bat. After you see the success message you can close the window.

5. Download and unzip iPHC2.1. Copy the iPHC2.1 folder and paste it into the xampplite\htdocs folder.

6. Go back into the xampplite folder and click xampp_start. This should start mysql and apache. Leave the window that opens, open. Only use xampp_stop to stop mysql and apache. (Note: When I tried to start mysql and apache I got error messages with apache. In my case I had to add the file “msvcr71.dll” to the xampplite/apache/bin folder.)

7. Open a browser and type localhost into the address bar.

8. You should see the XAMPP welcome screen. Choose your language.

9. You can check the status of the install by clicking on status. Then click security.

10. Setup name and password for mysql and to secure your htdocs folder. This is essential if you are going to connect your system to the internet.

11. Copy the xampplite\phpMyAdmin folder and paste it into the xampplite\htdocs floder.

12. Go to localhost/phpMyAdmin in your browser and log in using the mysql name and password you had set up earlier. If you see a mcrypt error you can ignore it or follow the instructions here to get rid of it. You will have to restart xampp and log back in to see that it has been fixed.

13. Create a database called fonhome in phpMyAdmin.

14. Select the database you created and click import. Select the fonhome.sql file that is in the iPHC2.1 folder and upload it.

15. Locate the connect.php file in your xampplite\htdocs\iPHC2.1 folder and open it using a text editor or html editor. I use PSPad. Change the user name and password to the ones you had set up for mysql earlier and save the file.

16. In your web browser go to localhost/iPHC2.1.

17. If everything went well you should be able to see the interface and utilize its functions. Select admin at the top of the screen and use the form to add a new module. Name and enter the address of your test module and click add. Go to the modules screen and try turning on and off the module you have just added.

18. To get this going on your iPhone you need to find out your IP address. If you don’t have a router with a firewall or anything else in the way like an internal firewall then you should be able to paste this IP into your browser address window and get to the main XAMPP page. In my case I do have a router and have to open up port 80 on it as well as set my computer’s firewall to allow apache and mysql. You will have to search on how to do this for your specific router and firewall setup.

19. If everything works out you should be able to enter your IP address/iPHC2.1 in your iPhone browser (or any other web enabled mobile device) and access your system.

If there are any questions or comments let me know. I’ll add more as I keep testing.

Download iPHC2.1 here.

Tags: , , ,

33 Responses to “iPhone Home Controller 2.1 Release and XAMPP Lite Tutorial”

  1. Mo Says:

    The upgrade worked with no trouble.
    Thank you.

  2. X:Faktor Says:

    Do you have to use Apache or could you be running IIS?

  3. chuck Says:

    @x:faktor
    As long as you have PHP going the system will work. I’ll have to remember to mention that in the tutorial. Thanks!

  4. chris Says:

    Chuck,
    I’m using IPHC on my iPod and it’s awesome, however I want to expand it to one of my mac’s, basically what I want to do is teach the map to W GET a url, via voice command, I can handle the AppleScript side of this, but what is the syntax I can call on the iphc to access certain things? Ie, if I said “Vicky, turn on kitchen overhead” she (Mac is named Vicky, as thats the name of the TTS engine) would W GET http://server/iphc/ihopesomething.php?node=A1&command=on?

    Thanks!

  5. Chris Says:

    In case anyone else wants to know, chuck and I have confirmed that calling the IPHC-process.php in this manner:

    http://server/iphc/IPHC-process.php?q=A1+on

    and

    http://server/iphc/IPHC-process.php?q=A1+off

    Will allow you to control devices without the interface in case you wanted to write your own scrips using the IPHC backend.

  6. A.J. Says:

    Hi Chuck,

    I took what you told chris to do and decided to try it myself.

    http://server/iphc/iphc.php?node=A1&command=on

    I copy and pasted the changes you mentioned above and it didn’t work. :( Is there another change that needs to be made?

    Thanks!

    AJ

  7. chuck Says:

    @AJ
    Change the code in the iPHC-process.php file you switched back to what it was originally.
    Check Chris’ other comment and use that code. It will work except the logic will be reversed (off will be on…). To make it work correctly in this case you would have to edit the iPHC-process.php file on lines 54 and 60 and change “on” to “off” and “off” to “on”.

  8. Michael J Says:

    Does this work on a linux box with apache mysql and php?

  9. chuck Says:

    @Michael
    As far as I know, yes, it should. You will have to be able to install the driver for the cm15a on it though.

  10. Michael J Says:

    @chuck .. I’m not too savvy with linux yet .. I’ve installed ubuntu on my server computer .. the one that works on PHP with apache on windows works fine .. but I have no idea how to do this for ubuntu .. I might write a step by step process if I collect enough information on here on how to do this .. pretty much from the first steps of installing ubuntu to getting the x10 driver working with the module and the interface here from this website to work with PHP ..

  11. Gabe Says:

    How hard would it be to add a refresh feature?

    One which would query the light status and update the webpage accordingly (ie: kitchen light is already on, so the corresponding module should be highlighted)

  12. Gabe Says:

    Do you guys sometimes get the message (on vista):

    X10 ActiveHome Scripting Commandline stopped working and was closed

    The lights still close/open fine, but this message is somewhat annoying.

  13. chuck Says:

    @Gabe
    Light modules (at least the ones I have) are not two way. They cannot be polled. If you have some that are let me know what kind and I will look into 2 way communication.

    Also, I do not have vista. Maybe it has something to do with the ActiveHome software? I am not sure if it is vista approved or not.

  14. chuck Says:

    @Michael
    Sounds good.
    I think there is a Linux version of XAMPP That would be a good place to start. If you are having a hard time I can have some of my Linux nerds look into this. Let me know.
    If you do put a tutorial and wouldn’t mind having it posted here please let me know as well.
    Thanks!

  15. Michael J Says:

    Thanks Chuck, after some exhaustive research online and some lightspeed learning of Ubuntu, I think I have found some serious preliminary work done, that’s modestly recent (December 2008) as opposed to some outdated work from 2005 by neil cherry.

    Ubuntu Server Edition already comes prepackaged with a similar *AMP installation and it’s all up to date.

    As for my documenting, I will only be addressing how to get the right drivers, installing any additional library packages on a Linux system, and providing the modified code of the iPhone AJAX interface to work with the drivers for the CM15A module on Linux.

    I’ve already started with the process as I come across things and documenting it.

  16. Something Interactive » Preamble: Web-based control of X10 Home Automation (CM15A) on Ubuntu Linux Says:

    [...] guide to getting the X10 CM15A USB module to work under Ubuntu, and then to further get the iPhone Home Controller web-based interface to connect the [...]

  17. Michael J Says:

    X10 Home Automation (CM15A USB Module) + Linux (Ubuntu SE) + Eclipse Home Automation CM15A Drivers + iPhone Home Controller = SUCCESS!!!

  18. Michael J Says:

    Chuck can you email me?
    I have a completed process with modified files and an entirely written step by step guide on how to do this (under a protected post on my blog) but need to coordinate with you first before I go live with this.

  19. Sean Says:

    Well… okay…

    I’m somewhat new to AMP… but:
    Ive got windows 7 beta IIS and AMP running.
    I had to change the port to 8080 and got localHost:8080/iPhC2.1 to log into my MySql instances fonehome DB… all seems to be set up….

    So… my hardware did not ship with a cd… I downloaded the driver from: http://www.x10.com/support/support_soft1.htm
    the driver: ftp://ftp.x10.com/pub/applications/drivers/x10drivers_6432_239.exe
    which says it even works for windows 7…

    I’ve just never set up X10 before. I have something called a socket rocket, which does not have dials; it’s for a light.

    It says if you plug it in and toggle the on off with your software it will adopt whatever code is toggled on and off within 30 sec of getting powered up.

    But I have nothing… Any advice?

  20. w.korsten Says:

    Would it be possible to run it on a NAS with a webserver on it like the Synology?

    I think many Synology users would love to be able to control a home with this feature!

    I have the app running but I don’t know if it is possible to connect to a X10 device like a CM15

  21. chuck Says:

    @sean
    I have had problems with the socket rocket not cooperating, I currently don’t use mine at all. That module may not be functional.
    As far as the program, if the buttons change color when you hit them then iPHC is working fine…
    If not let me know.

  22. chuck Says:

    @w.korsten
    It seems like synology supports PHP and MySQL so yes I don’t see why this system wouldn’t work. The one question I cannot answer is if it would support the x10 hardware…

  23. Métairie Says:

    Hello,
    I’m grench and i tried to follow the tutorial. All is fine except step 13. When i tried to import the fonehome.sql, i had an error (see below).
    The step 15 give : Unknown database ‘fonhome’

    Please HELP !

    Thanks
    Patrice

    Erreur
    requête SQL:


    – Table structure for table `modules`

    CREATE TABLE IF NOT EXISTS `modules` (

    `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
    `name` VARCHAR( 50 ) NOT NULL ,
    `type` VARCHAR( 20 ) NOT NULL ,
    `addressnum` INT( 2 ) NOT NULL ,
    `addresslet` VARCHAR( 1 ) NOT NULL ,
    `status` VARCHAR( 20 ) NOT NULL ,
    KEY `id` ( `id` )
    ) ENGINE = INNODB DEFAULT CHARSET = latin1 AUTO_INCREMENT =36;

    MySQL a répondu:

    #1046 - No database selected

  24. Richard Says:

    I have installed and using on my G1 perfectly too, i will also try and test it on a BB and Windows mobile next tile i get the opportunity, but I see no reason why it would work.

    Love this, finally something that just works without stupid dll’s and ActiveX.

  25. Francois Says:

    Hello,
    I follow all the tutorial and i succeded in having the page on my iphone but when i click on the module to switch on the x10 appliance with A1 address, nothing happend !!!

    Have I to keep Active Home switch on ?

    Please do you know what could happend ?

  26. Eric Says:

    If you’re following these instructions exactly on a new install like I was, you’ll need another step just be #13.
    -> Go to phpMyAdmin and create a new database named “fonhome”

  27. Tim F Says:

    Will this work with the CM11A X10 interface (the older, serial one)? I was going to just try it but that’s a lot of work to find out it’s not compatibile…

  28. Martin Says:

    Hi, Thanks for the guide, this is exactly what I’m looking for (web-based X10 control). I’ve gott the web interface up on the browser, but then I get a javascript error when trying to add a module, similar to Francois. Any suggestions?

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
    Timestamp: Sun, 25 Oct 2009 07:23:21 UTC

    Message: Object expected
    Line: 2
    Char: 1
    Code: 0
    URI: http://localhost/iphc2.1/js/iphc.js

  29. Martin Says:

    I’m having the same issue as Francois. I can install apache and mysql with XAMPP, but after the site is up, I can’t make changes. I get the following error in IE:

    Line: 3
    Char: 1
    Error: Object Unexpected
    Code: 0
    URL: http://localhost/iPHC2.1/

  30. riivo Says:

    Followed instructions but decided to install PHP with IIS7 on Win 7 (PHP requires cgi module also enabled in IIS) plus MYSQL. IIS application pool, that PHP site is using needed to be given additional rights to launch local services (can be modified via run> dcomcnfg and look DCOM config application name “x10nets” and give rights for Launch and Activation). You can find application and account guid in windows log aswell.

    Works perfectly now!

  31. Jos Says:

    Hello, Thanks for the guide and the program. I got the same javascript error as Martin and Francois (in IE). I think the problem is that the javascript code used by IPHC2.1 only works with the Safari browser. After I installed and used Safari and the problem was over. When you use the IPOD/IPHONE to add a module, the error will also not occur. Maybe this addition could be added to the guide?

  32. Martin Says:

    Thanks Jos, with safari the website is working perfectly. Internet explorer seems to be the only bad actor (MS not playing nice with javascript). I’ve confirmed it works on Opera, Firefox, Chrome, Safari, and the default browser on android phone (Chromium?).

  33. johnny Says:

    Windows 7 64 bits with CM19a works fine.

    Fews problems:
    I had was downloading the package and it was corrupt (when I was installing it .exe, it stopped and said one of the files is corrupt) just try downloading a different package (I used the .exe)

    Install the drivers for the CM19A just because it works with firecracker doesn’t mean it is going to play nice with all the other problems.
    http://www.x10.com/support/support_soft1.htm

    When you test it, in the cmd prompt uses these commands.
    ahcmd.exe sendrf a1 dim 50
    ahcmd.exe sendrf a1 on
    ahcmd.exe sendrf a1 off

    So you are going have to change the code from: sendplc to sendrf in the IPHC-process.php

    Done and it works great.

Leave a Reply