I am sorry i will not provide full solution to your problem, at first i don’t have that time, at second it won’t be fun for you I don’t know how familiar you are with C/C++ development, but fairly to say, your project can be easily done.
I will provide some checklist:
- Get the PDF docs of Homekit - look into my repo for HAP-Specification-Non-Commercial-Version.pdf file. You don’t have to read it all, but you have to be familiar with terms: Accessory, Service, Characteristics and types of Accessories and types of Characteristics and its values.
- After that you will understand implementation of initAccessory method in my code.
- Basically I am creating a virtual lightbulb accessory, but you will need a Sensor accessory, or Programable Switch.
- I would totally recommend to dig into my Xcode sample (in example folder), so you can debug whole accessory with full stack debugger.
- For such small project i would recommend to “merge” Accessory.cpp into your *.ino file, so all the variables and methods will be in one scope, and you don’t have to deal with header files.
I am working on stability of homekit, so once again sorry i will not help with integration. Have a lot of work for my job and this is just a hobby thing for me and my wife not happy about it