What's the reason for scripts? When do you use scripts?

I try to find a reason to use a script (openHAB-Xtend-Scripts, not shell scripts). Currently i use many rules and my script folder is totally empty.

  • the language is the same as the rules language
  • parameters are not supported

So, if i need the exact same code fragment in two different rules, i can use scripts. But in what kind of use case does this make sense? There maybe some, but i can’t think of any. At best, the scripts could be used as something like scenes, to keep the rules a bit more clean. But is that all?

What are your script examples? I am interested how you use the scripts.

Thanks for any input.

After some time, i discovered some ideas:

good question… i only have scripts calculating some physics like absolute humidity. Calculations that may never change and don’t belong to your rules code, but indeed, good question :slight_smile:

1 Like

I have been struggling with the same question. Not having the possibility to pass parameters is making scripts a bit lame.
The only reason I see for using scripts is when you have different kind of triggers, but the same logic.
And another use case would be when you have different kinds of pre and post-processing around the same block of logic.

1 Like

Looks like scripts are rarely used. :wink:
If even at all.

accessing the system that is running openhab / command line code/bash items that provide other tools

After some time, i discovered some ideas: