GravityMon#

Self Hosted Cloud Hosted

A GravityMon reports its tilt, temperature and battery, and BrewGraph shows the gravity it sends. This page shows how to point the GravityMon’s HTTP push at BrewGraph.

What you need#

  • A Gravitymon device added in BrewGraph under Devices. BrewGraph shows its device token on the device page.

  • A GravityMon with a gravity formula set up. BrewGraph shows the gravity the device sends.

Configure the GravityMon#

In the GravityMon web interface, open the push settings and choose the HTTP target. Fill in:

Field

Value

HTTP URL

Cloud Hosted: http://ingest.brewgraph.com/ingest/gravitymon. Self Hosted: http://<your-ingest-host>/ingest/gravitymon. Plain HTTP on port 80 works; the field also accepts https://.

Use tcp

Off

HTTP header 1

Content-Type: application/json

HTTP header 2

Leave empty

Push skip interval

0 (the default). 1 pushes every other cycle.

Data format (gravity)

The template below

Device token

The device token from the BrewGraph device page, for example YOUR-DEVICE-TOKEN. Enter it in the token setting of the GravityMon. See Device Tokens.

Use this template as the gravity data format. ${token} inserts the token you entered in the GravityMon:

{"name": "${mdns}", "ID": "${id}", "token": "${token}", "interval": ${sleep-interval}, "temperature": ${temp}, "temp_units": "${temp-unit}", "gravity": ${gravity}, "velocity": ${velocity}, "angle": ${angle}, "battery": ${battery}, "RSSI": ${rssi}, "corr-gravity": ${corr-gravity}, "gravity-unit": "${gravity-unit}", "run-time": ${run-time} }

The GravityMon sends gravity-unit as G (SG) or P (Plato), in any letter case; BrewGraph stores Plato as SG. The payload is described under GravityMon in Device Ingest API.

Set the sleep (reporting) interval on the GravityMon to match your plan. On Cloud Hosted the free beta needs about 900 seconds at minimum; a reading that arrives faster is answered with 429 and is not stored. Self Hosted accepts any interval.

Payload#

An accepted minimal payload:

{
  "token": "<token>",
  "gravity": 1.045,
  "gravity-unit": "G"
}

A typical payload:

{
  "name": "Gravitymon_01",
  "ID": "12345678",
  "token": "<token>",
  "angle": 42.15,
  "temperature": 19.5,
  "temp_units": "C",
  "battery": 4.12,
  "gravity": 1.045,
  "corr-gravity": 1.044,
  "gravity-unit": "G",
  "velocity": -1.5,
  "interval": 900,
  "RSSI": -65,
  "run-time": 2.14
}

gravity-unit is required. Gravity, angle, temperature, battery, velocity, RSSI, and run-time are optional individually; at least one measurement is required.

Save the typical payload as payload.json and replace <token> in the file and both addresses with the device token. First capture the payload for inspection, then send the same payload to the device endpoint:

curl -X POST 'https://ingest.brewgraph.com/ingest/test/<token>' \
  -H 'Content-Type: application/json' --data-binary @payload.json
curl -X POST 'https://ingest.brewgraph.com/ingest/gravitymon?token=<token>' \
  -H 'Content-Type: application/json' --data-binary @payload.json

Check that it works#

  1. Save the configuration and wait for one sleep interval.

  2. Open the device in BrewGraph. The latest reading, with its gravity, temperature and battery, should appear on the device page.

  3. Assign the device to the batch that is fermenting to see the readings on the batch chart.

Troubleshooting#

  • Nothing appears and the GravityMon reports 401: the token is missing or mistyped. Copy it again from the device page and check it is set in the GravityMon’s token setting.

  • 404: check that the HTTP URL ends exactly in /ingest/gravitymon.

  • 429 on Cloud Hosted: raise the sleep interval to at least your plan’s reporting interval.

  • Readings are refused: check that the data format matches the template above and that header 1 is Content-Type: application/json.

  • 502, 503 or 504: check that the host in the HTTP URL is the ingest host, not the address you use to open the app.

For every status code and what to do about it, see Ingest error codes.

Limitations#

On Cloud Hosted, readings sent faster than your plan’s reporting interval are not stored. BrewGraph records the raw gravity value; corr-gravity is ignored. To forward several devices through a GravityMon Gateway, see Devices.