Actions are available in all languages. There are examples in the But How Do I section of the Jython Helper Library docs for how to access the Action, but the call is the same once you have access to them.
That’s the old site which has been dead since OH 3 came out. You need to go to CrazyIvan359’s fork of that repo and look at those docs. You should be using the helper library from there too. If that doesn’t work I’ve nothing to recommend. I haven’t used Jython in many years now.
Note, of all the parts of openHAB that are at risk of just stopping to work suddenly at some point in the not to distant future, Jython support is the most likely. The upstream repo for Jython itself is all but abandoned. It’s been two years since the last merge to the openHAB Helper Library. And no one is maintaining the add-on.
I recommend anyone still using Jython to take this time you have now where it still works and gradually migrate to anything else. when Jython breaks you’ll have to do it all at once.
If you like python you can always try HABApp.
It’s a python3 rule engine that allows you to use any python library with openHAB.
You can install it besides your existing rules and play around with it.
You even can install it on a different machine to play around with it and connect to openHAB remotely.
It also provides full syntax highlighting and error checks in the IDE.
It’s awesome!
Hi @Spaceman_Spiff, I actually already have HABApp installed and use it extensively - especially as it nicely used Python3 and not Python2 - but also there I didn’t find a good way to re-use my mapping tables defined in $OPENHAB_CONF/transform that I need for the UI.
Do you have a proposal how to combine the two mapping requirements best?
I guess I could build something which exposes HABApp parameter files as a map transformation?
Or something that loads the mappings and exposes them as a dict.
Currently there is no easy solution.
It shouldn’t bee too hard to write a function that takes a filename and a string to transform as arguments, read and parse the file into a dict and then return the result. I haven’t used habapp personally, but I believe plain python functions should be straightforward to use.
It should become supported when the REST API for Actions gets merged (though I already had actually), right? Or does that end point only support Thing Actions?
However doing the request every time is not ideal performance wise.
So at least for the MAP transformation it makes sense to either
create the mapping from openHAB on the HABApp side
mirror a HABApp parameter file so it’s available as a mapping in openHAB
I haven’t made up my mind yet which makes the most sense to be honest.
The second one seems to make more sense because there is no notification when the transformation changes so it’s easier to keep things in sync.
@Schrott.Micha I’ve added support for transformations in the current dev branch. Maybe you can try it out and give some feedback? If so it would be best if you open a github issue.
Do you think it would make sense to also mirror parameter files from HABApp to openHAB (as transformations)?