Using Tinamous for data logging

In the past I’ve used various services to log data from my home devices, and… unfortunately, they either go away (data.sparkfun.com) or become commercial which is hard to justify for a few temperature graphs.

The latest one I’ve played with is called Tinamous, and provides simple graphing and dashboards, plus an MQTT interface that’s easy to hook up to an agent. It also provides a pipe for sending commands to the device, and a timeline for general textual status messages.

To get started, visit Register a new Tinamous account. and pick your account name - this will define the URL that you access your data with, eg account “imptest” is accessible as “imptest.tinamous.com”.

You can have multiple users for each account, I just created the first user with the same name as the account. Obviously, remember the password!

You’ll then be sent to the login page at your new account home (eg imptest.tinamous.com). Log in with your username and password.

The next step is to create a device.Click devices in the menu bar, then “add device”. Each device has a username - local to that account - and a password that is used to authenticate its MQTT connection. Leave access set to read/write:
image

Here’s the code for an impexplorer kit, which samples temperature and humidity every 5 minutes, then goes to sleep again; extending the interval will give you longer battery life, but even waking at this cadence should be 6+ months of life. Cut and paste device.nut into the right hand pane of a new device group, and the agent.nut into the left hand pane.

You’ll need to insert your account name, device username and device password in the obvious place in the agent code. After clicking build & run you should see the agent log that it’s successfully connected to Tinamous, and when the first measurement comes in, Tinamous will auto-create the fields as the posts arrive.

Note that the default interval at which Tinamous warns that readings are not arriving is 5 minutes - the warnings don’t affect data ingestion, but are a bit annoying especially when the device is connected and reporting… you can change the “not reporting after” interval by clicking edit next to the device name in the device list screen.

You can see graphs by going to devices in the top bar, then selecting your device. You can also build dashboards really easily like this:

The example code has a command handler registered that just prints out the topic path and the body of the request - the Tinamous device view has a commands button and you can use this to send ad-hoc commands to the device (which you’ll see logged in impCentral), but I’ve not yet worked out how to build pre-defined commands.

1 Like