More downsampling woes

I need to do something, very similar to this: with Flux rather than 1.x series. My (clearly wrong!) pseudo code is:

data =
    from(bucket: "probe_box")
        |> range(start: -duration(v: int(v: task.every) * 2))
        |> filter(fn: (r) => r[ "mac_address"])
        |> count(mac_address)

    // Stores the aggregated data in a new bucket
    |> to(bucket: "probe-downsampled", org: "uni")

Do I need to use windowAggregate? I suspect a few other people, apart from the above need to do this too?

TIA Hugh