Influxdb Flux - Change or alias legend label from "temp {host=XX, topic=YY}" just to "YY"

I configured Flux for my grafana mqtt temperature sensor (gathered via zigbee2mtqq > mosquitto > telegraf > influxdb2).

I have this simple flux query that generally does work:

from(bucket: "homeassistant")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "mqtt_consumer")
|> filter(fn: (r) => r["_field"] == "temperature")
|> filter(fn: (r) => r["topic"] == "zigbee2mqtt/Arbeitszimmer/SENSOR" or r["topic"] == "zigbee2mqtt/Schlafzimmer/SENSOR")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")

However my legend contains these entries:

temperature {host="", topic="zigbee2mqtt/Schlafzimmer/SENSOR"}
temperature {host="", topic="zigbee2mqtt/Arbeitszimmer/SENSOR"}

I spend a lot of time to search this forum and google but could not find a way on how to specify the actual label content. I would like them to just read “Schlafzimmer” and “Arbeitszimmer”.

I could see that in InfluxQL you are able to do that with ALIAS / GROUP BY statements. But I am unable to find how to do that using Flux in grafana.

Any help much appreciated!

I actually found out by trial and error later that “Field Overrides” provide the behavior I want.

Adding a field override, then choosing “Field with name” and entering the verbose name, I can apply “Standard options > Display name” to that field and enter the “friendly” name. That can be done for each sensor I have.

Hope it helps someone also looking for this solution.