Optimal development workflow

So I've been working an HE app and have a basic flow but there are some pain points and I'm wondering how others are doing it.

Current setup:

  1. Chrome window with HE live log open
  2. Chrome window with HE App/Device editor open
  3. Chrome window with HE App/Device running
  4. VS Code window

Current workflow;

  1. Make some small change in HE editor
  2. Hit the save button and watch for any errors up top
  3. Refresh the HE running app, sometimes having to go back to the apps page and then to the app when developing parent-child app
  4. Watch the HE log for errors while testing new code
  5. Repeat 1-4 until a good spot
  6. Select all text in HE editor and paste it into VSCode IDE.
  7. Look at the diff and see what I actually did since last commit
  8. add and commit changes to git
  9. Rinse and repeat

What do other people do?

What I would really like would be a samba or nfs mount point, on HE where I could point my IDE and edit/save my sources locally. That way I could stay in the IDE the whole time and just refresh the HE app/device page. With one pane pointed to the log websocket it would almost be a little embedded IDE :slight_smile:

Again, am I missing some cool workflow or tool?

1 Like

This just about sums it up for me except substitute IntelliJ for VSCode. I like the auto-formatting that it offers.

At some point I'm going to build a plugin or hook or something that pushes changes to HE from IntelliJ by looking under the hood to see how the save on the edit pages work and then duplicating that but it hasn't happened yet.

1 Like

@MFornander I work directly in VSCode and have a python script which push the code to HE. I did it the way you describe for about 1 week, then I got tired of it. The tool was written for me to use so it is not really packaged for re-use, but with enough interest, maybe that could be done.
Live logs I'm just about to move to Graylog so that there's some better filtering.

1 Like

Interesting what formatting tools are you using with Viscose, I could not find any one that worked correctly with Groovy.

IntelliJ has auto-formatting/reformatting built-in for Groovy. You just ctrl+shift+alt+L and you're done... Of course it formats as you go along as well. I couldn't find anything equivalent for VSCode.

Just found this one, but have not managed to make the formatting work. https://marketplace.visualstudio.com/items?itemName=NicolasVuillamy.vscode-groovy-lint

1 Like

I think someone needs to make an MCP for HE - I wish they would allow ssh into HE and ability to make changes via command line. But their Dev env is semi-engineered - over-enigeered Web editors but they are not aligned with today's workflows. Half the time their search doesn't work properly in the editor

1 Like

BTW there is a VSCode plugin for Hubitat in the marketplace and there is a thread around it, make life a little better, haven’t been able to figure out how to keep version numbers in sync, but is pretty decent in avoiding cut and paste. Reset of the workflow remains the same.

In drivers that use libraries if you export code out you will notice that the library code is just attached to the driver code so for local debugging and complication testing you can do the same

I also work directly in VSCode using the hubitat plugin. Quick keyboard shortcut uploads all changes to hubitat directly. Very easy and reliable. Highly recommend

@JustinL How do manage the version numbers ?

Didn't see this point mentioned above... I only code on a dev hub, never my daily drivers. Haven't borked anything yet, but feel safer regardless.

Are you talking about when you try to push a change from VSCode and it complains about the version not matching? This should only happen if you also make edits locally on the hub I think. Or also if VSCode times out even though the change saves it can happen I noticed. It should not be asking every time.

1 Like

I have had to change it every time, Times out for me a lot too, but even when it updates successfully the version never updates for me in the json file. I installed the extension from the marketplace not sure if that is the latest.

It is the latest, and I think you can adjust the timeout in the settings (which was added per my suggestion). I had to increase mine quite a bit. I think the more code on the hub the slower it goes.

1 Like