Built-in "deactivate binding" in OH3-rules

I’m running openHAB3 and having some problems with a binding, which regularly irregularly runs into an error. I then can either turn off the device, restart it and the binding would go Online again, or I can stop the binding, wait for a few minutes and restart it with the same effect. (I suspect some kind of overflow within the device).

So, my use case for a rule would be:

  1. check the binding’s status
  2. if it is “ERROR” - deactivate the binding
  3. wait for a few minutes
  4. restart the binding

So, is there a way to achieve this with built-in logic within a OH3-rule?

Not entirely. You can trigger the rule when the Thing enters an error state. You can wait a few minutes. But you’ll have to resort to executeCommandLine or the Exec binding to log into the karaf console and issue the commands to stop and restart the binding.

So it’s very doable, just not all within a rule.

1 Like

How can I check the Thing’s error state anyways?

See-

1 Like

oh!!! I never read “thing based triggers”… Thanks for pointing that out!

one more thing:
How can I reference the Thing state within a ECMA-Rule?
There’s event.itemState but event.thingState doesn’t work (=is undefined)

Note that Things have status but not state.
What you get in an event depends on the event, i.e. what is your rule trigger?
There is some stuff here -