-->
Page 1 of 1

Tools for understanding Homekit development with ESP8266

PostPosted: Wed Jan 06, 2021 2:54 pm
by jazzdorf
Hello everyone,

this is my first post. I recently discovered Apple Homekit and I'm totally hooked.
I started out with an ESP8266 and the Arduino IDE.
And I also got some projects up and running like a temperature and humidity sensor and a door sensor.

Now I want to control a 12V LED light with a MOSFET. (The circuit works already, I just need the code.)
But when I try and use the example code from here here for example then I'm stuck.

I don't understand how I can tell Siri to tell the lamp it shall be dimmed to X%.
Anyone to point me in the right direction?

However, I also want to understand everything from the bottom up. How can I achieve this? Here are some questions for the pros:

1. Is the Arduino IDE a good tool or are there better ones?
2. What skills do I need?
3. What resources do you know that are helpful?
4. How can I understand a library like this one?
Shall I go through every file and try to understand what they are doing and how they are connected?
Or is there any underlying principle like a homekit blueprint that I'm missing for knowing how the things work together?
5. I suppose I need a very good knowledge of C. Correct? Which concepts in particular? Or simply everything the language has to offer?
6. Any other things I forgot?

Re: Tools for understanding Homekit development with ESP8266

PostPosted: Fri Jan 08, 2021 6:25 am
by QuickFix
DISCLAIMER: This is my view on this, it will not be the view of others. ;)

First take a step back and keep your goal (controlling a 12V LED light using Apple Homekit) in the back of your head: it's nice as an aim, but you really have to start at the beginning. :idea:

  1. The Arduino IDE is good (not great), free, has a large user base (= lots of examples to "Loan" from) and is updated often.
    It lacks some handy features like code completion and the interface is a bit quirky (compared to other environments), but it does the job well.
    Another good alternative is VSCode with the PlatformIO plugin, but since it can be a bit overwhelming (lots of bells and whistles) when you're not used to full blown development environments.
    You could also opt to use different programming languages like BASIC, MicroPython or Lua.
  2. Some technical skills (at least theoretical) is a bare minimum and/or if you're autistically inclined you should be ready to go I guess. ;)
    The skill to learn from mistakes made and be able to try, try again when failing (and believe me: you will fail... regularly, but it gets less over time). :lol:
  3. "Hard" resources: A good development board is a real God sent, try to stay away from separate ESP-modules (ESP-01...ESP-12) until your code is working and you're more familiar with the bare hardware (ie. know how the ESP behaves and how to check when things don't work as planned).
    "Soft" resources: Google, YouTube, Arduino, Instructables and ESP8266.com of course (amongst many others).
  4. Don't for now: first learn to stand and walk and run and climb and dance; knowing how to use a library is hard enough, look at examples and see how they work (= copy and paste at first). ;)
  5. Nah: install the Arduino IDE and the ESP8266 core library and load up the "Blink" example in "File" -> "Examples" -> "ESP8266" -> "Blink".
    See what the code looks like and try to understand what every line does (don't forget you can use Google as a guide).
    Open (and try to understand) some other simple examples and move on to the real magic by loading up the "HelloServer" example under "File" -> "Examples" -> "ESP8266WebServer" -> "HelloServer".
  6. Take your time and enjoy the ride 8-)