[Release] Hubitat to Apprise API integration

Source: hubitat-apprise-api/device.groovy at main 路 skjdghsdjgsdj/hubitat-apprise-api 路 GitHub

I wanted the ability to send notifications to an Apprise API instance without throwing direct HTTP requests into my rules. This device driver acts as a virtual notification target that can be used in the rule machine. This requires an Apprise API instance to be set up. This doesn't run Apprise itself on the hub.

To install it:

  1. Go to For Developers -> Drivers Code in the Hubitat hub, then Add Driver.
  2. Paste in the code and save it.
  3. Add a device via Devices -> Add Device and look for the newly added Apprise device.
  4. Set preferences in the new device:
  • Apprise API endpoint URI: the address of your Apprise instance, like http://10.1.2.3:8000. No trailing slash. HTTPS is supported with a valid certificate.
  • Configuration key: the key of the configuration set to notify. In most instances this is "apprise".
  • HTTP basic auth. username and password: if you protected your Apprise API behind HTTP basic authentication, enter the values here. For example in my case, I protected the instance behind Authentik and use a service account to access it.

Some disclaimers:

  • I've never written Groovy before, let alone a Hubitat driver, so I have no idea if this is any good.
  • My total experience with Apprise: I installed it yesterday. Obviously many features of Apprise aren't exposed to the driver.

I welcome comments or (more ideally) GitHub PRs to make it suck less.

And as a side note to anyone trying to send HTTP POSTs as multipart/form-data, I learned some lessons:

  • The boundary when used in the payload requires two leading hyphens. The final boundary in the payload also needs two tailing hyphens.
  • You need to separate payload lines with CRLF, not just LF! Note the use of \r\n.
  • Best I can tell, httpPost in Hubitat can't natively send multipart/form-data requests, hence the awfulness of building the payload manually.