I’m coming close to giving up here. I’m using OH3.
My plan is simple: save the current time upon change (in an item); next change, compare and do things
I’m finding all sorts of info but it would seem the OH2 code no longer works for OH3.
First, how do I save the current time to an Item which later on I can use for comparing?
How do I compare if three hours have passed since latest update?
Do I save this as a number (seconds since epoch) and then compare it later?
Do I use this DateTimeType thing?
This all seems a bit overly complex for a reasonably common question I presume.
Search the forum before asking please.
That doesn’t solve my issue or either I’m missing it but.
How do I compare a date stored in an item.
And what kind of item would I use, datetime, number for seconds…
I get I could use now.isBefore but that doesn’t work with for example mydatetimeitem.state.
You first have to convert both comparison arguments to have the same type, see conversion post.
Then depending on type use .isBefore or >
You might find some clues here