Getting channel value in the rule

I’m having the following two items:
DateTime door1
DateTime CurrentTime “Date [%1$tA, %1$tm/%1$td/%1$tY %1$tT]” {channel=“ntp:ntp:local:dateTime”}
The second one is getting the current time using the NTP Binding (v.2.2.0) and it’s updated every minute.

So now I’m having the following rule:
rule "Front Door Update"
Item rfbr_sync received update

So this rule is not so accurate as I mentioned the CurrentTime.state value is updated every minute.

The question is can I update the door1 value with the exact time using the {channel=“ntp:ntp:local:dateTime”} directly in the rule?


I don’t know how accurate the NTP binding is, but why don’t you skip the NTP binding and get the date/time from the OS?

1 Like

And just to elaborate, you ARE effectively getting the value of the time straight from the channel. The Item references the state of the channel at all times and the binding only updates the channel once a minute.

1 Like

Thank you for update Rich, it’s clear now that the item and channel has the same value so there was a fault even in the initial idea.

Martin, I’ve tried your way but I’m getting the following error. Do you have an idea what could be the problem?

2018-01-05 11:40:10.868 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Front Door Update’: An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.postUpdate(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null

I am using the following for this exact purpose:

Entryway_Door_vContact_Timestamp.postUpdate(new DateTimeType())

This works well in my setup (openHAB 2.2).

Thanks Kjetil,
That works fine with me too.