I want to run the script by pressing a button in HABPanel. I read that I need to define an item and a rule that triggers when the item is changed and then connect the new item to a button in HABPanel.
However I seem to be missing a step or have made a mistake or missed a step. Could someone give me a step by step description of what I need to do, including which type the Item should have, etc. (or if there’s a simpler way to trigger the script)
Create the Item. Could be anything but a Switch make se sense. See Semantic Model | openHAB for several ways to do that through MainUI.
Create an “advanced” rule: Rules - Advanced | openHAB. You will create a trigger that runs the rule when your Item created in 1 receives an ON command (assuming you chose a Switch). You’ll create a Script Action and put the code above into that script action. That’s the code that will be run when the Rule is triggered.
Create your whatever in HABPanel that sends an ON command to the Item created in 1 when it’s clicked.