Cumulative precipitations

Hello everyone,
i have a timescale table containing data from a precipitation sensor
/timestamp/value/other columns…/
timestamp is the primary column for timescale.
i have a need to show a bar chart representing the cumulative precipitations by hour over the last 24 hours. my chart would show 24 bars (one for every hour, it’s value is the sum of all values in that hour).
in an hour i can receive up to 10 values for precipitations (sometimes less)
so the intuitive solution is to do a select sum(value) 24 times for each hour, but for the sake of performances and code maintenance, i would like to do it in one request with timescale. but i am a newbie in timescale.
could someone please give me an advice or a hint to start writing my request ?