Simultaneous calling of script problem

openHAB 3.3.0 Release Build


I have a separate script for sending notifications through PushBullet.

Today two different rules called this script at the same time resulting in only one notification and an [ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule ‘Pushbullet’ with status ‘RUNNING’

Any way to avoid/work around this?

Not super easily but it’s possible.

  1. Create a String Item to contain your messages to Pushbullet.
  2. Create a rule that triggers when that String Item receives a command. This is the only place where a call to the Pushbullet action is allowed. Call the action to send the command sent to the String Item as the message.
  3. Everywhere where you want to send a Pushbullet message instead send a command to the String Item.

In OH 3 each rule only gets one thread. If the rule is running and gets triggered again, that second trigger will be queued up and worked off in sequence. Because this rule is the only place that can call Pushbullet, that will ensure that Pushbullet can never be called more than once at the same time.

Edit: Note, if you were to create a Script and try to call that Script from your rules, or create a rule and call that from your rules (a Script is just a special case of a rule) that will not work because the called rule uses the thread from the calling rule. As a result you could still have Pushbullet being called more than once at a time.