Hey there, new to HA. I spent the last week or so setting up HA and toying around with Node-RED. I created a very convoluted flow that handles my motion sensors, but all throughout I kept asking myself why I couldn’t just write a bunch of JavaScript code to the same end. I am a programmer, so that would feel more natural to me, and most of the time I spent using Node-RED was actually me trying to wrangle its nodes and data flow to do what I wanted it to do. Storing state was a particularly difficult bit, I solved it by using the state machine node but it took a lot of tinkering. Debugging is another particularly painful story in my experience with Node-RED, as it’s hard to inspect exactly what you want to inspect or curate the debug messages that you get, unless you spend effort setting up and tearing down debug nodes.
If I could write the same code using JavaScript and the async/await pattern, I feel I’d end up more productive and with a resulting automation that is easier for me to inspect.
I tried searching around a bit, but I haven’t found much to this end. What I’m picturing is something just like Node-RED, where you can write scripts using a simple API that lets you access events and entities. I really love the simplicity of Node-RED where deploying a flow just takes a button click, something similar to that but with code would be awesome.
I imagine this all could be done by writing my own software and using the Websocket JS API but again that would require me to manage the scripts themselves, set them up and launch them as daemons, and manage their lifecycle if I have to update them or if something crashes. It’d all be easier with a “managed” approach similar to what Node-RED provides.
I wonder if anything like this exists for HA?