AI Groovy Coding

I have seen many posts where folks are using AI to generate drivers and apps for HE. As I get older my desire to sit in front of a computer and write code is definitely waning. I am curious what AI Coding engines folks are having the best success with Hubitat Groovy coding.

Thanks in advance!

Not an expert in this, and have only played with it a few times to get a feel for their capabilities, but I've had the best luck with Claude Code, followed by Chat GPT (which is the base code for CoPilot), and Gemini. These are all more general in scope, and if you ask around I'm sure you'll find some that specialize in coding that could be better.

The thing to understand is that as they stand today most, of what we can use without dropping significant coin, will get us around 85% of the way there. The developer using it will still need to either work with the AI to further refine (my favorite trick is to have 2 to 3 other AIs critique the first), or carry the code the last 15%

I have used GPT 5.6- Luna, GPT 6.0-luna, and a few different qwen versions. Something you could consider is using a Agent system like Hermes to help with it. I took Hermes, connecte it to my dev hub live logging websocket, and ui and it was not only writing the code, but checking its functionality, and verifying logs to make sure it was doing everything I asked. Then I could also ask it to make improvements to the code and it would iterate it, and validate the changes. I was very impressed. I did that with GPT 5.6-luna while working on a zigbee driver for the Aqara FP400. Had a standard working driver pretty quick it stalled when it came to reverse engineering the proprietary zigbee clusters.

Local LLM's like Qwen3-coder can be nice if you have the memory to increase the context window. Otherwise hallucinations can be a problem.

Are you wanting a cloud based coding assistant or one you can keep completely local.

I used Claude to fix a old fibaro dimmer 2 driver that hadn't been touched fully since ST It took it fixed loads of things commented on each but of code. It asked questions and you keep feeding into the loop and now the driver is perfect.

After that I gave it a real challenge of creating a driver from scratch for the Legrand close up zigbee DALI advanced sensor. It has relays, DALI, heat presence sensor for up to 6 zones, VOC, noise, temperature, carbon and humidity. I gave it the clusters worked with it for about 20 mins and I have a fully supported driver for the device. It's amazing, that took dev team weeks to create a only partial supported driver on other systems.

I now use it to create load of things. Just sitting here thinking I might get it to create a driver builder for others to use :thinking:

Honestly haven’t put much thought into local but having a local assistant makes sense to access the hubs logs and iterate on its own.

I’ve been writing Groovy drivers and apps for over 10 years starting with ST and then switched to HE 8.5 years ago. There are a few enhancements I want to make and was curious if one AI engine is better than others for HE development. Several friends prefer Claude for coding with their work stuff as an example. I personally have a subscription with ChatGPT for other things and haven’t tried their Codex yet.

You have to remember there are different parts to what people think of when you talk about Local Assistants as a whole. In my case the local home stack consists of these parts.

  1. Ollama = Local LLM
  2. OpenWebUI = Local chat engine and ui
  3. Hermes = Local Agent

Ollama is what you use to load your Large Language Model. That is what we are generally referring to when we talk about GPT 5.x, or Claude Fable, or Gemini, or Qwen. These are what convert your written text into something the computer understands the meaning behind and then give you back words with meaning. It is a simple situation of you send a prompt and then it responds with text as a response.

OpenWebUI is basically a chat engine that keeps track of the prompts. It also has the ability to do other more advanced tasks like adding context, maintain a knowledge base and providing additional tools in encoded in the prompt or connecting to a MCP server like what Hubitat has locally now.

Hermes is a agent/harnnes. this what allows your prompt to start to do real multi-action work. When you give the Hermes Agent, tools or a MCP Server and a LLM it can perform multistage functions that can allow you to take a simple Prompt response conversation into fully automated responses. This is where Claude code or GPT Codex falls.

Prompt engineering is very important to getting good results. You also always need to consider the complexity of the task because if it gets to complicated and requires to much coding it is very possible the task can cause the LLM to hallucinate.

The biggest drawback to using Local LLM's at home is that they are still very memory intensive. You need a good amount of vram and likely system ram to load a large model that can be very useful. This is the list of the LLM's loaded on my Home server now for use. I probably use Qwen3.8 the most locally now. Most of these are MOE or Mixture of Export models which helps my home server provide a faster token rate. Most of my use case now is the top option of Qwen3.8 but before that i used Qwen3-coder for coding mostly.

The big advantage of using a cloud LLM is that it will generally iterate much faster because of cloud resources.

I used Chat GPT to help write/build my remake of Echo Speaks.

I have to say, this is great. Using it with Claude:

Thanks for the shout-out!

After extensively coding the mcp rule server and coding the HA counterpart, I can say that Claude Code is the best, Codex (ChatGPTs version ) is second best imo for coding. The problem is the AIs will, as a rule, ALWAYS mess things up and most importantly they will ALWAYS be confident that they were correct even when they weren't. This applies to every AI. It doesn't matter what task no matter how big or small, always expect them to make mistakes and you have to fix them, or have the AI iterate thru and fix the mistakes itself.

Now that's just the expectation to have, obviously sometimes they'll get things right, but if you go in with that mentality then you'll do better with it. I use sub agents to review my code and then I have other people review my code and things are always discovered. If you're an actual coder like for real then you'll have a much better time than me, just make sure to always review everything. It's just a tool, unfortunately not quite as autonomous as marketing wants you to think.

Thank you everyone for the feedback. This is definitely enlightening.

This is by far my biggest gripe with AI and also my biggest concern with the masses using it.

OMG yes...I've only made one driver via AI, but the repeating "Oh, NOW I know how to fix this..." followed by error after error went from funny to incredibly tiresome/annoying.

I recently got into woodworking and decided to let ChatGPT help me with a cut sheet so I could efficiently use the plywood I purchased. In many cases it was calculating cuts greater than 48x96 inches of my plywood and I kept telling its math was incorrect over and over again. Finally realized the free version had more hallucinations and is more forgetful. Of course once they had my monthly fee things are better.

Taking thinking outside the box to a new level...thinking outside the plywood. :wink: It's stuff like above that gives me hope that AI won't kill us all. They'll keep bombing Mars and wonder why we're still here. :wink:

It blows my mind that's so many people put so much faith in the ai, especially the people that will use screenshots of Google AI summaries as "evidence." Claude has gotten a little bit better with it, especially if you have good testing and whatnot, but still sometimes it will fake tests or modify tests so that they pass when they should still fail. Google / Gemini is by far the absolute worst, it also has gotten a little bit better, but I have literally gotten an arguments with it before and presented evidence that it was incorrect just to see what would happen, and it still would double down and insist that it was right. Usually with Claude if you give evidence it will concede.

This is largely centered around the quality of the model and its avaliable context size. Everyone free tier is probably ok for simple tasks but fall flat once you put any level of complexity to it. Once you put money into it you get access to much smarter models that handle much more complex tasks. Even on paid tiers you can see it in the price.

When you run local llms it is all about thr number of parameters and size of the model. That is why most of the ones you saw in my list we around 17-18gb and 30 billion parameters. That is about the minimum you can go for any real usefulness locally abd those will struggle.

Lol yeah, you reminded me of before I used MCP servers, there was this one home assistant automation that I spent probably 4 or 5 hours working through with gemini, every time it would name it something different usually some iteration of "Surefire version" and the very last one was "ROCK SOLID" and it was always so confident each time that it would work. It was a silly automation that would flash all of my lights red, play a "self destruct" countdown, and then play rickroll at the end of the countdown. It just couldn't get it right, it never worked. I pasted the automation to chatgpt and it immediately fixed it. K pasted it back over to gemini and in the thinking files one of things said "marveling at coding masterpiece" lol.

Something else I found that helps a lot is getting off s prompt with "do not trust your internal knowledge, it is out of date. Search for recent data as of (current month and year) and look for the official documentation before trying to solve this task.' for Claude in particular this makes a pretty big difference, as often it thinks it knows what to do but really it needs to read the instructions first. It is important to use the actual curtain month and year though because for whatever reason it will always pick an older date, in my case it will search Google for documentation from 2024, even though the internal knowledge is supposed to be more up-to-date than that

Anyone that wants to minimize frustration should use the paid models. Today's programming models are significantly better than those of 6 months ago. Prompting is easier. The models don't make as many mistakes. Claude today builds a Groovy/quasi-Hubitat test rig on the user's computer to run automated tests. It's never going to be any worse than today.

They don't make as many mistakes but believe me they always are making mistakes. As for the test rig, if you haven't checked out my repo (linked above) one of the things I put the most amount of time into was the CI. I have multiple unit tests, groovy tests using Maven Gradle and Spock and an entire e2e flow that uses a sacrificial test hub. It's all open source so you can feel free to use any of it if you'd like. Unfortunately it won't catch everything that a live hub would do but it gets close enough.

I used Meta's Muse AI to write a Hubitat Muse integration. I started with the thought then said "Are you able to write a Groovy app to integrate yourself with Hubitat home automation". It produced an app. I then gave it more details of what I wanted. Worked great. Muse AI is free right now with weekly limits (I haven't hit any of those yet). I currently have it helping me troubleshoot my hub becoming unresponsive on the network.

I've just begun writing a Hubitat app, largely with Nemotron as the LLM and kilo code as the UI: GitHub - rmsppu/hubitat_salus: Hubitat integration with Salus devices based on Home Assistant · GitHub

It's been consistent with my other "AI" assisted coding experience... treat the AI like an intern developer on a Monday morning, who has forgotten everything they worked on last week but are convinced that all their work is perfect. Double check everything.

I've now got chunks of code that are syntactically correct, but not as yet functional. Still better than my learning groovy from scratch.