Date/time format wrong

OH 4.3 snapshot

Hello again
I get this json data from rtl_433 via mqtt server

{
  "time": "2024-08-30 03:29:41",
  "model": "inFactory-TH",
  "id": 77,
  "channel": 1,
  "battery_ok": 1,
  "button": 0,
  "temperature_F": 64.5,
  "humidity": 80,
  "mic": "CRC"
}

Reading the time data creates a warning


2024-08-29 13:10:55.561 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '2024-08-29 11:10:54' from channel 'mqtt:topic:MQTT_NAS:LS11:LS11_zuletztGesehen' not supported by type 'DateTimeValue': 2024-08-29 11:10:54 is not in a valid format

Whatā€˜s wrong with this data

Try regex transform s/ /T/

I canā€˜t select regex profil for date/time items

Did you install the RegEx Transformation add-on?

You can set the transformation pattern on the Mqtt thing channel, not profile

Regex transformation is installed
Unfortunately I need some help for regex command, haveā€™nt used it before.

Thats what I have for incoming value transformation, and whatā€™s needed for regex

jsonpath:$.time  āˆ© 

Thatā€™s it. Put the regex I showed above at the end of it

That creates configuration error


JSONPATH:$.time āˆ©  regex transform s/ /T/


2024-08-30 15:36:03.970 [WARN ] [rnal.handler.GenericMQTTThingHandler] - Configuration error for channel 'mqtt:topic:MQTT_NAS:LS11:LS11_ZuletztGesehen'
java.lang.IllegalArgumentException: The transformation pattern must consist of the type and the pattern separated by a colon
	at org.openhab.binding.mqtt.generic.ChannelStateTransformation.<init>(ChannelStateTransformation.java:50) ~[bundleFile:?]

JSONPATH:$.timeāˆ©REGEX:s/ /T/

Thank you, it works. I tried that before but with blanks in between. It said, REGEX not found.

If this gets merged into 4.3, you can have spaces in there, or even specify it in multiple lines in UI without that intersection symbol.

1 Like

Iā€™ve also submitted this PR so that core can just parse yyyy-MM-dd HH:mm without us needing to add a ā€œTā€ between the date and the time part

2 Likes

Multiple lines for commands on incoming value transformation works great in oh 4.3 4255

1 Like