maximumSince does not show highest value

Thank you for your suggestions.

I already installed MariaDB using this guide: https://community.openhab.org/t/how-to-setup-mysql-persistence-in-a-few-minutes-step-by-step/100965

In addons.cfg I changed the following value:

persistence = mysql,rrd4j,jdbc

My jdbc.persist looks like this:

// persistence strategies have a name and a definition and are referred to in the "Items" section
 
 
Strategies {
   everyMinute	: "0 * * * * ?"
   everyHour    : "0 0 * * * ?"
   every5Minutes : "0 0/5 * 1/1 * ? *"
   every15Minutes : "0 0/15 * 1/1 * ? *"
   every30Minutes : "0 0/30 * 1/1 * ? *"
   everyDay     : "0 0 0 * * ?"
   default = everyChange
}

Items {

   AT_Dachflache* : strategy = every30Minutes // These are all weather station measurements
   AT_Dachflache_Wind_* : strategy = everyChange // This is just for the wind measurements
}

And my wind.rules has my previous rule attempt and the adapted @rossko57 rule. I pointed the persistence to “jdbc” in both rules:

rule "Wind Maximum 5 Minuten"

when
	//Time cron "0 0/5 * * * ?"
	Time cron "0 * * * * ?" //for debug
then
//	var Number Wind_Max5 = AT_Dachflache_Wind.maximumSince(now.minusMinutes(5), "jdbc") as Number
//	AT_Dachflache_Wind_Max5.postUpdate(Wind_Max5) // assumes values are still in rrd4j
	AT_Dachflache_Wind_Max5.postUpdate(AT_Dachflache_Wind.maximumSince(now.minusMinutes(5), "jdbc")) // assumes values are still in rrd4j
    logInfo ("Wind Maximumsince5","Maximum Wind was: " + AT_Dachflache_Wind_Max5.state + " m/s at " + AT_Dachflache_Wind.maximumSince(now.minusMinutes(5)).timestamp)    
/*
//	logDebug("consumptionAvg", "Cons average {}", ConsumptionAvg.state)
	PowerAverage = SolarPowerTot.averageSince(now.minusMinutes(5)) as Number
	SolarPowerAvg.postUpdate(PowerAverage) // assumes values are still in rrd4j
//	logDebug("SolarAvg", "Solar average {}",SolarPowerAvg.state)
*/
end

rule "Calculate today's max wind gust"
when
    Item AT_Dachflache_Wind changed
then 
	// formatter is needed in the conversion of Java time (ZoneDateTime) to DateTime.
	// See the following link for discussion on time conversion. https://community.openhab.org/t/datetime-conversion-openhab-3-x/107197/16. 
    // See in particular post from Bartkummel in Jan21
	
	val formatter = java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")

	AT_Dachflache_Wind_MaxDay.postUpdate(AT_Dachflache_Wind.maximumSince(now.with(LocalTime.of(0,0,0,0))).state, "jdbc")
	
	// get time of max gust. This is returned in Java time (ZoneDateTime variable)
	var time_of_max_gust = AT_Dachflache_Wind.maximumSince(now.with(LocalTime.of(0,0,0,0))).timestamp
	
	// convert to string using above formatter anmd then convert to DateTime variable using DateTimeType 
	AT_Dachflache_Wind_MaxDay_Time.postUpdate(DateTimeType.valueOf(time_of_max_gust.format(formatter)))
	
	logInfo("org.openhab","Today's max wind gust is " + AT_Dachflache_Wind_MaxDay.state + " m/s at " + AT_Dachflache_Wind_MaxDay_Time.state.format("%1$tr"))
end

VS Code reports the following problems for my rule:

Type mismatch: cannot convert from HistoricItem to String
The method or field state is undefined for the type ZonedDateTime

and for @rossko57 's rule:

Invalid number of arguments. The method postUpdate(Item, State) is not applicable for the arguments (NumberItem,State,String)

This is my log:

2022-04-05 12:55:09.544 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 10.08 m/s at 12:40:00 AM
2022-04-05 12:55:09.511 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 6.84 to 10.08
2022-04-05 12:55:09.524 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay' changed from 8.740625 to 10.08
2022-04-05 12:55:09.547 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay_Time' changed from 2022-04-05T00:40:00.000+0200 to 2022-04-05T12:55:09.539+0200
2022-04-05 12:55:12.486 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 12.6 m/s at 12:55:12 PM
2022-04-05 12:55:12.457 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 10.08 to 12.6
2022-04-05 12:55:12.470 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay' changed from 10.08 to 12.6
2022-04-05 12:55:12.487 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay_Time' changed from 2022-04-05T12:55:09.539+0200 to 2022-04-05T12:55:12.479+0200
2022-04-05 12:55:16.630 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 9.0 m/s at 12:55:16 PM
2022-04-05 12:55:16.604 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 12.6 to 9.0
2022-04-05 12:55:16.619 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay' changed from 12.6 to 9.0
2022-04-05 12:55:16.631 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay_Time' changed from 2022-04-05T12:55:12.479+0200 to 2022-04-05T12:55:16.625+0200
2022-04-05 12:55:25.055 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 8.740625 m/s at 12:40:00 AM
2022-04-05 12:55:25.007 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 9.0 to 6.84
2022-04-05 12:55:25.021 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay' changed from 9.0 to 8.740625
2022-04-05 12:55:25.046 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay_Time' changed from 2022-04-05T12:55:16.625+0200 to 2022-04-05T00:40:00.000+0200
2022-04-05 12:55:26.373 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 8.740625 m/s at 12:40:00 AM
2022-04-05 12:55:26.349 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 6.84 to 0.0
2022-04-05 12:56:01.004 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'wind-2' failed: 'state' is not a member of 'java.time.ZonedDateTime'; line 29, column 69, length 25 in wind
2022-04-05 12:56:05.737 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 8.740625 m/s at 12:40:00 AM
2022-04-05 12:56:05.701 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 0.0 to 4.32

The rules seem to work somehow but not as desired. Rosko57’s Max Windgust rule logs an update to a high gust but it then falls back to a value from 12:40 a.m. And my rule seems to be stuck at the problems from the beginning. Did I do something wrong with the persistence definition?
I also tried to work with a variable in the rule instead of the straigh postUpdate:

	var Number Wind_Max5 = AT_Dachflache_Wind.maximumSince(now.minusMinutes(5), "jdbc") as Number
	AT_Dachflache_Wind_Max5.postUpdate(Wind_Max5)

Unfortunately, this doesn’t fix the problem either. Any more ideas? Sorry, I don’t want to drive anyone mad in case this appears like some newbie nonsense to you.