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
Load "particle-hap.ino" in the src folder and compile for the Photon, using ParticleDev.
Then pair the Photon with Homekit on an Apple Device.
From then you can use the button to turn the RGB led on the Photon ON/OFF.
For the "LED color control" example, I am not sure where to start...
I can't find an ".ino" file to start with...
Could you please give me a hint how to combine the files in your repository in order to compile your RGB control example for a Photon? And how do we control the RGB values?
Hey @ljezny, great work here!
I’ve flashed the latest version and have control over both hue and intensity. I do notice that hue can jump a bit when changing values quickly (possible to increase the refresh rate?).
Brightness jumps wildly when scrolling through, it seems to keep going through 4-5 steps of brightness.
All in all, really nice!
Hi guys, instead of reporting issues, any PR are welcomed. I know about the brightness problem, but my goal is integration with Dalibor Farny’s Nixie Clock, then i want to control my windows shutters from Homekit. Led control is just a simple example, how to build your own HAP. I believe that for a skilled C/C++ developer should be this sample enough. My idea of sharing the project is working a crypto (srp, eliptic curves …).
Feel free to use it, but i wont provide any much support…
Hi FiDel, always get the latest version of my repository. Pair it with Homekit, long touch on the LightBulb and there should be a color settings available. Look at Accessory.cpp - there’s a handling of LED
Hi Lukas, thanks for sharing, this is a great example!
I was wondering how to “customize” and configure the code for our own projects, in other words how to specify which pins to use on the photon e.g. as an “output” when you want to use it as a “lightbulb” accessory, or which pin to use for a “motion sensor accessory”.
Would I need to hard-code it like going to the “Particle-HAP/src/MotionSensorAccessory.h” file and modify line 20 “int motionInputPin = D4;” for my specific need? or can the input/output pins to be used on the photon be specified in the actual .ino file when initialising the project?
Hi,
MotionSensorAccessory is just an example how to properly create and setup a homekit accessory. Of course you can setup your own wiring.
Actually you should not include classes in src folder to your project. Homekit as a library is included in ‘homekit’ subfolder. Everything above ‘homekit’ subfolder is just a sample application. In .ino file you can find a snippet how to properly initialize my library.
I am struggling to figure out how to do this. I normally use the Web IDE but there are so many files. It seems that the Desktop (Atom) IDE does not work with Argon, so I would have to use the new Visual Studio Workbench, but this looks like giving me a huge learning curve! Do you have any suggestions?
Thank you for sharing this, that’s amazing! Would it be possible for you to add the examples you have to the library as well, so it’s easier to get started?