/termo-api

API for a DIY thermostat

Primary LanguageGoMIT LicenseMIT

Termo-API

A Go based API for a DIY internet controlled thermostat.

Hardware

diy-thermostat

- Raspberry Pi (Model B) - Sainsmart 4 Relay Module - DS18B20 Temperature Sensor

Dependencies

  • Go
  • gin a Go web framework.
  • hwio a Go GPIO library.
  • Termo-UI is an EmberJS powered UI for this API.

Building (on OS X 10.9.5)

Note: The toolchain is only needed if there is a cgo dependency.

Deploying

  • Create ./api_key see ./api_key.example
  • Edit script/deploy variables as needed
  • $ script/deploy

Note: Currently termo-api is deployed as root so as to interface with GPIO pins, this is awful, and will be remedied soon.

Starting

$ API_KEY=foo ./termo-api

Issues

  • Permissions issues are preventing running the server as a non superuser
  • Hardware build needs to be documented.
  • No unit tests

JSON API

GET /v1/thermostat

{
  "targetTemp": 20,
  "heaterStatus" : true,
  "currentTemp": 18
}

POST /v1/thermostat

set the target temperature

{
  "targetTemp": 30
}

License

MIT