RaspberryPi socket webserver for home automation
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
RaspberryPi case blueprints
RaspberryPi custom gateway


RaspberryPi Gateway Web Interface for the Moteino IoT Framework

By Felix Rusu (lowpowerlab.com/contact)


  • SSL Encrypted with self signed certificate
  • auth_basic authenticated
  • realtime websocket driven using node.js and socket.io
  • neDB storage of node data and logs
  • flot front end graphs
  • nconf for easy global variable configuration maintenance
  • nodemailer for sending email (and SMS relayed via email)
  • Font-awesome icons for jQuery-Mobile


This source code is released under GPL 3.0 with the following ammendment:
You are free to use, copy, distribute and transmit this Software for non-commercial purposes. For more details see LICENSE

Details & Setup Guide

The full details of how to install this stack along with supporting webserver are published here. There you will also find a pre-compiled Pi image that has this stack installed and ready to go. In addition there are hardware guidelines and requirements.

Quick reference:

  • Copy the contents of this directory in /home/pi/gateway
  • run npm install in the /home/pi/gateway directory to install all node dependencies
  • Adjust any email/password/SMS settings in settings.json5
  • the files in the _piConfigs should be used to set the correct paths for nginx and to register the upstart gateway script
  • Connect a Moteino to your Pi through the serial port or USB if you have a MoteinoUSB. The default configured serial port in settings.json5 is dev/ttyAMA0 which corresponds to the GPIO serial port, this works for a Moteino directly attached to the GPIO, or a MightyHat; if you have a MoteinoUSB plugged into a USB port then you will need to find which serial port that will generate and replace it in settings.json5 (it is usually something like dev/ttyUSBxx). It should be running this gateway sketch. Otherwise if you have a MightyHat you can run this MightyHat sketch on it. Verify the settings in the sketch to match the hardware and also the encryption key and network ID should be the same on all nodes.
  • Ensure nginx/webserver is running
  • If your Pi is powered by an ATXRaspi, a MightyBoost with Moteino control, or a MightyHat, then add this line in /etc/rc.local before exit 0: /etc/shutdowncheck.sh &. This allows shutdown and reboot commands from the push of a button, see the ATXRaspi demo video for how this works.
  • if you are using a wi-fi dongle, edit your wifi password in /etc/wpa_supplicant/wpa_supplicant.conf
  • Ensure your gateway.js script runs at boot (see the Pi Stack Setup guide for how to set that up with upstart and the Gateway app setup). You can always use the pre-compiled Pi image that has all these things ready to go (except the settings which you should revisit anyway); this image also has upstart already configured to run the gateway.js app at startup. Otherwise if you want to manually start the gateway.js app or see the output it generates to the console start it with node gateway.js &. If you want to manually start it and ensure it persists after you logout use nohup node gateway.js &

Video Overview & Demo


3rd party custom gateway setup overview