Influxdb sensor for current day

I’m trying to set up a sensor to pull data from InfluxDB 2 for just the current date, but for the life of me, I can’t get it figured out. I currently have it working for pulling the last 24 hours (-1d), but I want it to only pull the data from midnight on. Has anyone done this and help me out? Seems like it shouldn’t be that hard. This is what I have, but it is not working:

sensor:
  - platform: influxdb
    
    queries_flux:
      - name: "Garage Door Openings Today"
        range_start: 0
        query: >
          range(
            start: {{ (system.time().replace(hour=0, minute=0, second=0, microsecond=0)) }},
            stop: {{ (system.time()) }}
          )
          |> filter(fn: (r) => r["entity_id"] == "garage_door")
          |> count()

Does anyone have any experience with this? I’m just looking for the results for the current day and not a rolling 24hrs. Thanks

system.time() ?
use now()

And abuse the template developer tool to test your templates to ensure they actually return what you think they do :wink: