Possible errata on the home automation gateway setup

Started by jim_carson, March 26, 2014, 09:44:52 PM

jim_carson

Thank you for the thorough tutorial.  I ran into some minor problems/typos when setting up the Raspberry Pi home gateway that I wanted to note in case it'll help someone else out.

1)  For the index.php file, I think you want this syntax:

<?php phpinfo(); ?>


which will emit the verbose php setup. 

2) For creating the self-signed certificate, openssl was barfing when I specified the "-days 365" option.  Leaving it out seemed to work fine:

sudo openssl req -new -x509 -nodes -newkey rsa:2048 -out server.crt -keyout server.key


3) When running npm, there were issues with permissions (folder owned by root, npm run as me).  I think it worked best if I created the directory as my own user then ran npm as the same:

mkdir ~/moteino
cd ~/moteino
npm install serialport


4) The chat.html sample is missing an open script tag after the socket.io.js is loaded.   Instead of this:
<script src="socket.io.js"></script>
    var socket = io.connect


I think you want this:
<script src="socket.io.js"></script>
<SCRIPT LANGUAGE="JavaScript">
    var socket = io.connect


Again, thank you for the thorough work. 

Felix

Thanks, these are good catches!
For the permissions I suggest running npm as sudo. I registered it to startup at boot, as explained in this last post of the series: http://lowpowerlab.com/blog/2013/10/11/raspberrypi-home-automation-gateway-hardware-and-demo/
I then don't have to worry about manually starting it up or permissions.

Big Country

Felix, I really like the updated Home Gateway setup.  I was able to finally get it working.  It seems like the above errata have been addressed/fixed.

However, I did find one error that had me hung up for a bit and I wanted to share.

At the end of the setup when testing with the chat program.  The webpage loaded, it asked for my name, and I could see authorizations in the terminal window.  It seemed that the socket wasn't starting though.  There was no users listed after the name query and no chatbox.  After inspecting the JavaScript Console in Google Chrome, it showed the one of the headers was calling for "http" instead of "https" and was therefore blocking it.

So.... long story short, in the chat.html file I replaced line 3:

From This:
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>


To This:
<script src="https://code.jquery.com/jquery-1.11.1.js"></script>


And BAM, it worked! I hope this helps someone :)

Thanks again Felix!

-BC

Felix

Great, it worked for me but maybe a difference in browsers or whatever, anyway I changed it to HTTPS, it should not hurt.