Open Larsen-Locke opened 3 months ago
In the mean time you can use the inline script block.
myThing.setEnabled(false);
to disable.that's directly possible in JavaScript now? I thought you need the thing manager for that, like: myThingManager.setEnabled(UID, true). But anyway, the idea was meant to complete the capabilities of blocky for the "normal" user
that's directly possible in JavaScript now?
Yes. See https://www.openhab.org/addons/automation/jsscripting/#things. The "get thing" block pulls the Thing Object and you can simply call setEnabled(bool)
on the Thing Object to enable/disable. There's more you can do to it too. See the link.
But anyway, the idea was meant to complete the capabilities of blocky for the "normal" user
Agreed, but there is no telling when or if this will get implemented. Until it does, the approach above will work for you and anyone else who comes across this issue.
The problem
Currently it's not possible to change the enabled-status of a thing within blockly.
With the new blocks introduced in 4.2M3 it's possible to get various information about a thing. On top of that it would be a great feature if it was possible to enable and disable a thing. With this feature all things, even bridges could be disabled and enabled. (It's something that you usually do manually if a thing has a connection problem: You disable and enable it)
Your suggestion
Introduce a new block "set enabled/disabled [thing]" An alternative could be "toggle enabled-status [thing]"