How might I expose a variable in a custom component .h file to lambdas and/or expose esphome globals to the .h code. Obviously, I’m not competent at C++ coding.
For those who are still trying to figure this out:
A global in an ESPHome configuration YAML file translates to an instance of the GlobalsComponent class in the C++ code, declared in your <NODE_NAME>/src/main.cpp. You can access it in a custom component .h file as follows:
my_global->value() = something; something = my_global->value();
where something and my_global should be of the same or compatible type.
So by defining one or more globals in the YAML file, data can be exchanged between (custom) components, from YAML to C++ and back.