Author Topic: Possible errata on the home automation gateway setup  (Read 1998 times)

jim_carson

  • NewMember
  • *
  • Posts: 1
Possible errata on the home automation gateway setup
« on: March 26, 2014, 09:44:52 PM »
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:

Code: [Select]
<?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:

Code: [Select]
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:

Code: [Select]
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:
Code: [Select]
<script src="socket.io.js"></script>
    var socket = io.connect

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

Again, thank you for the thorough work. 

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Possible errata on the home automation gateway setup
« Reply #1 on: March 27, 2014, 08:32:07 AM »
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

  • NewMember
  • *
  • Posts: 2
Re: Possible errata on the home automation gateway setup
« Reply #2 on: December 22, 2014, 10:44:06 PM »
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:
Code: [Select]
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>

To This:
Code: [Select]
<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

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Possible errata on the home automation gateway setup
« Reply #3 on: December 23, 2014, 12:07:00 AM »
Great, it worked for me but maybe a difference in browsers or whatever, anyway I changed it to HTTPS, it should not hurt.