[SOLVED] Is it possible to set DateTime item to specific value without a rule

Normally I get this item set through binding but I want to set it manually for testing my rules (OH is at remote location, I cannot trigger the rule physically).

I’ve tried to set it via keraf console
openhab> smarthome:update UpperCorridorLastMotion DateTime("2020-01-06T18:03:56.771+0300")
or

openhab> smarthome:update UpperCorridorLastMotion DateTimeType.ofValue("2020-01-06T18:03:56.771+0300")

Nothing worked. I get

Error: State 'DateTime(2020-01-06T18:03:56.771+0300)' is not valid for item 'UpperCorridorLastMotion'
Valid data types are: ( DateTimeType UnDefType )

I can create some dummy rule to fire the hardcoded update but is it possible to do it without a rule (through console or UI)?

It’s not a Java DateTime.
Just send it the string.

Have you seen the REST API ?
It’s useful for setting and inspecting arbitrary Items for testing.

1 Like

REST API really helped! thanks!