Flux query to select, group by time and calculate the mean

I’m currently testing Flux. For my first test, I’m tried to convert a basic InfluxQL querie to Flux.

InfluxQL

SELECT mean(“usage_idle”) FROM “cpu” WHERE (“cpu” = ‘cpu-total’) AND $timeFilter GROUP BY time($__interval) fill(null)

Flux

from(db: “telegraf”)
|> filter(fn: ® => r["_measurement"] == “cpu” AND r["_field"] == “usage_idle” AND r[“cpu”] == “cpu-total”)
|> range($range)
|> window(every:$__interval)
|> mean()
|> group(none: true)

Results

It works but there’s two issues :
I don’t know how I to do the fill(null).
$_interval is expanded to different values in InfluxQL and Flux. In InfluxQL, it’s expanded to 1m. In Flux, it’s expanded to 15s.