Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Latest commit

 

History

History
12 lines (8 loc) · 638 Bytes

README.md

File metadata and controls

12 lines (8 loc) · 638 Bytes

goccupied

This is a simple webserver written in golang. It is designed to run on a Raspberry Pi and access its GPIO pins.

The server periodically checks GPIO14 for input. The input is expected to come from a brightness sensor that sends a Low signal when light is above a certain threshold and a high signal otherwise.

The state can be queried by a http request to http://<hostname>:8000/api/v1/occupied which also returns the duration of the current state in seconds. The sensor can be queried directly by calling http://<hostname>:8000/api/v1/light

Compile this code with GOOS=linux and GOARCH=arm