Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/revolunet/httprelay
minimal http api for relays over raspberrypi gpio
https://github.com/revolunet/httprelay
gpio python raspberry-pi raspi relay
Last synced: 27 days ago
JSON representation
minimal http api for relays over raspberrypi gpio
- Host: GitHub
- URL: https://github.com/revolunet/httprelay
- Owner: revolunet
- Created: 2016-08-29T21:11:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-25T12:10:13.000Z (over 6 years ago)
- Last Synced: 2024-10-11T00:23:14.172Z (about 1 month ago)
- Topics: gpio, python, raspberry-pi, raspi, relay
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# httprelay
Minimal python HTTP server with CORS support to control RaspberryPi GPIOs, for example to control relays.
You can control up to 24 GPIO.
## setup
- [download](https://github.com/revolunet/httprelay/archive/master.zip) the project
- run `pip install -r requirements.txt`
- defines the GPIOs pins to control in server.pyRun with `python server.py`
## HTTP API
- `/gpio/7` : get pin 7 current status
- `/gpio/7/output/0` : set pin 7 output to GPIO.LOW
- `/gpio/7/output/1` : set pin 7 output to GPIO.HIGHSample test UI : http://jsbin.com/mahexo
API returns:
```json
{
"pin": 7,
"value" : true
}
```## Available GPIOs
Use the physical port to address the API
Physical port | GPIO#
:------------:|:-----:
7 | 7
8 | 15
10 | 16
11 | 0
12 | 1
13 | 2
15 | 3
16 | 4
18 | 5
19 | 12
21 | 13
22 | 6
23 | 14
24 | 10
26 | 11
29 | 21
31 | 22
32 | 26
33 | 23
35 | 24
36 | 27
37 | 25
38 | 28
40 | 29## Autostart
- add `/home/pi/httprelay/start.sh &` to your `/etc/rc.local`
- the sample `start.sh` script shows how to start the process in a [screen](https://www.gnu.org/software/screen) session