Getting Started with Groovy for Hubitat

Some people use their primary (or only) hub. I eventually got a test/development hub for this kind of thing, but there's no need to. However, it may make things easier if you know that all log entries came from your app or driver, for example.

While you can test out general Groovy syntax on your own computer (can be handy if you just want to see things like how various List or Map operations work--if your API uses JSON, these are probably objects you'll be working with a lot), there is no way to re-create the Hubitat app or driver "sandbox" on your own computer. You'll need a hub to actually test execution at some point.

For me, not really besides the hub and the below (an editor). But for a large LAN integration I have that contains multiple app, driver, and library files, I did find and modify a small script (from here) to more easily upload these files to my hub without having to do them myself one-by-one. For apps or drivers that just have one file or maybe one or two more, it might be easier just to manually copy/paste the code.

Perhaps not "best," but some people here recommended VSCode (with Groovy syntax extensions installed) a while back, and it's good enough for me -- syntax highlighting, something vaguely resembling autocomplete (really just remembering things you've typed before, and not always in contexts when they're valid, so you need to sue a bit of your own brain, too), etc. It's also pretty lightweight and loads fairly fast (despite being an Electron app; I'm comparing this to things like IntelliJ or pretty much any "full" IDE).

(EDIT: I'll add that the built-in code editor on the hub works fine, too, and then you really don't have to worry about this question or the previous. But some people want an editor with more options, or maybe the ability to save something without needing to save necessarily valid code to the hub, which other things may provide.)

As long as this API offers a way to communicate over HTTP(S) in a way that fetches data you can parse (JSON and XML are both pretty easy in Groovy), this should be possible, but it's hard to say more without knowing how the API works. If you just need to fetch data from an HTTP(S) endpoint, the async HTTP methods (e.g., asynchttpGet) would probably be the best starting point. This can work in an app or driver, but it seems like an app would be best for the goals you want (apps can set hub mode and run commands like setCode() on a lock).