{"id":16655609,"url":"https://github.com/mtrudel/hap","last_synced_at":"2025-04-04T04:07:44.377Z","repository":{"id":46245356,"uuid":"217370894","full_name":"mtrudel/hap","owner":"mtrudel","description":"A HomeKit Accessory Protocol (HAP) Implementation for Elixir","archived":false,"fork":false,"pushed_at":"2024-10-03T22:20:30.000Z","size":488,"stargazers_count":91,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-13T09:53:39.449Z","etag":null,"topics":["elixir","homekit","homekit-accessory-protocol","nerves"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtrudel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-24T18:48:51.000Z","updated_at":"2024-10-11T20:00:53.000Z","dependencies_parsed_at":"2023-02-13T00:45:55.388Z","dependency_job_id":"7fb9d0a1-e298-45c4-b09d-1de9df6091b3","html_url":"https://github.com/mtrudel/hap","commit_stats":{"total_commits":227,"total_committers":6,"mean_commits":"37.833333333333336","dds":"0.21145374449339205","last_synced_commit":"cade9bddb365f8eb02de1d6a8c163ba4e1174123"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fhap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fhap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fhap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fhap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtrudel","download_url":"https://codeload.github.com/mtrudel/hap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247117757,"owners_count":20886439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","homekit","homekit-accessory-protocol","nerves"],"created_at":"2024-10-12T09:53:32.770Z","updated_at":"2025-04-04T04:07:39.351Z","avatar_url":"https://github.com/mtrudel.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"![HAP](https://user-images.githubusercontent.com/79646/67910894-dd4dc280-fb5a-11e9-9ca9-4be6633cc1a6.png)\n\n[![Build Status](https://github.com/mtrudel/hap/workflows/Elixir%20CI/badge.svg)](https://github.com/mtrudel/hap/actions)\n[![Docs](https://img.shields.io/badge/api-docs-green.svg?style=flat)](https://hexdocs.pm/hap)\n[![Hex.pm](https://img.shields.io/hexpm/v/hap.svg?style=flat\u0026color=blue)](https://hex.pm/packages/hap)\n\nHAP is a framework for building DIY HomeKit accessories based on Apple's [HomeKit Accessory Protocol](https://developer.apple.com/homekit/) specification.\nYou can think of it as [homebridge](https://github.com/nfarina/homebridge) for Elixir (with a bit more of a focus on\nbuilding actual accessories via Nerves) in contrast to Homebridge's typical use as a bridge to existing accessories.\n\nAs shown in the [HAP Demo](https://github.com/mtrudel/hap_demo) project, integrating HAP support into an existing Elixir\nproject is extremely straightforward - all that is required in most cases is to define the services and characteristics\nyou wish to expose, and to provide an implementation of `HAP.ValueStore` for each non-static characteristic you define.\n\nIn many cases, integrating with HAP can be as simple as:\n\n```elixir\naccessory_server =\n  %HAP.AccessoryServer{\n    name: \"My HAP Demo Device\",\n    model: \"HAP Demo Device\",\n    identifier: \"11:22:33:44:12:66\",\n    accessory_type: 5,\n    accessories: [\n      %HAP.Accessory{\n        name: \"My HAP Lightbulb\",\n        services: [\n          %HAP.Services.LightBulb{on: {MyApp.Lightbulb, gpio_pin: 23}}\n        ]\n      }\n    ]\n  }\n\nchildren = [{HAP, accessory_server}]\n\nSupervisor.start_link(children, opts)\n\n...\n```\n\n## Supported Services \u0026 Characteristics\n\nAs originally developed, HAP included a fairly small set of services \u0026 characteristics (mostly due to the author's\nlaziness \u0026 the immediate need for only a handful of the ~45 services \u0026 ~128 characteristics defined in the\nspecification). However, it is quite easy to add definitions for new services \u0026 characteristics, and PRs to add such\ndefinitions are extremely welcome. The [lightbulb service](https://github.com/mtrudel/hap/blob/main/lib/hap/services/light_bulb.ex)\nis a complete implementation of a service and serves as an excellent starting point for creating your own. You can consult\nsections 8 and 9 of the [HomeKit Accessory Protocol Specification](https://developer.apple.com/homekit/) to determine\nwhat characteristics are required and optional for a given service. Note that only implementations of public services and\ncharacteristics as defined in the HomeKit specification will be considered for inclusion in HAP.\n\n### Asynchronous Change Notifications\n\nHAP supports notifications (as defined in section 6.8 of the [HomeKit Accessory Protocol\nSpecification](https://developer.apple.com/homekit/)). This allows your accessory to notify HomeKit of changes which\nhappen asynchronously, such as a user pushing a button on the accessory, or a sensor detecting a water leak. To send\nsuch notifications, your `HAP.ValueStore` implementation must support the `c:HAP.ValueStore.set_change_token/2`\ncallback. Consult the `HAP.ValueStore` documentation for more detail.\n\n## Known Issues\n\n* No support for dynamically updating the services advertised by a HAP instance (this is slated for HAP 2.0)\n* Incomplete support for tearing down existing sessions on pairing removal (this is slated for HAP 2.0)\n* No support for HomeKit Secure Video / RTP (support is not currently planned, but PRs are of course welcome)\n* Timed write support is supported, but timeouts are not enforced\n\nIn addition, there may well be bugs or gaps in functionality not listed above. If you encounter any, please feel free\nto file an issue.\n\n## Installation\n\nHAP is available in Hex. The package can be installed by adding hap to your list of dependencies in mix.exs:\n\n```\ndef deps do\n  [\n    {:hap, \"~\u003e 0.4\"}\n  ]\nend\n```\n\nHAP is intended to be used within a host application which provides concrete implementations for various HomeKit\ncharacteristics. Check out the [HAP Demo](https://github.com/mtrudel/hap_demo) app for an example of how to use HAP.\n\nDocumentation can be found at https://hexdocs.pm/hap/.\n\nNote that in order to have access to the required crypto methods for HAP to function, OTP 23 or newer is required. Also note that OTP 25.0.x has a [defect](https://github.com/erlang/otp/issues/6313) that breaks HAP (fixed in OTP 25.1 and newer).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtrudel%2Fhap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtrudel%2Fhap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtrudel%2Fhap/lists"}