[SOLVED] Rules - OH2.5 vs OH3

Rules - OH2.5 vs OH3

I just did a fresh installation of OH3. Previously used OH2.5.
I had a rule in my OH2.5 installation, that captured the timestamp of when the temperature were last updated, and it worked fine. I cannot get that to work in OH3. Any suggestions?

Another question, Is it possible to take the old rule files (from OH2.5) that where located in the rules folder and copy-paste them to a folder in OH3. So I do not need to re-write all rules?

Manually created items:

DateTime ZWaveNode013ZW100Multisensor6SensorTemperatureLastRecievedDateTime “[%1$tY-%1$tm-%1$td %1$tH:%1$tM]”
DateTime LocalDateTime “Tid och datum [%1$tY-%1$tm-%1$td, %1$tA %1$tH:%1$tM]” { channel=“ntp:ntp:local:dateTime” }

OH2.5 rules

rule “Temperature sensor 13 updated”
Item ZWaveNode013ZW100Multisensor6SensorTemperature changed

When: ZWaveTempSensorTemperature changed
Item = ZWaveNode013ZW100Multisensor6SensorTemperatureLastRecievedDateTime
Command: LocalDateTime.state


2021-04-30 07:43:14.531 [WARN ] [ule.handler.ItemCommandActionHandler] - Command ‘LocalDateTime.State’ is not valid for item ‘ZWaveNode013ZW100Multisensor6SensorTemperatureLastRecievedDateTime’.

As mentioned in the Release Notes and here time functions changed in the move to Java 11. If you look at the documentation and search here you should find tips to assist.

in OH3 you don’t even need a rule for that anymore. You can add a DateTime Item to your channel you use for your ZWaveNode013ZW100Multisensor6SensorTemperature and use the timestamp profile to configure to update with any update or any change.

Thanks for the tip.

I Played around and tried this, not sure if I got it right… Well something is working and something is not. I changed sensor, so sorry for the confusion

I am capturing the time correct, but not able to show it (I think).

Any clue why I get the time, but it is shown ass ERR?

The timedate item (seems OK):

The link in the channel (sems NOK):

The log:

The basicapp UI:

It’s a bug in the profiles mechanism. Some bindings (like zwave) offer a default format for Item state,passing it across the channel. If you apply a profile to the channel, the framework foolishly applies that default format to the output of the profile.
Obviously it can’t format a datetime with %.1f

Back to the rule for now, I think.

can you not overwrite in this case with a meta data pattern to change the displayState at least?

%1$td.%1$tm.%1$tY, %1$tH:%1$tM Uhr

Try it, be interested in the result.

I am little bit unsure, what do I need to do to this meta data pattern?

with each item you can define meta data. one segment is called state description. If you enter the above string, the output gets formatted.

I tried and it worked! THANKS!


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.