Http request is async and I want to wait for the response (promise)

At a high level the work around is to not have Thread::sleep longer than half a second or long running calls (e.g. executeCommandLine for a long running command) in your rules. So use the HTTP binding or Exec binding instead.

If you can’t do that then you need to restructure what you are doing to:

  • use Timers
  • split the logic into multiple rules and instead of waiting in the one rule, generate an event that can trigger a second rule to do the rest of the work
  • find a different approach entirely that doesn’t require the wait (e.g. move the call to the command line to a script that runs independent of OH and publishes the results to OH through the REST API or MQTT

Really, the correct solution depends heavily on what you are trying to accomplish. There is no one workaround.