Eliminating driver code mess

Therefore the wish for a feature request... :wink:

Why don't omit error checking for apps that first line is just library (e.g.)?

BTW: Your VSCode solution is very sophisticated :+1: - but it has one disadvantage:
When you change the lib you manually have to do the import for all the apps that use this lib.

Sure, nothing is technically impossible, but based on staff response to feature requests of this and similar "developer" features I'd be surprised if you get anywhere.

Hence pointing out a solution that works today.

This really depends on your point of view. IMO I consider the manual import of each driver / app to be a benefit.

Typically if I update shared code portions I'd want to gauge their impact on a specific driver / app. If all drivers / apps were automatically updated to use the shared code portion that could be disastrous in a live environment.

In any case if you do want to do that then you can use one of the version control Apps like HPM - https://community.hubitat.com/t/beta-hubitat-package-manager or one of the build tools that others use - Command-line build tool (uploader) for Hubitat driver and app code


Good point!


I do too. I don't want to update driver A and have potential unintended impact on driver B. Annoys me greatly when it happens at the platform level, and I don't want to exacerbate that problem.

Maybe I'm just cautious though.


For my workflow at least, what I think I need is a Grunt or Gulp workflow (or another similar framework). It would:

  • Parse through all my local repositories of Hubitat source code
  • Anywhere it sees an #include statement, it would copy in the included file from my /includes folder
  • The output would be treated as "compiled" code, and put in a separate folder.

Two more bonus tasks:

  • Upload my compiled code onto my local hub
  • Update my github repos with the compiled code and update my Hubitat Package Manager manifests for the projects.

That said, I don't have time to build this right now, so it is left as an exercise for the reader. :smiley:


Thought I'd add that I added code completion to VSCode for Groovy too using GitHub - prominic/groovy-language-server: A language server for Groovy

It's not perfect, but does mean that my own methods are now resolved and offered for autocomplete.



Finally my idea of libraries to reuse code is realized! :smiley: