The Girder home automation software has some strong capabilities to customize it. One of those is Tree Script. It lets you add your own actions and conditionals based on Lua scripts. Unfortunately, Girder also has an extremely steep learning curve.
To ease the learning curve, I created a treescript plugin template that enables a fill-in-the-blanks approach to creating your own actions and conditionals. Its a Lua code file and an xml file that represents the interface.
You can download it from the Girder page.