Caveat: I have a lot of sympathy / interest in the idea that AI may be bad for humanity overall; negative dialectics, job displacement, hallucinations/unreliability, loss of authenticity, environmental reasons, etc. Personally I am open-minded about the technology itself, but have a huge sense of impending doom about the way I absolutely know it will cause concentration of political power, to our detriment... - Now that's out of the way;
To what extent do people here use AI with Node-RED?
I have just installed Claude code on my node red server [CORRECTION: it installed itself on my server when I asked it to
] and today I've allowed it (with manual checks first) to edit my flows.json, specifically finding new issues and edge cases in my existing flows / function code etc but also authoring new flows. It handles the whole thing from stopping and restarting Node-RED via systemctl, reminding me to close the Node-RED editor window each time (!) and to be honest I'm half impressed and half horrified by the whole experience.
Has anyone else gone down this route?
I have created a clear set of guide rails for Claude to follow at every prompt:
- always respond first without implementing changes, to provide me with an exec summary of how you understood the task, which nodes you think need touching, and how you propose achieving the change
- use sparse but concise comments throughout
- personally I prefer more verbose code (so avoid spreader operators, favour sequential-like coding style)
- always follow existing level of code compactness / style of code
- never read/write to node/flow/global context without first telling me why and what data you plan to store there so I can ensure it makes sense to me first
- always trace flows from the thing that preceded it, to ensure data is in the format you expect, because I can be quite random when I code and make assumptions. This includes MQTT messages: all MQTT endpoints (subscribers and publishers) are, in my case, within Node-RED, HomeAssistant, or Zigbee2MQTT and so in 9 times out of 10 trace back the source of the MQTT message and ensure you understand the data format. If in doubt, reflect it back to me before proposing solution
- with external code (e.g. uibuilder) please make changes directly without prompting me first
With the above in mind, and the fact I have daily full server backups plus an hourly zipped backup of flows.json and global context, I'm quite relaxed about it.
In case anyone is interested, my journey to this point:
-
I don't consider myself a very good coder, but I do consider myself extremely fussy about UIs, an over-engineerer, and an OCD software tester. I learned to code from a young age and also from an academic perspective (comp science undergrad) but to be honest I'm lazy as hell and I care more about the result than the process.
-
I started with Copilot (because I kept hitting limits with ChatGPT, and Copilot right now doesn't seem to have any limits whatsoever for the free version), but it was such a ballache as I used Copilot in VSS - just in a web interface, so all the changes were a case of me copy/pasting blocks of code. This had a massive propensity for error (probably human error) but also the web UI for Copilot was genuinely awful, it would often fail to render text / code at all, requiring constant refreshing, re-scrolling to the point where you started typing, etc. Also it would regularly just forget my directions, and so I had to keep a running copy of text I appended to every prompt (e.g. house coding style, how to speak to me, etc...) and even then it just forgot, regularly. I realised later that one must reset the context window FAR more often than I was, but starting a new conversation. But still - annoying for me. I'm sure Copilot in Github or VSS is much better but I couldn't get my head around it personally.
-
I moved onto Claude and was immediately struck by how it took a copy of the whole file, stored it in memory, then edited that copy, spawned a side window, and just presented it back to me. No more find and replace. First time I tried this, I copy/pasted a 1200+ line JS file thinking "this will break my app" and it had succeeded in every task I asked for. I then cued-up a set of 20 code changes by just describing what I wanted to see in the UI, tested it... suffice to say I got my credit card out within about 10 mins of testing the result.
I then thought "why should I paste the contents of my function node in and spend ages describing how it's wired up"? So I just dumped an exported JSON file for a whole flow, told it to find the problem with barely any other prompt, and within seconds it had pointed me towards a rookie coding error I'd made and showed me how to fix it. Then I asked it to extract the function node code and present me with the updated result. Finally, of course - authoring new nodes, it does with ease.
-
So until today I have been working like the above. I had massively scaled-up the kinds of things I had been able to do... as in, I write almost 2 pages of A4 of ideas, long rambling un-structured messages containing my observation of bugs, desires for improving things, checking edge cases etc., and dump it in the prompt. Within minutes it has kind of clarified my ideas (at my request), reflected back to me its understanding of what I am asking for, and provided me with things I had not considered, and within minutes I have a working copy of my ideas in a UI or whatever. I honestly think that I can do in an evening what it would take a team of people to do 10 years ago in about 3 days. For me - I've no guilt about this because it's a hobby, and I'm not employing anyone who would be put out of business. But this has been the "horrifying" part of it for me.
-
Today was my next step in automating the above. Again slightly horrifying, I literally pressed "connect SSH" and typed the IP and user for my Node-RED instance. (I had forgotten that I'd previously generated a key pair and uploaded the private key to my Node-RED server, and of course ANY application in Windows can therefore login automatically without prompting for a password
) so it just installed Claude CLI directly itself without my needing to do anything. Okkkkay so it has root on my Node-RED server. This can't be a good idea.
I persisted and as you can imagine my first thought was "can it just read all my flows, my entire global context at a point in time, and reliably troubleshoot / author new ones / make changes etc." and after a couple of hours testing my answer is: yes.
So far I've seen nearly zero hallucination with Claude. Lots of mistakes yes, but they are mistakes that are comprehensible to me, furthermore I am convinced that 99% of mistakes stem from my own contradictions or inability to express myself properly. To that end I've started to get it to just reflect back to me its understanding of my request, providing more detail and challenging my ideas before starting to even do any work to write code etc. Usually this brings out issues that I hadn't thought of, just enough to get it to a point where I'm happy to hit "go".
Basically, I see it like a driverless car. You must remain alert at all times.
So a few screenshots showing the kinds of things I'm talking about that I couldn't possibly have done due to time constraints. All of this in Node-RED and uibuilder.
Music player (integrates with Lyrion Music Server - no 3rd party addons just TCP node and HTML/CSS/JS):
Climate card:
Audio card:



