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. (you should be able to download it here or) 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: , , ,

67 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.

  34. Gerhard Says:

    I have trying to reinstall this repeatedly, but whenever I go to http://localhost/iPHC2.1 I get an Object Not Found error. What do I do wrong?

  35. chuck Says:

    @gerhard
    I suggest you go through the tutorial step by step and make sure you have not missed anything. It seems that you are not putting the iPHC2.1 folder in the correct place.

    If you can go to localhost and do not have any problems then it is most likely what I stated above.

  36. Gerhard Says:

    Thanks for your quick response. I checked again and it is in E:\Program Files\xampplite\htdocs\iPHC2.1. That is correct, yes? Bringing up http://localhost/phpMyAdmin works fine …

  37. Gerhard Says:

    Here is the complete error msg:

    Not Found

    The requested URL /iPHC2.1 was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 Server at localhost Port 80

  38. Gerhard Says:

    Does this need to be on a root drive C:\ ?

  39. chuck Says:

    @gerhard
    I always use drive C but if you can access phpmyadmin the you should be fine. I would try changing the name of the iPHC folder. If that does not work I would make a new folder in the htdocs folder and put an index.php page in it with the word test on the page and try to access that. Other than that, I am really not sure what the problem could be.

  40. Gerhard Says:

    I got it to work. I had to reinstall everything after a hdd crash. I could save all the files related to this. Which file contains the database I built? Can I just copy it over the new file?

  41. chuck Says:

    if you did not dump the database to a new file then you lost that info in the reinstall. you will have to re-start with the sql file included in the iPHC package.

  42. Gerhard Says:

    I still have the backup of the old HDD - there is no file I can take from there and copy to the new HDD?

  43. chuck Says:

    not that I am aware of, the data must be somewhere but I am not sure how you would retrieve it.

  44. Andre Says:

    As requested in previous posts i would also like to see the status of a module. As i found in other posts about the sdk it seems possible to use the gueryplc command to get the status even for 1 way devices. http://forums.x10.com/index.php?topic=7851.0 to bad the link for the x10diehard post is no longer available but i did request dbemowsk for the dll. i will try myself to get it to work but i am not a genius in php / ajax etc.

  45. chuck Says:

    @Andre I looked up the sites you referred to and even checked archive.org for the info but the download was gone. If anyone can provide a version that does have queryplc working I would be happy to immediately include it in this program.

  46. Arun Gupta Says:

    This works perfectly except for few issues:
    a) The website does not work properly with IE. I haven’t tested with other browsers because I will use it only with iPhone. I tested with Safari and it works like a charm.
    b) There are only A-D house codes. I had to add up to P in the index.php manually. Now I can use all 16 house codes and 16 device codes.
    c) There does not seem to be any password to access the website. Anyone on internet can get access to the website and add/delete modules and turn on/off lights. Is there a workaround to put a password?

    Thanks…

  47. chuck Says:

    @arun
    - iPHC does not support IE. I could go in to how horrible of a browser it is but lets just leave it there.
    - Thanks for bringing the letter codes (and the lack of them) up. i’ll make that change to the program.
    - You can password protect your pages in many ways, including using the htaccess file http://www.javascriptkit.com/howto/htaccess3.shtml

  48. Arun Gupta Says:

    Thanks Chuck. I myself do not use IE at all but just felt lazy to install Safari on a new PC. I was not at all complaining about lack of support for IE.

    Since I am not a programmer, putting the password in was a bit of a challenge but using the website you provided and some Google search, I was able to provide at least some level of protection to the website.

    I found that the password generated by Apache utility htpasswd.exe works but the one generated by the utility on the javascriptkit website does not work. I kept getting a password mismatch error in Apache logs. Finally I used htpasswd -c -b .htpasswd , I was able to generate .htpasswd file with right password.

    Your program works very well.

    Thanks…
    Arun Gupta

  49. chuck Says:

    @arun
    I suggest Chrome or Firefox for PCs as Safari on a PC is glitchy (at least for me). Anyway the reason there is no password protection that comes with iPHC is because the user (you) are opening your computer as a server. Doing this without adding security is a big no-no. So as is stated in the guide it is best to secure your server right away. When I can i’ll add appropriate links to simple guides on how to do so. (I know the htpasswd thing is kinda tough to work out, I have had similar issues. Glad you figured it out!)

  50. Paul Says:

    Great, lovely beautiful!!!

    Exactly what i was looking for. I started bringing my AHP to the web, so had already build my XAMPP site with joomla. This is a great extension. I just need to dig into this to see how i can integrate it with my existing site.

    Thanks
    Paul

  51. Will Smidlein Says:

    I am currently porting this (with a better interface (no offense)) to the iPad. This should turn out REALLY nice!

  52. Shawn Says:

    I’ve been reading this thread and preparing to try this all out, and realized that this whole install (linux + drivers + XAMPP + iPHC) could really just be packaged as one virtual server install. Has anyone tried this?

    This would seem to be able to get everyone on the same code releases regardless of what their underlying OS is.

    Here is a similar example of a virtual appliance http://www.vmware.com/appliances/directory/86653

    Thanks,
    Shawn

  53. mike Says:

    Hello ,
    1st) Sorry for my english i’m frensh and i know my english are bad … :-p

    2nd)so , i have install IPHC 2.1 on windows 7 , following all of the step of this tutorial and i’ts doesn’t work at the first time i tried it …

    but i know why :-)))

    i install the SDK of active home and after evrything are good .

    The ahcmd doesnt send anything if you use it like this i guess … you just have to install the sdk and that’s work :-)

    Thank’s for this software

    Mike.

  54. Jeff Bakker Says:

    Will this work with the CM11A X10 interface (the older, serial one?

    I have all the steps done and was wondering if it will work with the Serial one as well.
    Does anybody have it working?

    Thanks Jeff Bakker

  55. Henri Assen Says:

    Hi
    When I checked ’status’ I got ‘DEACTIVATED’ for
    1) MySQL
    2) Apache::ASP
    3 perl with mod_perl

    I’m using Win7 | IE8
    /localhost/iPHC2.1 shows but I cannot add any modules

    Thanks

    Henri

  56. Henri Assen Says:

    Installed Firefox and iPHC2.1 looks fine now. Instlled/added a few of my modules, but noe worked. Plugged in CM15A and test module AM12 very close to PC, but with zero result. Can you advise?
    Thank you.
    Henri

  57. Henri Assen Says:

    Forgot to ask - does your software only work in the USA (110V-60Hz v. 220-240V-50Hz)?

  58. chuck Says:

    This is a hardware situation. See the specs on the activehome module.

  59. Vav Says:

    Hi

    can I use the same process for a Mac OS?

    Vav

  60. chuck Says:

    i think the driver is for PC only.

  61. Henri Assen Says:

    I don’t understand: “This is a hardware situation. See the specs on the activehome module.” All X10 units (240V 50Hz) work fine in Ireland - jsut checking if your output signals work over European domestic lines.
    Thanks

    Henri

  62. chuck Says:

    The output signals are sent from the ActiveHome cm15a module so if there are concerns in this area you would have to ask the manufacturer. iPHC is a web interface that sends signals to the module internally. So, as long as you have the correct software on your computer iPHC would work just fine in any country.

  63. vav Says:

    Hi Chuck

    what if I want to control the cm15a from a Mac in a similar fashion

    what module would I need ?

    Vav

  64. chuck Says:

    @Vav
    You would have to run windows on your mac
    http://www.applematters.com/article/three-ways-to-run-windows-on-your-mac/

  65. vav Says:

    Hi Chuck

    thanks a lot for the quick reply.

    I have successfully installed your application and used it through an iphone

    but I want it to look like an iphone app( like to have a iphone app symbol for this , which open the page when I click on it) and also when I open the application I do not want the ip address to show up in the browser tab . Is there anyway I could achieve this.

    I am new to all this .your help is really appreciated.

    Regards
    Vav

  66. chuck Says:

    You can make an icon for it by bookmarking the page.
    As it stands right now there is no way to remove the ip address as the whole system works inside of safari.

  67. vav Says:

    thank for the info chuck

Leave a Reply