- Platform information:
- Hardware: RPI4 4GB
- OS: openHABian
- openHAB version: 3.2.0 - Release Build
- Rules code related to the issue
Hi all, sorry for this post, but I am searching and reading now since 7 hours. Need help, please.
I’d like to write the max. value of wind speed and the time when it occurred within 8 hours back, to a string item within a rule.
Persistence and everything is working, I am persisting wind speed into a MariaDB.
Therefore in order to read the state and timestamp, I am using maximumSince.
Please find the rule:
var String strMaxWind = ""
rule "Maximale Windgeschwindigkeit der letzten 8h"
when
Item Windgeschwindigkeit changed
then
strMaxWind = Windgeschwindigkeit.maximumSince(now.minusHours(8)).state.toString + " um " + Windgeschwindigkeit.maximumSince(now.minusHours(8)).getTimestamp().toString
maxWindgeschwindigkeit.sendCommand(strMaxWind)
// logInfo("max. Windgeschwindigkeit", Windgeschwindigkeit.maximumSince(now.minusHours(8)).getTimestamp().toString)
// logInfo("max. Windgeschwindigkeit", Windgeschwindigkeit.maximumSince(now.minusHours(8)).state.toString)
end
The result I get is:
2022-06-08 18:40:35.969 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'maxWindgeschwindigkeit' received command 6 m/s um 2022-06-08T18:24:46.066+02:00[Europe/Berlin]
But what I would like to have is:
2022-06-08 18:40:35.969 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'maxWindgeschwindigkeit' received command 6 m/s um 18:24:46
Can someone please help me to extract 18:24:46 out of 2022-06-08T18:24:46.066+02:00[Europe/Berlin] ?