Hi,
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"
when
Item rfbr_sync received update
then
door1.postUpdate(CurrentTime.state)
end
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?
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.
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