Rule to postUpdate an Item works but Item falls back after some seconds

That’s not what autoupdate does.
Example: autoupdate=false will stop (say) a rule-generated myswitch.sendCommand(ON) from setting the Item state to ON automatically by Openhab.
If the binding of the switch receives an update from the hardware that the switch is really now on, the Item still gets updated by the binding.

So autoupdate=false allows you to monitor the actual state of device, while autoupdate=true allows more faster display of the expected state in a sitemap.
In your case the tinkerforge binding will tell you the real state of the contact at next refresh.

I don’t fully understand what problem you have here, but it sounds a bit like something I had to do with my hardware. That is Modbus, but similar idea.

  • A Switch Item simulates a push on - push off button controlling a light.
  • A Contact Item monitors the actual state of the light.
  • Users can use real buttons to turn on/off independently of OH.
  • The real buttons are not monitored by OH.
    I wanted motion-activated lights with timers, but overridden by users pressing buttons.

I set up three Items -
A Switch bound to the “pushbutton” output
A Contact bound to the “light monitor” input
A Switch bound to nothing, “proxy”, representing OH’s expected light state. (this is the one to put on your sitemap)

Then some rules -

** Triggered by a command to “proxy”, either ON or OFF, compare the command with the current “light monitor” - if they don’t match, turn ON the “pushbutton” output, simulating a press. If they do already match, obviously we do nothing.

** Triggered by a change in “light monitor” input, check the state of “pushbutton”
If “pushbutton” is ON, this was a OH triggered change in the light, so we can now release (command OFF) the pushbutton.
Else if “pushbutton” is OFF, this was a user button press change. We just update (not command) the proxy to reflect the new light state.

Motion detection rules and timers do not operate the real switch, they send commands to the “proxy” instead.

My rules are more complicated, with another non-bound Item representing “Manual override” which gets set in the second rule, and uses a timer to unset itself after an hour or so. While “Manual” is set, the motion detections and any timers they start etc. do not activate the light (a simple check in the first rule).

2 Likes