This Node.js application runs on a Raspberry Pi and allows you to control a Relay attached to the GPIO pins using a simple web page.
- Node.js >= 9.9.0
- A user account with sudo access (for deployment)
- Run
./run init
. This will install dependencies. - Run
./run
to start the server
Run ./run deploy username@hostname
. It is assumed username has sudo access on hostname.
To see log output on the deployed host, run sudo journalctl -u raspberrypi-relay-controller
. Add -f
argument to follow the log.
- Login to https://graph.api.smartthings.com/
- Go to: My Device Handlers > Create New Device Handler > From Code
- Paste contents of
support/pi-relay-control-device-handler.groovy
- Click: Create, Publish > For Me
- Login to https://graph.api.smartthings.com/
- Go to: My Devices > New Device
- Specify: Name, Device Network Id (arbitrary), Location, Hub, Type ("Pi Relay Control")
- Click: Create, Preferences > edit
- Specify: IP, port, Relay #
- Click: Save