[groovyscripting] Described a way for code reuse (#16361)

Signed-off-by: Oleg Andreych <kjiec4@gmail.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Oleg Andreych 2024-02-04 15:22:02 +05:00 committed by Ciprian Pascu
parent 0c2b95e48f
commit 68fa26ce5d

View File

@ -21,6 +21,13 @@ log:set DEBUG org.openhab.core.automation
For more information on the available APIs in scripts see the [JSR223 Scripting]({{base}}/configuration/jsr223.html) documentation. For more information on the available APIs in scripts see the [JSR223 Scripting]({{base}}/configuration/jsr223.html) documentation.
## Code reuse
One can place *.groovy files with Groovy classes under `automation/groovy` configuration directory.
Those classes can be imported in JSR-223 scripts or the UI rules action with the usual Groovy `import` statement.
To apply shared code changes, one has to restart the `openHAB Core :: Bundles :: Automation` bundle on the Console or an openHAB instance altogether.
## Script Examples ## Script Examples
Groovy scripts provide access to almost all the functionality in an openHAB runtime environment. Groovy scripts provide access to almost all the functionality in an openHAB runtime environment.