ioBroker.javascript icon indicating copy to clipboard operation
ioBroker.javascript copied to clipboard

Get once trigger in blockly

Open ldittmar81 opened this issue 2 years ago • 2 comments

It would be great to have a once trigger in blockly to do something like:

try to close the blind... ohh... its unreach.... then wait till is reachable an than close the blind.

let subscription = on({ id: [].concat(['alias.0.Büro.Rollladen.UNREACH']), val: false }, async (obj) => { now close the blind unsubscribe(subscription); });

blockly

ldittmar81 avatar Nov 17 '23 10:11 ldittmar81

Maybe we can add a stopTrigger blockly. Than all triggers must have a name and every new trigger creates a stopTrigger block. Like variables or so.... Than you can stop a trigger from everywhere.

ldittmar81 avatar Nov 17 '23 12:11 ldittmar81

That feature is already implemented in JavaScript / Sandbox, but not documented. TODO:

  • Add documentation
  • Add Blockly block for once

https://github.com/ioBroker/ioBroker.javascript/blob/a0eaa96c2e4398064dfe521bb27c84d8fc765843/lib/sandbox.js#L1479-L1497

klein0r avatar Dec 22 '23 11:12 klein0r