The math (and other) expressions in Grafana are actually expressions to InfluxDB, and thus they support what InfluxDB supports. Unfortunately InfluxDB itself does not support that advanced maths in the query language, and the method recommended by influxdata (and the method I use) is to use Kapacitor to calculate the values, and store them in a separate measurement.
The streaming tickscript dewpoint.tick that I use for calculating the dew point is:
var temperature = stream
|from()
.measurement('temperature')
.groupBy(*)
var relHumidity = stream
|from()
.measurement('humidity')
.groupBy(*)
temperature
|join(relHumidity)
.as('t', 'h')
|eval(lambda: 243.5 + "t.value", lambda: 17.67 * "t.value", lambda: "v2" / "v1", lambda: exp("v3"), lambda: 6.112 * "v4", lambda: "h.value" / 100.0, lambda: "humiDec" * "equilibriumVaporPressure", lambda: "v5" / 6.112, lambda: log("v6"), lambda: "v7" - 17.67, lambda: -243.5 * "v7", lambda: "v9" / "v8")
.as('v1', 'v2', 'v3', 'v4', 'equilibriumVaporPressure', 'humiDec', 'v5', 'v6', 'v7', 'v8', 'v9', 'value')
.keep('value')
|influxDBOut()
.database('ruuvi')
.measurement('dewpoint')
enabled with something like:
kapacitor define dewpoint -type stream -tick dewpoint.tick -dbrp ruuvi.autogen
kapacitor enable dewpoint
(this tickscript assumes you are using the original format of my RuuviCollector and you want to store the dewpoint in a measurement called dewpoint in a database called ruuvi. If you want different, modify accordingly)
(a note for future readers: some day when I have time, I will rework the format used by the RuuviCollector to use multi-value measurements and add dew point and absolute humidity as pre-calculated values by the collector, though donāt worry, I will keep the current format as a ālegacy formatā available too, since users using older InfluxDB canāt use multivalue measurements, as those are not supported by older versions of InfluxDB, and because not all people necessarily want to migrate their databases)