Hi Norbert,
This is not a simple rule you want to write.
For the trigger look at: https://www.openhab.org/docs/configuration/rules-dsl.html#rule-triggers
For the energy over time you could look at: Rule for Total energy consumed in kWh for day or Best practice for handling energy consumption in a single cummulative value?
Search the forum there are more…
Have a go at writing your rule, if you get stuck, post your code and we’ll help. We will not write your code for you. You ask for a helping hand.