rpi-gpio-http

HTTP interface for Raspberry Pi GPIO


License
Other
Install
pip install rpi-gpio-http==1.1.0

Documentation

About

This is a REST api for GPIO ports in Raspberry P.

REST api

Format:

  • request: "application/x-www-form-urlencoded"
  • response: json

Endpoints:

  • GET /channel List of all enabled channels, and their values
  • PUT /channel Set values Example: pin[11]=100&pin[13]=100&pin[15]=100
  • GET /channel/10 Get the value of the 10th channel
  • PUT /channel/10 Set the value of the 10th channel. Not available for "input". PWM: [0, 100]. Output: [0, 1] Example: value=10

Config

See example configuration. (rpi-gpio-http-config.example.json) It contains all the available channel types.

Type config:

Note: pin numbers is the physical number in the board

Install

pip install rpi-gpio-http

Do not use the run-dev-server.py in 'production', instead of this use uWSGI, or sg else.

Example config for uwsgi:

[uwsgi]
processes = 2
module = rpi_gpio_http.app:app
http-socket = :53042
uid = root
gid = root