Converting InfluxQL queries to Flux (Influx 1.8.9)

My smart home is based on ioBroker, InfluxDB, Grafana 7.1 and lots of sensors and switches communicating using Zigbee and MQTT. InfluxDB is the memory of all this, currently at 1.8.9.

To prepare for switching up to Influx 2, I would like to convert all my queries to Flux using this setup, and this works already for simple graph queries.

One issue I have is this: I have a lot of temperature / humitity sensors which fill the database via ioBroker. In the old setup I created an InfluxQL query for each sensor seperately, styled the graph manually and this was a LOT of manual work.

I would now like to store aliases for my measurements somewhere central where I can access them from anywhere using Flux to label my measurements better in any visualization. For example, “deconz.0.Sensors.13.temperature” might be “Living Room Temperature”, and “deconz.0.Sensors.8.temperature” might be “Basement Temperature”.

Then I need to integrate these aliases into the Flux query so the labels are correctly set, and also consistent across dashboards.

If possible, I would like to put even line color into Influx so I don’t have to do this everywhere where I use this measurement.

How could I do this best?

Hello @Jens,
I think you could either 1) use either map() or set() or rename() to rename the tag values or columns depending on your schema and what you prefer:

Or you could take advantage of dashboard variables and query for individual rooms:

I what you’re really looking for relates to this feature request though:

I recommend commenting on it if you agree.

Using variables directly in queries seems like the way to go here. I commented on this feature request.
I don’t want to keep labeling everything in every dashboard I create, there must be some central way to define aliases.

Thank you!

Thank you! (fwiw I don’t see a comment in case you were hoping to)

1 Like