This automation bundle is openHAB-JSSR223 compliant and allows you to write your script in Java.
Alpha release, no “published” tag. Published ! Many thanks to you if you want to test.
Comments welcome.
(For the why and the history, see the second post below.)
Main feature:
- full JSR 223 support (use in files, in GUI, transformations, inline rule action, etc…)
- auto injection of OpenHAB variable/preset for simplicity
- library support for sharing code (.jar and .java)
- rule annotations available in the helper library for creating rules the easiest way
- helper library files auto generation for items, things, and actions, with strong typing and ease of use
- ultra fast executions after the first compilation (sub millisecond overload)
- no boilerplate code for simple script: you can do a one liner script, as declaring a class and a method is optional.
- optional reuse of instances script to share values between execution occurrences
- designed to be easily used with your favorite IDE, with very little configuration
How to use it ? See documentation on the last link of this post.
Changelog
Version BETA5
Special thanks to user dpa-openhab for his comments, and his many pull requests on code and on documentation
Warning : target openHAB 5.1. Should (?) work on 5.0.X though.
- fix small bug with dependency ordering
- fix some compiler warning
- remove some unused internal package from dependencies
- rewrite/fix many things on the readme
- fix generated code typo and readability
- remove unused generated action file
- adding/rewriting some log
- adding more dynamic code generation (bindings declaration are automatically generated from - context, not written “one for once” in the template)
- adding si unit package in available import
- using enum value is now easier (no import needed for bare one-liner script)
- adding the generated class EnumStrings to have all enum as a static string form, making it possible to reference it from annotation
- BREAKING removing metadataRegistry from the parent java223script class : it is now avalaible in the “provider” preset
- generated rule uuid are now predictible and stable
- fixing an issue with deleting action files.
- Setting the read only property on a file is now a way to prevent the bundle from regenerating it
- generated action file now have meaningfull parameters name
- debouncing feature by annotation (alpha, not well tested)
Version BETA4
- remove custom caching system to use openHAB’s one
- fix error when using one line script with no helper lib
- workaround an openHAB bug when starting the bundle after a “clean cache” operation
- delete auto generated helper library when the related parameter is disabled
Version BETA3
- openHAB 5 support
- Add a boolean to enable/disable helper lib generation
- fix : bad detection of library deletion and regeneration if needed
Version BETA2
- fix: remove generic parameters in generated getMethod() reflection call (thanks Ardanedh)
- fix: Wrong ChannelEvent parameter type
- new parameter (startupGuardTime) for delaying helper generation at startup if the file already exists
Version BETA1
- makes action initialization more reliable
- allow custom rule uid
- accomodate around the new openHAB functionnality “compile once” by still allowing cache invalidation when a lib changes
Version ALPHA1
- initial release


