Stop/exit infinite rule loop

I have a Blocky rule which is in an infinite while loop… :grinning_face:
I know I can restart OH to fix it, but how can I properly stop a running rule via cli, api… ?

From MainUI you can navigate to the rule and click the pause button.

You can temporarily create a rule with an action to disable the rule.

But both of these presuppose that the UI is responsive.

From the karaf console you can see if there is an undocumented command to disable a rule. There is a command to run a rule. You can use openhab:script help (or maybe put the “help” in front, I’m not in a place where I can test this).

If MainUI isn’t responsive the REST API might not work either, but the following curl command should disable a rule.

curl -X 'POST' \
  'https://path-to-oh:8080/rest/rules/ruleUID/enable' \
  -H 'accept: */*' \
  -H 'Content-Type: text/plain' \
  -H 'X-OPENHAB-TOKEN: token' \
  -d 'false'

where “path-to-oh” is the IP address or hostname of your OH, “ruleUID” is the UUID of the rule, and “token” is your auth token. If you haven’t set up an auth token and you might be able to use basic auth instead. If you haven’t enabledv that you are out is luck using the REST API for this.

What is the difference to using

Authorization: bearer token

I don’t know. That’s the curl command reported by the API Explorer but I’m accessing that through myopenhab.org.

1 Like