Node-RED as a rule/script engine for openHAB

Have a look at this and the discussion in the posts above it:

There is a few different ways to do it