https://github.com/sergeimonakhov/gpio-rest-api-server
Controlling gpio using the rest api server
https://github.com/sergeimonakhov/gpio-rest-api-server
gpio-pins home-assistant rest-api
Last synced: 7 months ago
JSON representation
Controlling gpio using the rest api server
- Host: GitHub
- URL: https://github.com/sergeimonakhov/gpio-rest-api-server
- Owner: sergeimonakhov
- License: apache-2.0
- Created: 2021-09-05T14:38:34.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-05T15:07:38.000Z (about 4 years ago)
- Last Synced: 2025-01-20T03:53:50.723Z (9 months ago)
- Topics: gpio-pins, home-assistant, rest-api
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## GPIO rest api server
Activate and deactivate gpio pins
## Rest-api schema
```bash
POST '{"active":true}' /gpios/{GPIO_PIN_ID}
GET /gpios/{GPIO_PIN_ID}, response: {"is_active":true}
```## Integrate with [home-assistant](https://www.home-assistant.io)
```yaml
switch:
- platform: rest
name: GPIO2
resource: http://{GPIO_REST_API_SERVER_ADDR}/gpios/2
body_on: '{"active": true}'
body_off: '{"active": false}'
is_on_template: "{{ value_json.is_active }}"
headers:
Content-Type: application/json
verify_ssl: false
```## Requirements:
* [support gpiomem](https://github.com/stianeikeland/go-rpio#using-without-root)
## Tested and working on:
* Raspberry Pi 3 Model B Rev 1.2 (Raspbian GNU/Linux 10 (buster))
## Flags:
```bash
Usage of ./gpio-api:
-dbfile string
Set db file (default "./gpio.db")
-listen-port int
Set http server listen port (default 8081)
-recovery
Recovery gpio state at start
```