Some more logInfo() would have been useful to establish progress and sensible value being returned, you can see how to do this, but let’s go with what we’ve got.
Let’s have a tidy up here, you only need to do the maximumSince once.
Max = Temperatur_Udebygninger_Carportnord.maximumSince(now.with(LocalTime.MAX, “rrd4j”).state as DecimalType )
df = new SimpleDateFormat( “HH:mm” )
tmp = (Math::round(Max.floatValue</em> 10.0)/10.0) + " °C (” + df.format(Max.timestamp) + “)”)
Now it’s bit clearer to see what is going on in this part.
First thing I see is wrong quotemark types. That may be an artefact of copy-pasting, I can’t tell because you have not used code fences, but let’s fix it.
Next thing is the df=
, you already did that at the beginning of the rule and it has not changed, so no need to do it again just leave it out.
Max = Temperatur_Udebygninger_Carportnord.maximumSince(now.with(LocalTime.MAX, “rrd4j”).state as DecimalType )
tmp = (Math::round(Max.floatValue</em> 10.0)/10.0) + " °C (" + df.format(Max.timestamp) + ")")
Next thing is this
tmp = (Math::round(Max.floatValue10.0)/10.0) ...
What’s the floatValue10.0? Is that a copy-paste error? Is this really where the previous brackets error came from?
Let’s guess it’s supposed to be
tmp = (Math::round(Max.floatValue/10.0) + " °C (" + df.format(Max.timestamp) + ")")
Alright, so something going wrong to do with DateTime
so that has to be failing in
df.format(Max.timestamp)
The log also shows us the string that we get from persistence timestamp
2021-01-26T06:43:01.603275+01:00[Europe/Copenhagen]
That looks like a zonedDateTime to me, and I think you’ll need a different formatter to get your “HH:MM”. I really don’t know.
Change of times was one of the OH3 changes, due to Java 11 changes.