What I’m trying to do is whenever I receive a message in mqtt, I want to use exec transformation to run lets say a python script which turns the item state to uppercase and updates item (or updates to another item)
how do I pass %s to a python program and how do I read that in the python script? where do I place this exec command in the gui?
Using the exec transformation for this is indeed way overkill. It’s super slow and really heavy weight since it has to spin up a whole separate program.
It’s not clear what you mean by “how do I pass %s to a python program”. From openHAB’s side, it’s pretty straight forward. The %s gets replaced with the contents of the string to be transformed. From the Python side, you need to research how to process command line arguments in a Python program which is out of scope for this forum really.
If all you are looking for is a to upper, you can use JS:|input.toUpperCase() as the transformation using the JavaScript Transformation’s inline script capability. Note instead of passing the file name use | to tell it that it’s an inline script and the incoming string is input.
I actually would love to use JS but I’m using certain node libraries that didn’t work for me using js scripiting on opennhab…that’s why I thought it might be easier to just call a script using exec and let the script do whatever it wants and return the value I need using whatever libraries it needs
I used js transform, I just wanted to see how the calling a separate script thing works…because I’ll have to use some libraries that aren’t supported in oh js scripting i think (some node libraries)…so I thought it’d be easier to have an independent program use the libraries it needs and just pass and input and get the output using openhab