Moved from influxdb 1. to 2.x, need help with queries

Hey there,

on my home labb I somehow had my influxdb upgraded to 2.0 and now all my queries cant be used anymore. So I´m trying to learn the Flux queries.

one example is that I have temperature data from different devices.
I´m graphing with Grafana.
This below will give a table with timestamp and friendly_name of the device. If I would like to have this for a graph and include the field temperature, how would that query look like?
I would like to have one line in the graph per device(friendly_name) and display the field temperature with the accual data.

from(bucket: "mqtt")

  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)

  |> filter(fn: (r) => r["_measurement"] == "zigbee2mqtt")

  |> filter(fn: (r) => r["_field"] == "friendly_name")

  |> yield(name: "last")

I will also add some information about the setup:
bucket: mqtt
measurement: zigbee2mqtt
fields:
image

@blarrkan, you should still be able to use all your InfluxQL queries using the 1.x compatibility features built into 2.0. You just need to set up some DBRP mappings and create authorizations in your 2.0 instance. You’ll have to add the authorization to your Grafana/InfluxDB connection, but should be as simple as populating two fields in a form.

1 Like

Thanks
this worked fine :slight_smile:
I did not have to learn the flux query language today.