esp-apple-homekit-adk icon indicating copy to clipboard operation
esp-apple-homekit-adk copied to clipboard

Arduino IDE support

Open Asteliks opened this issue 5 years ago • 20 comments

Could you make a version of this compatible with the Arduino IDE?

Asteliks avatar Jun 06 '20 22:06 Asteliks

I would also love this. But I think it’s probably unlikely to happen.

jwktje avatar Jun 25 '20 11:06 jwktje

It isn't that straight forward because a majority of code and APIs is from the Apple ADK directly. The Arduino support for ESP32 is mostly in the form of pre-built libraries and a wrappers on top of that, which could be quite cumbersome (but not impossible) for this project. I do not plan to do this myself any time soon, but contributions from the community are always welcome :)

shahpiyushv avatar Jun 25 '20 13:06 shahpiyushv

Yeah that's what I figured. After looking through the Lightbulb example though, I gotta be honest; it looks like a lot. I've used maximkulkin/esp-homekit for a couple DIY homekit devices around the house. It took some time to figure out the workflow but after getting past the initial learning curve the final code seemed reasonable in size.

I'm sure that this esp-apple-homekit-adk would work great once you take the time to master it. But as a hobbyist myself it feels like the barrier to entry is quite high. The code looks daunting to me (but probably not to actual embedded developers).

The reason that Arduino IDE support would be cool is not really because I would like to use Arduino. I guess the question (for me) boils down to; I wish it was as simple as Arduino to a newcomer.

If I imagine an arduino sketch that needs to connect to Wifi and would allow the on/off states of a GPIO (for something like a relay for example) through a HTTP server endpoint, I could make that work in less than 50 LOC with some libraries.

Obviously going through HomeKit for something like this adds complexity. And obviously Arduino libraries keep the sketch code short (but the compiled binary larger). And of course the IDF is way more "close to the metal", making for (on average) more includes at the top and more verbose code to get something running (with the added benefit of less dependencies, better performance and more freedom to make the firmware work exactly how you want without it being dictated by a library).

I totally understand all that. After hearing that the Homekit ADK was open source and supported by Espressif directly I was super stoked. But I've already had 3 different days where I had some free time wanting to get started with it, but ended up abandoning it. Mostly because there isn't much to tinker with.

Maybe someone can make a library on top of this esp-apple-homekit-adk port that would handle most of the universal HomeKit parts?

jwktje avatar Jun 25 '20 13:06 jwktje

I understand what jwktje has said. For Newbies like me, it’s a very high learning curve to get to know how to program in the ESP-IDF way and to match it with Apple ADK way.

Furthermore, I think the “monster” could be much shorter if we had examples that dealt with our world (makers world I mean).

After reading the Lightbulb example here and comparing to the Apple’s ADK one, what I’ve understood is that the Espressif’s example is a port of Apple’s example.

I think that if Espressif could bring us an example that shows us how to set the GPIO32 (or other GPIO) level (high or low) of an ESP32 that controls a relay to which that same Lightbulb of the example, it would be much more useful.

vicfrancco avatar Aug 03 '20 04:08 vicfrancco

I'm also looking for a Arduino version. I found recently - https://github.com/Mixiaoxiao/Arduino-HomeKit-ESP32 and the example works. It is a pity that the description says that the library will no longer be developed.

bfaliszek avatar Aug 07 '20 18:08 bfaliszek

I'm also looking for a Arduino version. I found recently - https://github.com/Mixiaoxiao/Arduino-HomeKit-ESP32 and the example works. It is a pity that the description says that the library will no longer be developed.

Yes, the example works for me too. Within 5 minutes reading the code I was able to find out how he changes the level of GPIO 2.

Unfortunately, it seems like the library will no longer be developed, because Espressif released the official Homekit ADK, witch, actually, seems to be not maker's friendly at all.

A well documented example of the simple led approach woud be very important.

vicfrancco avatar Aug 16 '20 20:08 vicfrancco

I found one more library to handle home kit on esp32. It seems significant and more stable to me than the previous one: https://github.com/Yurik72/ESPHap/tree/master

bfaliszek avatar Aug 17 '20 08:08 bfaliszek

I have managed to make some examples using this library. Actually ones everything starts working it's not that hard. So far it is stable. Link to my repo: https://github.com/Asteliks/AppleHomeKitADK-ESP32

Asteliks avatar Aug 25 '20 13:08 Asteliks

Wanted to +1 @bfaliszek’s recommendation of https://github.com/Yurik72/ESPHap. It’s the first HAP library that I’ve managed to get working with Arduino and it works nearly perfectly. I’m using it both with ESP8266 and ESP32 which is a big bonus.

Before that I was using https://github.com/maximkulkin/esp-homekit, but it was cumbersome and required Linux virtualization as Espressif’s 8266 toolchain no longer builds on macOS Catalina. As a HomeKit-hobbyist, that took a lot of the fun out of it.

JohnWickham avatar Sep 22 '20 13:09 JohnWickham

We have now opened up our own implementation of HomeKit. Check out the ESP HomeKit SDK here and see if suits your requirements.

shahpiyushv avatar Sep 25 '20 18:09 shahpiyushv

Thanks @shahpiyushv, that looks interesting. But it seems that it only supports ESP32, not ESP8266, correct?

You can use esp-homekit-sdk with any ESP32 or ESP32-S2 board

JohnWickham avatar Sep 25 '20 18:09 JohnWickham

Thanks @shahpiyushv, that looks interesting. But it seems that it only supports ESP32, not ESP8266, correct?

You can use esp-homekit-sdk with any ESP32 or ESP32-S2 board

@JohnWickham , actually, with some changes, it did indeed work fine with ESP8266. I will make the required changes in a few days.

shahpiyushv avatar Sep 25 '20 19:09 shahpiyushv

@shahpiyushv Does this mean that now it'll be Arduino compatible? What would one need to do to in order to use the sdk in an arduino project ?

arihantdaga avatar Sep 27 '20 11:09 arihantdaga

@arihantdaga , Arduino support may still not be available anytime soon, but this new SDK has a different set of (simpler) APIs for writing an accessory with many more examples and ready to use functions for different services. It also has other integrations like use of the QR code based Wi-Fi provisioning and also gels well with our other products, particularly ESP RainMaker. We already have an example available which will give you Alexa + Google + Siri control. Since this new SDK is developed in-house, it may probably be easier for us to add into Arduino in future.

shahpiyushv avatar Sep 28 '20 05:09 shahpiyushv

@shahpiyushv, could please comment realistic scenario for Arduino.
your opened repository https://github.com/espressif/esp-homekit-sdk looks very promise. I'd say, the efforts to support arduino for ESP32 is quite clear at least to me. But to support ESP8266, based on this code, we need Arduino for ESP8266 based on the FreeRTOS implementation . Those discussed a lot of times, Therefore a question, what is your realitys and plans ? This question is only about that usage of ESP-IDF is not a problem for "experienced" users,l but for guys like schoolboys is not possible.

Yurik72 avatar Sep 29 '20 10:09 Yurik72

@shahpiyushv, could please comment realistic scenario for Arduino. your opened repository https://github.com/espressif/esp-homekit-sdk looks very promise. I'd say, the efforts to support arduino for ESP32 is quite clear at least to me. But to support ESP8266, based on this code, we need Arduino for ESP8266 based on the FreeRTOS implementation . Those discussed a lot of times, Therefore a question, what is your realitys and plans ? This question is only about that usage of ESP-IDF is not a problem for "experienced" users,l but for guys like schoolboys is not possible.

The esp-homekit-sdk would work with esp-idf and ESP8266-RTOS-SDK. With regards to Arduino, we may add it for ESP32, but not ESP8266. I guess ESP32 + Arduino should still be good enough for the "schoolboys" :)

shahpiyushv avatar Sep 30 '20 15:09 shahpiyushv

We have now added support for ESP8266 in esp-homekit-sdk.

shahpiyushv avatar Oct 08 '20 15:10 shahpiyushv

Any news on that Arduino IDE support?

tomdmt avatar Jul 21 '21 06:07 tomdmt

@tomdmt , sorry, but we aren't really working on adding this into Arduino :-/

shahpiyushv avatar Jul 22 '21 17:07 shahpiyushv

@shahpiyushv Is there anything new about this topic? Almost 3 years now, is there still no Arduino IDE support for ESP Apple Homekit?

FloBer431 avatar Jan 24 '24 15:01 FloBer431