No way to access global variables from .cpp file in "includes"
- Dominant language
- No language data
- Stars
- 313
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
### The problem
with the includes directive it's possible to link .cpp files into the project. However, to be able to usefully implement code in this cpp file, it should be possible to access the global variables that are generated by ESPHome.
Example:
```
esphome:
name: "${device_name}"
includes:
- test.h
- test.cpp
on_boot:
priority: 200
then:
- lambda: !lambda test();
```
In test.cpp:
```
void test()
{
ESP_LOGD("test", "%f", id(input_fan_speed).state);
}
```
If ESPHome would a header file with externals to link the generated globals, this code would run.
### Which version of ESPHome has the issue?
git dev branch dd. January 5th, 2023
### What type of installation are you using?
pip
### Which version of Home Assistant has the issue?
N/A
### What platform are you using?
ESP32
### Board
nodemcu
### Component causing the issue
core
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.