Internals - mongoose-os-apps/shelly-homekit GitHub Wiki

Firmware Internals

This page will be used to describe internals of the firmware, may be useful when reading the code or contributing.

Code organization

TODO

HAP details

HAP support is provided by the Mongoose OS port of the official Apple HomeKit ADK.

If you are not familiar with HAP yet, get yourself a copy of the spec [from Apple](to be able to do anything, get yourself a HAP protocol specification from Apple - https://developer.apple.com/support/homekit-accessory-protocol/). It's available for free, you only need an Apple ID. Make sure you are familiar with the concepts of characteristic, service and accessory, feel free to skip the protocol details as those are all taken care of by the ADK library.

We run only one accessory server, with one or more accessories. When in multi-accessory mode, we pretend to be a proxy, though nothing is being proxied anywhere and it's only used to be able to expose independent accessories.

Having separate accessories is handy because tiles can be assigned to different rooms (something that's been requested by users of multi-switch accessories), and also because Home app gets confused when e.g. stateless and stateful switch service are present within the same accessory.