It’s not clear what value is stored in the database. Does it revert to 0 at midnight or is it forever increasing?
In either case, the absolute easiest and most fool proof would be to store stromverbrauch_sdm630_heute into an Item that represents, “yesterdays” total at midnight.
If the value is forever increasing you can calculate it by subtracting the delta for today from the delta since yesterday.
var todayTotal = SDM_kwh_Totalkwh.deltaSince(ZonedDateTime.now().with(LocalTime.MIDNIGHT))
var yesterdayTotal = SDM_kwh_Totalkwh.deltaSince(ZonedDateTime.now().with(LocalTime.MIDNIGHT).minusDays(1)) - todayTotal
You already are. You are calculating the delta between now and midnight no matter when this rule runs.
If that works now no problem. But depending on timing, triggering at 00:00 might mean that LocalTime.MIDNIGHT is actually now or no more than a few milliseconds from now. You might trigger this a second before midnight or have to take that into account.