GarageMote Gateway.js

Started by ssmall, December 29, 2014, 08:31:58 PM

ssmall

I have been working on getting my RPi setup to work with the GarageMote project.  I have been successful in setting up the RPi following the steps outlined in the "RaspberryPi home automation gateway – Setup" after Felix updated the instructions.  I then followed the steps outlined in the "RaspberryPi home automation gateway – Hardware and Demo".  I ran into the following error when I ran the command: node Gateway.js & :

io.configure(function () {
   ^
TypeError: Object #<Server> has no method 'configure'
    at Object.<anonymous> (/home/pi/moteino/gateway.js:8:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

I ran into a similar error with the chat.js example before Felix updated the setup.  Configure has been deprecated in the latest version of socket.io and has been replaced by use, so I copied the io.use section from chat.js and fixed up the logging in io.sockets.on.  Gateway.js ran fine after these changes.  I brought up index.php in a browser but all I got was "Loading socket ...".  I have not actually built the Garage mote yet, so I wired up a moteino to the GPIO pins on the RPi that had a sketch loaded that simply wrote out Hello World using Serial.println every 5 seconds.  Nothing showed up in the web page.  I then found this post: https://lowpowerlab.com/forum/index.php/topic,545.msg4247.html#msg4247.  After that change, Hello World began showing up in the text box when I made the change.  I have attached the modified gateway.js file.

Hope this helps if anyone else is stuck.

Felix