Convert query to use timespan

I have a query that I use to calculate energy usage for the last hour of data. I want to modify the query so that it will work when selecting a time period on the Grafana GUI but I’m not sure how to go about it.

Here’s my current query:
SELECT sum(“kWatts”) /3600 FROM “Status” WHERE (“PackState” = ‘DISCHARGING’) AND time > now() - 1h fill(null)