Reset fibaro plug at midnight

I’m trying to create a rule for my fibaro wall plug.

What i’m trying to get to is: measure the Kwh per day, reset at midnight.
If i understand persistence, i would still be able to get the kwh for the entire monitored period (as in last six months), but still have a daily statistic too ?

Anyway, I’m trying this (using the totalusage variable to try and keep it in the persistence, might not be needed ?):

var number totalUsage

rule “ResetUsage”
when
Time cron “0 0 0 * * ?”
then
{
totalUsage = totalUsage + zwave:device:4128143b:node2:meter_watts
sendCommand(zwave_device_4128143b_node2_meter_reset, ON)
sendCommand(zwave_device_4128143b_node2_meter_reset, OFF)
}
end

You need to store the totalUsage in an item, to get it persisted. (And add it to your persistence strategy)

TotalUsageItem.postUpdate(totalUsage)

This item should be defined like your zwave:device:4128143b:node2:meter_watts item, just omit your channel information and adjust the label.