Temperature Logging Corlysis + Home Asst



The wiring is simple - just need an MCP9808 Breakout Board from Adafruit which is a very accurate, fast, and reliable temperature sensor.

_images/MCP9808wiringwithtrigboard.png _images/MCP9808Installed.png

Corlysis Method

This project shows off what you can do with the low power real time clock on the trigBoard - simply set the interval wake time and the trigBoard will automatically wake and send the temperature reading to the cloud. In this example, Corlysis is used for as the cloud provider. This could just as well be hosted on a local setup using a raspberry pi, but with everything hosted in the cloud, it is very easy to view the data from anywhere and share with others.

If you have a trigBoard running the stock base firmware, you could simply OTA this code over, or compile the code yourself, but first make sure you can compile the base firmware. See the firmware section for more information.

Just note the only new library needed is the Adafruit MCP9808 lib - you can add this from Arduino Sketch>>Include Library>>ManageLibraries menu

trigBoard MCP9808 Corlysis Code is Here

This code was designed to work with Corlysis, so first make sure you go over there and setup an account, then create a database:


Name this whatever you want, but we will need it later when setting up the trigBoard. Next, click the API Keys menu:


Just copy your Key there - we will need this later as well for setting up the trigBoard.


What’s really cool about this code is that it re-uses other fields in the trigBoard configurator to set this up to work with Corlysis, so no need to hard code things. Before setting up, you need to decide a few things first:

  • The Database Name is what you already created in Corlysis
  • Measurement name is like the name of all these devices. So in my case, I call this LMT01. I’ll have a whole bunch named LMT01 as this type of sensor.
  • Location Name is what I use to locate the sensors, so Front porch, Garage, Inside, etc… We’ll also use this to parse out the data, so should be unique.
  • C or F is obvious, put in either C or F to set the conversion
  • API Key is straight from Corlysis, just copy and paste that over.
Configurator Corlysis
trigBoard Name Database Name from Corlysis
Message when Contact Opens Measurement Name
Message when Contact Closes Location Name
Message when Wake Button Pressed C or F
Timer Message for Contact still Open API Key

So then when you launch the configurator, you setup your WiFi credentials, the interval time in the timer settings, then the Corlysis parameters:



Ok, so here’s where things get cool - Corlysis is hosting both the influxDB where the data is stored and also Grafana where the data can be plotted. One you have a trigBoard sending data, you can click on he grafana menu. Then create a new dashboard in there, new panel as well, and select graph:

_images/grafdash.png _images/grafpanel.png _images/grafgraph.png

Then click the drop down to edit the panel:


make sure you’re on the metrics tab do the following:

  • Data Source - click in there and select the database you created where the trigBoard is sending data
  • FROM default - then you select the measurement name or type it in, mine is LMT01
  • WHERE - this is how we filter by location, so you’ll have to type in location, then = to whatever you want to show. Mine is “front”
  • SELECT - we’re actually sending multiple pieces of data for this measurement, but we’re plotting temperature here, so select temperature between the field(..)
  • Then after that remove the mean() by clicking on it and then add distinct() which is in the Aggregations menu.

You should now see data!! Note that you can also plot battery voltage the same way, but select battery instead of temperature.


You can also create these cool gauges, by making a new panel for single stat - just choose last for the Selector:


And in options, select current for the data and you can tweak other things:


If this only updates every once and a while, I like to make sure it at least spans out a year looking for the latest:


Home Assistant Method

This is very cool and useful and how I am currently setup. We’ll just tack on the temperature data to the normal trigBoard push message, which can be easily parsed in Home Assistant using a value_template.


Be sure to completely review the Home Assistant Guide first, because this relies on everything in there - MQTT Mosquitto broker, InfluxDB, and Grafana to be installed.

trigBoard MCP9808 Home Assistant Code is Here

All this code does is read from the MCP9808 sensor and concat it to the trigBoard push message with a comma. Then we can easily separate this out in Home Assistant.

As shown in the Corlysis example, one of the fields from the Configurator is used to set the units. We sacrifice the button message for this:

Message when Wake Button Pressed C or F

Then the rest of the setup follows the same as shown in the Home Assistant Guide

But now we have a new value to parse out, so in your configuration.yaml file, you will add something like this:

  - platform: mqtt
    state_topic: "MCP9808_OUTSIDE"
    name: "Back Porch Temperature"
    icon: mdi:temperature-fahrenheit
    unit_of_measurement: "F"
    value_template: "{{ value.split(',')[2] }}"

  - platform: mqtt
    state_topic: "MCP9808_OUTSIDE"
    name: "Back Porch TempSensor Voltage"
    icon: mdi:car-battery
    unit_of_measurement: "V"
    value_template: "{{ value.split(',')[1].split('V')[0] }}"

You see here that I set my MQTT topic to “MCP9808_OUTSIDE” and I’m pulling out both voltage and temperature as separate entities. Then you can build cool dashboards like this: