HOWTO? Custom Driver with rich HomeKit integration

Hi there,

I'm writing a custom driver for my La Marzocco Home Espresso machine that I'd like to expose to HomeKit. I've completed a preliminary version of the driver and it works well, BUT, I feel like there are some weaknesses I'd still like to address, specifically:

  1. I'd like to expose more metadata to HomeKit (Manufacturer, Model, Serial Number, Firmware Version, Image, etc)
  2. I'd like to expose the "Water Level" property too

Can anyone point me in the right direction to better understand how I might achieve this?

Thanks in advance!

You can add as many custom attributes and commands that you might want. Anything outside of a Capability's predefined Attributes and Commands are going to be Custom.

Look at almost any Weather driver and you'll see examples. I found this, for instance:

Homekit will then either gobble them up, or ignore :smiley:

Is there any list of what attributes get past to HomeKit?

Events get passed. Whatever is in the Event gets sent. It's then up to Homekit to use or discard/ignore. Same the other way... Homekit sends what it intends to send and that becomes an Event on the Hubitat side that lands in your Driver to Parse.

But the events must get mapped in some way to something HomeKit understands? At least the constants must get mapped

That's what the Homekit Integration does, same as how Homebridge does, getting to the same result.

If you create an Attribute called "peanutButterJelly" and have something set values to that Attribute (typically Commands) then "peanutButterJelly" Events will get sent to Homekit, which presumably doesn't know what to do with it for a Coffee Machine and will ignore it. Ultimately you need to know what Homekit has prepared for Coffee Machines and make Hubitat Attributes match that. I'm not aware of Coffee Machine within Homekit but it's also something I wouldn't actually 'see' if I scanned a list. (I don't drink coffee so my eyes would skip right over.)

I'm probably being a little thick here, so I apologise in advance for not quite understanding, but, I think that there should be a mapping somewhere that maps:

Hubitat                  ->          Homekit
Capability             ->          Accessory Category
(IE Switch             ->          HMAccessoryCategoryTypeSwitch)

Attribute              ->          Characteristic
(IE Switch state ->          HMCharacteristicTypePowerState)

I'm interested in this same topic. I have a device with custom driver that shows up in HomeKit and sort of functions. However, the state gets all out of whack, so I'm trying to understand how HE is mapping the device state to what HomeKit understands, and what is expected from the custom driver. As an example, a 'window shade' has a 'position' state, but HomeKit has 'target position' and 'current position'. The 'windowShade' state also has 'partially open' in HE, but 'stopped' in HomeKit. What are these mappings so we can stay between the lines and have reliable integrations.