Command-line build tool (uploader) for Hubitat driver and app code

Dear Hubitat Developers,

There seems to be a general need for a command-line tool to automate the build process for Hubitat drivers and apps. The "build process" that I refer to consists essentially of uploading a chunk of Groovy code from a file on your computer to the Hubitat hub, as is accomplished manually by copying and pasting into the Hubitat web editor interface and clicking "Save". In addition to this essential uploading capability, the envisioned command line tool might be capable of other useful things, like downloading code from the Hubitat hub, querying a driver (or app's) event history, triggering commands on an installed driver, hitting an http endpoint on an installed app, synchronizing a collection of Groovy files between a computer and one or more Hubitat hubs, updating firmware, and managing "Backup & Restore" database dumps from one or more Hubitat hubs.

I have cobbled together a Python script named, that gets the job done for my purposes. @jason0x43 seems to have invented a more sophisticated tool, written in Typescript, that achieves similar ends (see jason0x43's hubitat git repository).
@markus has done something similar, (see markus-li's git repository), with a focus on programmatically constructing Hubitat driver and app code from interchangeable parts.

Have others among you come up with similar tools? Please share.

I would love for Hubitat to release an official command-line build tool.

Neil Jackson


How does your desire differ from this:

1 Like

Can you use the "Import" button to add code from a local file and not an Internet URL? I've never tried it that way, but I guess if it takes file:/// URLs or similar, that would work. (But it would still be awkward for drivers, where I'd probably keep the "real" importUrl specified in the code, and Hubitat would keep looking at that instead...apps would remember the local path.)

There's plenty of use for this type of thing, I have 44 drivers I maintain, today I wanted to add importURL to all of them. It took me about 2 minutes to add it to all of my 44 drivers, then about 8 seconds per driver to update my dev-HE with all of them. The manual procedure would require a lot of copy-paste, then upload using either the import button (from a locally hosted http accessible site, file:// does not work), 44 times(!), or copy-paste (how many mistakes would that be?). Also, if I make a change to one of my drivers which doesn't affect the others, only that one will be updated in HE, and the whole process is VERY fast and I don't need to even leave Visual Studio Code. On top of this, any compile errors (on HE) is nicely presented in the console of VSC...
So yes, scripts for devs as well as possibly for users to auto-update all drivers, would be nice. I think for most users it would be enough with an "Import all" button in drivers? But for devs, an automated facility for this saves a lot of time and cuts down on manually introduced errors. I'm happily using my own scripts, but that might not be the case for most devs?
For my part, the very least I'd like is an official API for this, instead of having to use undocumented and possibly changing functions of HE. Do they even announce clearly if a firmware update changes these types of things which we're not supposed to use anyway? I've not seen it, but I'm rather new here...