maximumSince does not show highest value

This will not do what you expect.
postUpdate() is asynchronous; the instruction is sent on to openHAB event bus and passed to interested bindings, rules, UI etc, and also updating the actual Item state. Takes a few milliseconds.
Meantime, your rule does not stop and wait. If you retrieve Item state in the following lines, you will likely get the old state still.
Items are not simple variables.

That’s fine, you already know what you sent to postUpdate - use that directly.

var x = AT_Dachflache_Wind.maximumSince(now.minusMinutes(5), "jdbc")
AT_Dachflache_Wind_Max5.postUpdate(x)
logInfo("test", "posted " + x.toString)

It’s going to help your analysis not to try to do everything on one line anyway.

The next pitfall is what the persistence method returns. Clue -

See

maximumSince words -

Gets the maximum value of the State of a persisted Item since a certain point in time (returns HistoricItem)

What you get back is an object - the max record AND a timestamp. That code snippet will fail because x is a complex object. You’d be interested in x.state

1 Like

Thank you @rossko57

I tried to pick up your advise like this:

rule "Wind Max 5 Test"
	when
    Item AT_Dachflache_Wind changed
	then
	var wmax = AT_Dachflache_Wind.maximumSince(now.minusMinutes(5), "jdbc") as Number
	AT_Dachflache_Wind_Max5.postUpdate(wmax)
	logInfo ("Wind test", "Wind posted " + wmax.toString)
end

I added “as Number” to the var line because otherwise VS Code said:

Type mismatch: cannot convert from HistoricItem to String

However, there is no log output at all.
I guess this is the corresponding error:

2022-04-05 15:36:59.876 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'wind-2' failed: Could not cast org.openhab.core.persistence.extensions.PersistenceExtensions$1@17c96a1 to java.lang.Number; line 25, column 13, length 70 in wind

Yes, I went on to add about how to handle what maximumSince() returns, which is not what you think either. You’d be interested in wmax.state

1 Like

Thank you @rossko57. But for some reasone I can’t find the reason why it’s not the real maximum wind value which is stored. Clueless …

Tell us more. What is “it” i.e. what does your rule look like now. What result do you see, what result do you expect?

1 Like

Thank you @rossko57, unfortunately storing the correct values still doesn’t seem to work. To illustrate what I mean here is a log part which shows entries for your “Maximum wind gust of the day” rule:

2022-04-06 14:27:11.493 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 8.28 to 12.24
2022-04-06 14:27:11.530 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay' changed from 11.933541666666667 to 12.24
2022-04-06 14:27:11.541 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay_Time' changed from 2022-04-06T14:08:00.000+0200 to 2022-04-06T14:27:11.510+0200
2022-04-06 14:27:15.210 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 11.933541666666667 m/s at 02:08:00 PM
2022-04-06 14:27:15.170 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 12.24 to 10.44
2022-04-06 14:27:15.191 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay' changed from 12.24 to 11.933541666666667
2022-04-06 14:27:15.211 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_MaxDay_Time' changed from 2022-04-06T14:27:11.510+0200 to 2022-04-06T14:08:00.000+0200
2022-04-06 14:27:20.666 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 11.933541666666667 m/s at 02:08:00 PM

As you can see the max. value jumps to 12.24 m/s at 14:27:11. At 14:27:15, it goes down to 11.93 m/s. That doesn’t make sense because the previously recorded value was higher. So there still seems to be an issue with persistence. Tbh, I can’t figure out how to look into the table of my MariaDB file. Maybe the values don’t get stored correctly in the database.

This is your rule for the and mine for the previous five minutes:

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)
    logInfo ("Wind Maximumsince5","Maximum Wind was: " + AT_Dachflache_Wind_Max5.state + " m/s at " + AT_Dachflache_Wind.maximumSince(now.minusMinutes(5)).timestamp)    
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

My intention is that the item AT_Dachflache_Wind_Max5 shows the highest wind speed of the past 5 minutes. And AT_Dachflache_Wind_MaxDay shows the highest recorded wind speed of the current day.

This is the log error I receive for my 5 minute rule:

2022-04-06 14:37:00.247 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'wind-2' failed: Could not cast org.openhab.core.persistence.extensions.PersistenceExtensions$1@165e572 to java.lang.Number; line 28, column 25, length 70 in wind

I don’t have a “Maximum wind gust of the day” rule, you do. We can try to help you with it.

Yes. As discussed, maximumSince() returns a complex object - which cannot be cast as a Number.
You’d want to look at its state component.

Seeing as you are investigating weirdness, you might find it useful to get the timestamp component as well - which record did it retrieve for you?

Maybe

var Wind_Max5 = AT_Dachflache_Wind.maximumSince(now.minusMinutes(5), "jdbc")
// this is NOT a number, you cannot beat it into a number shape
// you have to look at its parts
logInfo ("Wind Maximumsince5","Maximum Wind was: " + Wind_Max5.state.toString)    
logInfo ("Wind Maximumsince5","Maximum Wind occurred at " + Wind_Max5.getTimestamp.toString)    

It has not sunk in about postUpdate() being asynchronous.
Fetching the state of this Item will get the “old” state, because the postUpdate() in the preceding line has almost certainly not completed yet.

1 Like

Thank you. I will try to fetch the data you suggested.
And I mixed things up with the maximum wind gust rule. It wasn’t provided by you but by @BrianS in an earlier posting. Sorry about that.

When looking into problems with this kind of thing, break it up so you can see the moving parts. Something is not what you expected, find out what. Is that time what you think? Is that whole gubbins something suitable to postUpdate to an Item?

var tt = now.with(LocalTime.of(0,0,0,0)
logInfo("diag", "Using datetime " + tt.toString)
var xx = AT_Dachflache_Wind.maximumSince(tt, "jdbc")
logInfo("diag", "got value " + xx.state.toString)
logInfo("diag", "from " + xx.timestamp.toString)
AT_Dachflache_Wind_MaxDay.postUpdate(xx.state)

I tried this suggestion and here are the log results:

ince5] - Maximum Wind was: 10.44
2022-04-06 18:29:03.086 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind occurred at 2022-04-06T18:29:03.085624+02:00[Europe/Berlin]
2022-04-06 18:30:59.611 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind was: 6.12
2022-04-06 18:30:59.620 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind occurred at 2022-04-06T18:30:59.619834+02:00[Europe/Berlin]
2022-04-06 18:32:00.031 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 was: 8.28
2022-04-06 18:32:00.035 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 occurred at 2022-04-06T18:32:00.033958+02:00[Europe/Berlin]
2022-04-06 18:33:00.029 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 was: 6.12
2022-04-06 18:33:00.033 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 occurred at 2022-04-06T18:33:00.032004+02:00[Europe/Berlin]

Apparently, not the highest but the last recorded value is used by the Max5 variable.

How do you know, what recorded data is available for the preceding 5 minutes? Any at all?

This is a bit of a handicap, I’ve no idea how you use that either.
Let’s get openHAB to have a rough look.

var zz = AT_Dachflache_Wind.historicState(now.minusMinutes(5), "jdbc")
// this is NOT a number either
logInfo ("Wind Maximumsince5","5 mins ago was: " + zz.state.toString)    
logInfo ("Wind Maximumsince5","record from  " + zz.getTimestamp.toString)    

It is unlikely there is any record at exactly five minutes ago to the millisecond - what historicState() should do is search backward for the last valid record before that (on the assumption it remained valid until)

You can query the DB through the API Explorer. The persistence: GET /persistence/items/{itemname} endpoint will let you create a query for all entries between two supplied date times (or a date time to now).

1 Like

Thank you for pointing to the API Explorer, @rlkoshak. I can see that values have been persisted for the item. However because I guess time values are Epoch, I cannot tell when the data was recorded.

Interesting behaviour for the historicState. It keeps showing the data for a value that was recorded at 9 p.m. No changes over time:

2022-04-06 21:11:00.673 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 was: 0.0
2022-04-06 21:11:00.677 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 occurred at 2022-04-06T21:11:00.676203+02:00[Europe/Berlin]
2022-04-06 21:11:00.686 [INFO ] [core.model.script.Wind Maximumsince5] - Wind 5 mins ago was: 0.0
2022-04-06 21:11:00.690 [INFO ] [core.model.script.Wind Maximumsince5] - Wind record from  2022-04-06T21:00:00.277+02:00[Europe/Berlin]
2022-04-06 21:12:00.669 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 was: 0.0
2022-04-06 21:12:00.672 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 occurred at 2022-04-06T21:12:00.671677+02:00[Europe/Berlin]
2022-04-06 21:12:00.680 [INFO ] [core.model.script.Wind Maximumsince5] - Wind 5 mins ago was: 0.0
2022-04-06 21:12:00.683 [INFO ] [core.model.script.Wind Maximumsince5] - Wind record from  2022-04-06T21:00:00.277+02:00[Europe/Berlin]
2022-04-06 21:12:54.143 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 11.933541666666667 m/s at 02:08:00 PM
2022-04-06 21:12:54.029 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 0.0 to 7.92
2022-04-06 21:13:00.124 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 11.933541666666667 m/s at 02:08:00 PM
2022-04-06 21:13:00.098 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 7.92 to 6.12
2022-04-06 21:13:00.667 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 was: 6.12
2022-04-06 21:13:00.670 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 occurred at 2022-04-06T21:13:00.669890+02:00[Europe/Berlin]
2022-04-06 21:13:00.679 [INFO ] [core.model.script.Wind Maximumsince5] - Wind 5 mins ago was: 0.0
2022-04-06 21:13:00.681 [INFO ] [core.model.script.Wind Maximumsince5] - Wind record from  2022-04-06T21:00:00.277+02:00[Europe/Berlin]
2022-04-06 21:13:05.266 [INFO ] [penhab.core.model.script.org.openhab] - Today's max wind gust is 11.933541666666667 m/s at 02:08:00 PM
2022-04-06 21:13:05.245 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind' changed from 6.12 to 0.0
2022-04-06 21:14:00.668 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 was: 0.0
2022-04-06 21:14:00.671 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 occurred at 2022-04-06T21:14:00.670668+02:00[Europe/Berlin]
2022-04-06 21:14:00.679 [INFO ] [core.model.script.Wind Maximumsince5] - Wind 5 mins ago was: 0.0
2022-04-06 21:14:00.681 [INFO ] [core.model.script.Wind Maximumsince5] - Wind record from  2022-04-06T21:00:00.277+02:00[Europe/Berlin]
2022-04-06 21:15:00.684 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 was: 0.0
2022-04-06 21:15:00.690 [INFO ] [core.model.script.Wind Maximumsince5] - Maximum Wind5 occurred at 2022-04-06T21:15:00.688795+02:00[Europe/Berlin]
2022-04-06 21:15:00.703 [INFO ] [core.model.script.Wind Maximumsince5] - Wind 5 mins ago was: 0.0
2022-04-06 21:15:00.707 [INFO ] [core.model.script.Wind Maximumsince5] - Wind record from  2022-04-06T21:00:00.277+02:00[Europe/Berlin]
1 Like

This approach is interesting. The result looks plausible and consistent:

2022-04-06 21:42:01.816 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:42:01.829 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:42:01.831 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:43:03.157 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:43:03.166 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:43:03.169 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:46:06.183 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:46:06.197 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:46:06.201 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:47:06.188 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:47:06.200 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:47:06.202 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:47:06.208 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:00.019 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:48:00.029 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:48:00.032 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:00.036 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:18.035 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:48:18.043 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:48:18.045 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:18.051 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:24.227 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:48:24.240 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:48:24.244 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:24.251 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:34.310 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:48:34.319 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:48:34.321 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:34.325 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:42.116 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:48:42.123 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:48:42.125 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:48:42.129 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:49:00.017 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:49:00.033 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:49:00.037 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:49:00.044 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:50:00.015 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime 2022-04-06T00:00+02:00[Europe/Berlin]
2022-04-06 21:50:00.027 [INFO ] [.openhab.core.model.script.Wind diag] - got value 27.0
2022-04-06 21:50:00.029 [INFO ] [.openhab.core.model.script.Wind diag] - from 2022-04-06T10:00:00.393+02:00[Europe/Berlin]
2022-04-06 21:50:00.034 [INFO ] [.openhab.core.model.script.Wind diag] - Today's max wind gust is 27.0 m/s at 2022-04-06T10:00:00.393+02:00[Europe/Berlin]

The main difference seems to be LocalTime instead of now.minusMinutes(x). Could this be a source of error?

EDIT:
I tried to adapt the MaxDay rule and separated the rule with another variable for minusMinutes

rule "Wind Maximum 5 Minuten"

when
	//Time cron "0 0/5 * * * ?"
	Item AT_Dachflache_Wind changed or
	Time cron "0 * * * * ?"
then
	var m5 = now.minusMinutes(5)
	logInfo ("Wind diag", "Using datetime Wind Max5 " + m5.toString)
	var Wind_Max5 = AT_Dachflache_Wind.maximumSince(m5, "jdbc")
	logInfo ("Wind diag", "Value Wind Max5 " + Wind_Max5.state.toString)
    logInfo ("Wind diag", "Timestamp Wind Max5 " + Wind_Max5.timestamp.toString)
	AT_Dachflache_Wind_Max5.postUpdate(Wind_Max5.state)
//	AT_Dachflache_Wind_Max5.postUpdate(AT_Dachflache_Wind.maximumSince(ZonedDateTime.now.minusMinutes(5), "jdbc"))
	logInfo ("Wind Maximumsince5","Max5 wind was: " + Wind_Max5.state.toString)    
	logInfo ("Wind Maximumsince5","Max5 occurred at " + Wind_Max5.getTimestamp.toString)  	
//    logInfo ("Wind Maximumsince5","Maximum Wind was: " + AT_Dachflache_Wind_Max5.state + " m/s at " + AT_Dachflache_Wind.maximumSince(now.minusMinutes(5)).timestamp)    
	var zz = AT_Dachflache_Wind.historicState(m5, "jdbc")
// this is NOT a number either
	logInfo ("Wind Maximumsince5","Max5 value 5 mins ago was: " + zz.state.toString)    
	logInfo ("Wind Maximumsince5","Max5 Wind record from  " + zz.getTimestamp.toString)
end

This is the log. minusMinutes fetches the correct time. However, maximumSince always picks the last recorded value.

2022-04-06 22:59:12.785 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_Max5' changed from 0.0 to 10.44
2022-04-06 22:59:20.011 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 value 5 mins ago was: 0.0
2022-04-06 22:59:20.014 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 Wind record from  2022-04-06T22:30:00.780+02:00[Europe/Berlin]
2022-04-06 22:59:20.020 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime Wind Max52022-04-06T22:54:20.018264+02:00[Europe/Berlin]
2022-04-06 22:59:20.041 [INFO ] [.openhab.core.model.script.Wind diag] - Value Wind Max5 6.12
2022-04-06 22:59:20.044 [INFO ] [.openhab.core.model.script.Wind diag] - Timestamp Wind Max5 2022-04-06T22:59:20.043624+02:00[Europe/Berlin]
2022-04-06 22:59:20.048 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 wind was: 6.12
2022-04-06 22:59:20.051 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 occurred at 2022-04-06T22:59:20.051067+02:00[Europe/Berlin]
2022-04-06 22:59:20.058 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 value 5 mins ago was: 0.0
2022-04-06 22:59:20.060 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 Wind record from  2022-04-06T22:30:00.780+02:00[Europe/Berlin]
2022-04-06 22:59:20.051 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_Max5' changed from 10.44 to 6.12
2022-04-06 22:59:26.568 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime Wind Max5 2022-04-06T22:54:26.565942+02:00[Europe/Berlin]
2022-04-06 22:59:26.576 [INFO ] [.openhab.core.model.script.Wind diag] - Value Wind Max5 7.5600000000000005
2022-04-06 22:59:26.579 [INFO ] [.openhab.core.model.script.Wind diag] - Timestamp Wind Max5 2022-04-06T22:59:26.578408+02:00[Europe/Berlin]
2022-04-06 22:59:26.590 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 wind was: 7.5600000000000005
2022-04-06 22:59:26.594 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 occurred at 2022-04-06T22:59:26.593471+02:00[Europe/Berlin]
2022-04-06 22:59:26.602 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 value 5 mins ago was: 0.0
2022-04-06 22:59:26.606 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 Wind record from  2022-04-06T22:30:00.780+02:00[Europe/Berlin]
2022-04-06 22:59:26.586 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_Max5' changed from 6.12 to 7.5600000000000005
2022-04-06 22:59:33.967 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime Wind Max5 2022-04-06T22:54:33.966381+02:00[Europe/Berlin]
2022-04-06 22:59:33.976 [INFO ] [.openhab.core.model.script.Wind diag] - Value Wind Max5 5.76
2022-04-06 22:59:33.979 [INFO ] [.openhab.core.model.script.Wind diag] - Timestamp Wind Max5 2022-04-06T22:59:33.978982+02:00[Europe/Berlin]
2022-04-06 22:59:33.985 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 wind was: 5.76
2022-04-06 22:59:33.988 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 occurred at 2022-04-06T22:59:33.988317+02:00[Europe/Berlin]
2022-04-06 22:59:33.999 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 value 5 mins ago was: 0.0
2022-04-06 22:59:34.002 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 Wind record from  2022-04-06T22:30:00.780+02:00[Europe/Berlin]
2022-04-06 22:59:33.984 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_Max5' changed from 7.5600000000000005 to 5.76
2022-04-06 22:59:38.302 [INFO ] [.openhab.core.model.script.Wind diag] - Using datetime Wind Max5 2022-04-06T22:54:38.300274+02:00[Europe/Berlin]
2022-04-06 22:59:38.309 [INFO ] [.openhab.core.model.script.Wind diag] - Value Wind Max5 0.0
2022-04-06 22:59:38.311 [INFO ] [.openhab.core.model.script.Wind diag] - Timestamp Wind Max5 2022-04-06T22:59:38.310835+02:00[Europe/Berlin]
2022-04-06 22:59:38.314 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 wind was: 0.0
2022-04-06 22:59:38.317 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 occurred at 2022-04-06T22:59:38.317122+02:00[Europe/Berlin]
2022-04-06 22:59:38.323 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 value 5 mins ago was: 0.0
2022-04-06 22:59:38.326 [INFO ] [core.model.script.Wind Maximumsince5] - Max5 Wind record from  2022-04-06T22:30:00.780+02:00[Europe/Berlin]
2022-04-06 22:59:38.317 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'AT_Dachflache_Wind_Max5' changed from 5.76 to 0.0

The result of that would be that the maximum of the last five minutes is … the current value. (There is no other data available for the last five minutes. historicState() will search backwards to last record whenever … but maximumSince() will not I think)

Sounds like you are not persisting the Item you are querying in the database you are looking at.
When checking data using REST API, don’t forget that needs to be told which database to look in too.

I guess that was the solution, @rossko57. I checked my persistence file again and found a mistake:

I had persisted all weather measurements, including wind, with every30Minutes. For wind explicitely I only persisted all max values (5 mins., 1 hour, all day) with

   AT_Dachflache_Wind_* : strategy = everyChange

However, the original measurement for the item AT_Dachflache_Wind was not stored on everyChange (notice the underscore in the strategy).

Now I went with

   AT_Dachflache_Wind : strategy = everyChange

and my database gets filled with values. I guess that all the suggestions you all made along the way helped to fix errors but as it looks this was the last missing piece of the puzzle.
Thank you all for your support. I will mark this post as the solution and I hope that this thread will help others who are working with maximumSince.

Careful with persist configuration. That is NOT a wildcard in this context. It means to persist all members of a Group named AT_Dachflache_Wind_ , and I will bet you do not even have a Group Item named exactly that.

This is in the docs.

Thank you. You are right. I meant to use it as a wild card.