Best practice for rare changing values

I’m using influxdb and grafana and was curious whats best practice if i get sensordata like moisture from a soil sensor every 5 minutes but also want to save the location and plant it is measuring. Location and plant are not changed often, like every month or so.

Should i write this to the measurement Sensor1 every 5 minutes when there’s a new value? Or do i have to create another measurement and link it through an id or something? Or is it even possible to ask for f.e. WHERE location = Outdoor “and all following” so i just have to enter it once in the same measurement.

The goal is to create a dynamic graph that automatically shows all moisture values of all sensors located in the same room. In addition it should show the name of the plant in the legend for every sensor (like tomato).

A hint to the right direction would be awesome, searched several days with different answers.

For 2 measurements:

for adding it to every value:

Hi,

I don’t have a lot of experience working with influxdb, but in general when it comes to timeseries databases there always a question regarding high or low cardinality. Timeseries databases don’t work good at all when you have high cardinality, i.e. huge amount of sensors, locations and plants. If you don’t have or expect that many sensors, locations and/or plants it could work to store everything in inlfuxdb, but you’ll need to test this.

I would suggest that you do some calculations of how many different sensors you expect to have, how many different locations (city name or geo points) and how many plants. After that there will probably be easier to give you advice on how to go forward.

Marcus

I got 12 sensors with 4 different fields (moisture,conductivity,light and temperature)
4 locations
and 20+ names (plan was to give them unique names like tomato 1 f.e.)
seems like the best way to go is to take another db like mysql, right?

My goal was to use grafana as my visualization tool. Scripted dashboards then, right? Ask mysql which sensor is in which room and display all sensors in this specific room… and name them from mysql too. Or is there a better way? Atm i write location and name to a simple textfile. While thinking about it, mysql would be to much for 4+20 values… is it possible to read from that textfile from a scripted dashboard?

thanks for answering.

Hi,

This sounds like influxdb are a good fit for your use case.

I’m thinking that the following measurement can be used:

time                      moisture conductivity light temperature location name
2015-08-18T00:00:00Z      12       20           23    1           abc      sensor_1
2015-08-18T00:00:00Z      1        20           30    1           abc      sensor_2
2015-08-18T00:06:00Z      11       20           28    1           abc      sensor_3
2015-08-18T00:06:00Z      3        20           28    1           abc      sensor_4
2015-08-18T05:54:00Z      2        20           11    2           abc      sensor_5
2015-08-18T06:00:00Z      1        20           10    2           abc      sensor_6
2015-08-18T06:06:00Z      8        20           23    2           abc      sensor_7
2015-08-18T06:12:00Z      7        20           22    2           abc      sensor_8

Moisture,conductivity,light and temperature are fields with key/values and location and name as tags. Then you can write queries like

SELECT temperature FROM "<measurement>" WHERE "name" = "sensor_1"
SELECT moisture FROM "<measurement>" WHERE "location" = "abc"

Please read inlfuxdb key concepts for information about field and tags.

With this setup you should be able to use Grafana for vizualizing your data.

Marcus