Properly Displaying Power Consumption from kW to kWh

Any idea how to calculate from power form other variables?
If temp > 30 pump working.
Example:

SELECT mean(“temp_input”)/mean(“temp_input”) FROM “sensors” WHERE (“feature” = ‘temp1’) AND “temp_input”> 30 AND $timeFilter GROUP BY time($__interval) fill(null)

Pump power is 2,5kW, now I need working time