How to incorporate GPIO events on the Pi into the web interface

Started by Nspector5, May 20, 2016, 10:38:17 AM

Nspector5

I was wondering if anyone had any examples of how to incorporate GPIO reading on the Pi Gateway into the web interface.

I have several reed switches ran to my doors, and I would like to simply connect them to my Pi and read/log the status of them just like a wireless node.

I would be connecting the switches similarly to the example found here: https://learn.adafruit.com/node-embedded-development/events

Any help or example would be appreciated.

Thank you.

Felix

Looks like the adafruit guide has some node.js code you might be able to use and inject in the gateway.js app. However this gateway app was built around a node concept where you interact with wireless nodes, rather than GPIO on your pi.
Why would you want to interact with GPIO via this gateway app? Are you also using it with Moteinos to do other things?

Nspector5

The wires from the reed switches were run to the panel where I put the Gateway. The house we purchased had an old alarm system; I gutted the old alarm and replaced it with the Gateway. Being able to log/view the switches would be easier than making an additional node to read/send the data.

Felix

It's possible to just modify (add) on top of what's there now, to interact with the GPIO. Instead of nodes these would just be some (semi) static settings on a page. Just some ideas, I never had a need for the GPIO hence I didn't do any coding in that direction.

Nspector5

Thanks. I'll do some experimenting and post what I find.

loseymark

I modified the gateway app to add a page to the gateway web app that displays a list of RF outlets and provides an on/off button to turn the outlets on or off using a 433mhz transmitter from a python program.

The python program is executed with node.js and python-shell. This executes a python script on the gateway server that makes a Pyro call to a Pyro server running on another PI.

For your scenario, the second PI or the gateway could use python gpio calls to access the gpio pins.

I also have reed switches on my garage doors and use a raspberry in my garage to check the status and send a command to a raspberry controlling a moteinoUSB that posts the open/closed status to the gateway.