InfluxDB - Flux query inserting extra pipe line

I’m having some trouble getting a flux query to work to InfluxDB 2.0. Here is my code to query:

sensor:
  - platform: influxdb
    api_version: 2
    ssl: false
    host: 192.168.x.x
    port: 8086
    token: ***
    organization: ***
    bucket: acurite
    queries_flux:
      - range_start: "-1d"
        query: '|> filter(fn: (r) => r["topic"] == "esp-barometer/sensor/sea_level_pressure/state")'
        name: "Sea Level Pressure"
        unit_of_measurement: "inHg"
        group_function: mean

The error that I get is:

haqa    | 2021-11-03T09:32:05.868108084Z 2021-11-03 05:32:05 ERROR (SyncWorker_5) [homeassistant.components.influxdb.sensor] Could not execute query 'from(bucket:"acurite") |> range(start: -1d, stop: now()) |> |> filter(fn: (r) => r["topic"] == "esp-barometer/sensor/sea_level_pressure/state") |> mean(column: "_value")' due to '(400)
haqa    | 2021-11-03T09:32:05.868611376Z Reason: Bad Request
haqa    | 2021-11-03T09:32:05.868670497Z HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json; charset=utf-8', 'Vary': 'Accept-Encoding', 'X-Platform-Error-Code': 'invalid', 'Date': 'Wed, 03 Nov 2021 09:32:05 GMT', 'Transfer-Encoding': 'chunked'})
haqa    | 2021-11-03T09:32:05.868755612Z HTTP response body: b'{"code":"invalid","message":"compilation failed: error at @1:61-1:63: pipe destination must be a function call"}'
haqa    | 2021-11-03T09:32:05.868817751Z '. Check the syntax of your query.

The reason is pretty clear, there is an extra pipe getting inserted between the range and the first filter.
Any thoughts why or how to prevent this?

Assuming HA itself adds the pipe, just remove it from your query, no?

OMG…how stupid and obvious! I think I had been staring at it too long this morning :frowning: I was looking at the doc with all the examples showing multi-line queries (which most of mine are), and never even occurred to me that I would omit that key part of any standard query. I was hung up on the fact that it was building out automatically all the other parts that I normally do like the from buckets and grouping parts. Sorry for the stupid question.