Hi!
**My ask up front: **Can someone walk me through the process of how a github project written in python winds up interacting with YAML on an ESP32? Looking for some orientation so I can “RTFM” better.
Background: I have Espectre up and running in my house, which is cool. What I also have in my house is LED crown molding controlled by WLED.
I think the ESP-32s I’m using for the lighting have enough juice to run both items of code (and probably a few other sensors). However, I don’t know how to combine them.
What I’m specifically confused about is when I provision a device with ESPHome, I’m not actually clear on what it does. As in: I gather it’s making a framework specific to the board to handle running the code in the YAML, but I’m not sure what that looks like specifically. Which means I don’t know how to take the code from WLED or ESPectre and also include it (is it as simple as an include?) so that I can make YAMLs that utilize the functionality those to projects provide.
I am especially confused what is happening when YAML code calls specific github projects. Is it literally pulling code from the repository?
For context I have decent capability and experience, but mostly within code, bridging multiple architectures like this is new. I have stumbled on for years doing some fairly advanced projects, but I mostly am a very determined monkey banging on a type writer.
ESPHome is by-and-large a build system to build bespoke C++ programs. The python files you’re seeing describe how that yaml file maps to the C++ files.
The core idea is that end users (including people managing custom sensors) as much as possible only have to interact with the yaml file. The yaml file lists what components you want to run and their configurations. A component is in general a subdirectory of esphome/esphome and is intended to be independent of other components.
Those github references in the yaml pull in external components from the community. It’s roughly equivalent to dropping another folder into the source tree (noting again that you shouldn’t usually need to have the source tree at all).
Running esphome copies all used components into a separate source tree, with substitutions and variables set according to the yaml configuration (defined by the component’s python files) and builds a bespoke binary for you that will run on your device.
If you want to include code that’s not already an ESPHome component, you will need to make it into one. You can do this in place in the source tree or by creating an external component yourself. You will want to use an existing component as a template for this. Have a look for if ESPHome itself or a community component already exists first because it will make your life so much easier.
TL;DR the python code converts the yaml into a (pure) C++ program.

