IntelliJ development support in 2.3.9 firmware update

Starting from firmware version 2.3.9, Hubitat supports Groovy development in IntelliJ Idea. Here's how to edit the code in the IDE and upload it in a single click using IDE's plugin.

  • Download and install IntelliJ Idea Community Edition from IntelliJ's web site .
  • Download the plugin from our public storage and install it from the disk in the IDE.
  • Right click on the toolbar and select Customize Toolbar... from the menu.
  • Click (+) icon and select Add Action.
  • Enter "Hubitat" in the search bar and select Post Hubitat app or driver code to the hub.
  • Assign an icon of your choice and click Ok.
  • Double check that the icon appears on the toolbar.

The plugin looks for a set of comments with hub/app/driver information at the very beginning of the file. Copy/paste the sample code below as the first 5 lines of the app/driver groovy file and modify information as needed.

// hubitat start
// hub: 192.168.4.86  <- this is hub's IP address
// type: app          <- valid values here are "app" and "device"
// id: 2551           <- this is app or driver's id
// hubitat end

Make sure that the information is correct, then click the button created in the first step to upload the code. That's it! A confirmation will pop up to indicate either success or failure of code upload. If there's a compilation error, more information will be provided.

11 Likes

Does this support Hub Login Security?

I thought I tried it on my main hub which has security, and found that it worked without needing any credentials.

I was unable to reproduce that. It doesn't work for me, the request is rejected, and no error message is shown. Which it should, and I'll get to it once dashboards are ironed out.

2 Likes

Trying to install plugin but it fails. Error is

Plugin 'HubitatIntelliJPlugin' (version '1.0-SNAPSHOT') is not compatible with the current version of the IDE, because it requires build 242.* or older but the current build is IC-243.21565.193

Would you be able to re-release it? Thanks

3 Likes

Can you update this plugin to work with newer version >=243

Noted... we're focusing on 2.4.0 fixes for the next few days, but it's pretty high on the priority list after major ones are done.

1 Like

Thanks, looking forward to this as I have somehow recently lost the Shift-Tab auto formatting in the browser editor when coding my groovy apps/drivers. :face_exhaling:

I am not sure where that Shift-Tab auto formatting functionality came from that was really helpful to align the {} brackets, but multiple recent upgrades on Apple M4 Hardware, Apple OS Sequoia, Brave/ChromeSafari, and Hubitat make it hard to track down the lost functionality.

1 Like

I see this in the plugin.xml file (inside the jar):

<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
<idea-plugin>
  <version>1.0-SNAPSHOT</version>
  <idea-version since-build="232" until-build="242.*" />
  <!-- Unique identifier of the plugin. It should be FQN. It cannot be changed between the plugin versions. -->

It defines a until-build property which is optional.. seems like it could/should just be removed

Attributes

* `since-build` (required)
The lowest IDE version compatible with the plugin.
* `until-build` (optional)
The highest IDE version compatible with the plugin. Undefined value declares compatibility with all the IDEs since the version specified by the `since-build` (also with the future builds that may cause incompatibility errors).

I wonder if we can just edit the xml file, repack the jar and try again.. it didn't work on my first attempt but I'll do more digging

1 Like

I got the plugin to install but I don't see the action show up so clearly there's more that's needed. I'm running IntelliJ IDEA 2024.3.2 (Ultimate Edition)

Here's how I got it to install if anyone wants to test:

  • extract the .jar file
  • edit META-INF/plugin.xml and change line 4 to:
  <idea-version since-build="232" />
  • re-zip folder (I have a Mac and used the built-in compress option on folder)
  • leave this as a .zip file.. I tried renaming as .jar but that didn't work
  • import into Intellij
1 Like

Worked like a charm... Thank you!

I made line #4

<idea-version since-build="232" until-build="342.*" />

1 Like

I can't get this to work.. the plugin looks enabled but I can't find the action when trying to add it to the toolbar. I used the same syntax you did too -- until-build="342.*". Any pointers?

I right clicked on the top Toolbar to show 'Customize Toolbar'

I added the new option, selected a green icon and dragged it to the top of the list.

Now it shows up with a smile!

1 Like

thanks.. I had it setup on an earlier version of IntelliJ but for some reason I can't find the action anymore.. nothing comes up when searching for "Hubitat" or Post

Can I ask what version of IntelliJ you have?

Build #IU-243.23654.117, built on January 16, 2025

PyCharm 2024.3.1.1 (Community Edition)
Build #PC-243.22562.220, built on December 18, 2024
Runtime version: 21.0.5+8-b631.28 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.3
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 14
Metal Rendering is ON
Registry:
debugger.new.tool.window.layout=true
ide.experimental.ui=true
i18n.locale=
llm.show.ai.promotion.window.on.start=false
Non-Bundled Plugins:
com.hubitat.intellij.plugin.HubitatIntelliJPlugin (1.0-SNAPSHOT)
com.redhat.devtools.lsp4ij (0.9.0)
izhangzhihao.rainbow.brackets (2024.2.8-241)
pro.bashsupport (4.5.0.243)
com.bash.cmd (1.0.0)

@gopher.ny, does the plugin work with libraries too?
If not, are you planning to add support for libraries?

Edit:
Another big improvement would be to find a way to avoid having the configuration inside the files. For code shared on github, it makes the plugin useless, or at least very hard to use, since you have to add and remove the header while using version control.

The hub address/IP could be configured in the plugin, and namespace and name seem to be unique for libraries, drivers and apps, making it possible to derive the id.

The way to determine which type of code that a file deals with is more challenging, but it's a nice challenge :slight_smile:.

1 Like

Not yet.

Yes, if only for my own convenience :slight_smile:

2 Likes

@gopher.ny - would you be able to update the plugin for a more recent version of IntelliJ?

Maybe even just remove that until-build attribute to not prevent it from working in newer versions?

* `until-build` (optional)
The highest IDE version compatible with the plugin. Undefined value declares compatibility with all the IDEs since the version specified by the `since-build` (also with the future builds that may cause incompatibility errors).
3 Likes

Yes, it's on the to do list. We don't provide estimates as a matter of policy, but probably sooner rather than later. We're using it, too, and would like to update the IDE.

4 Likes

I have been using IntelliJ for other things and I am starting to like it.
I would love to love it for Hubitat but two issues I have right now.

  • Having to add the publishing details to the code is a no-go for me
    • Needs to be configurable in the plugin, and ideally multiple hubs can be setup.
    • The unofficial VSCode plugin is configured in the plugin and remembers the code ID# on the hub per file on a metadata file.
  • IntelliJ has no free way to have a code "server" that you can work on from remote.
    • Included in VS Code and works amazing (tunnel server)
    • Can be worked around in some cases with cloud storage (but not always)