calor

command module
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

README

#Calor Calor is a go daemon that takes period readings for a pre-configured list of thermometers, and makes those readings available via a simple HTTP rest interface.

It's primary purpose was as a method of exploring the go language, and as a way to log the temperatures in my house. In the hopes that you find it useful for your own projects, it's been written with extensibility in mind, and adding new thermometer types can be done via implementing the thermometers.Thermometer interface.

Everything is in /internal, which means Calor does not currently export any packages you can use. When the code quality comes up a bit, and things are better documented that will change and most things will move to /pkg. Until that time, to use Calor in your own project, you'll have to fork it.

To build and run the commands are

go build cmd/calor/calor.go
./calor --config <Full path to your config file>

Alternately, if you have a config file in /etc/calor/calor.json already, then it's just

go build cmd/calor/calor.go
./calor

The config file calor is a JSON document with 4 keys

  1. Database The description of your database configuration, which is used to store the readings from the thermometers. PostgreSQL and Sqlite are supported. A Postgres config looks like:
  "Database": {
    "DriverType": "Postgres",
    "Host": "Localhost",
    "Username": "postgres",
    "Password": "postgres"
  },

While a Sqlite connection looks like:

  "Database": {
    "DriverType": "Sqlite",
    "File": "/home/calor/calor.db"
  },
  1. ReadAcceptors A JSON array of Read Acceptors. Read Acceptors are the things that accept the readings from the thermometers Currently there is a Console read acceptor, that just outputs the readings to the console, and the Sqlite read acceptor, which writes them to the Sqlite DB configured in the database section
  2. Thermometers A JSON array of thermometer configurations. See the sample_calor_config.json for some example types. The UpdateInterval option is an integer and is the number of seconds you want a reading taken from that thermometer.
  3. Port this is the port you want the web server to run on. It does not support HTTPS

Init scripts

A basic script for systemd is contained in init

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
thermometers
* A themometer that always reads 0 degrees kelvin
* A themometer that always reads 0 degrees kelvin
web

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL