Skip to content

Commit 15636e7

Browse files
authored
[core] Add support for setting environment variables (#5635)
* Add env docs * Update content/components/esphome.md
1 parent 4f24388 commit 15636e7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

content/components/esphome.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Advanced options:
5252
- **platformio_options** (*Optional*, mapping): Additional options to pass over to PlatformIO in the
5353
platformio.ini file. See [`platformio_options`](#esphome-platformio_options).
5454

55+
- **environment_variables** (*Optional*, mapping): Environment variables to set during the build process.
56+
See [`environment_variables`](#esphome-environment_variables).
57+
5558
- **includes** (*Optional*, list of files): A list of C/C++ files to include in the (auto-generated) `main` file.
5659
The paths in this list are relative to the directory where the YAML configuration file is located or `<...>` includes.
5760
See [`includes`](#esphome-includes).
@@ -192,6 +195,27 @@ esphome:
192195
board_build.f_flash: 80000000L
193196
```
194197

198+
{{< anchor "esphome-environment_variables" >}}
199+
200+
## `environment_variables`
201+
202+
With the `environment_variables` option, you can set environment variables that will be available during the
203+
compilation process. This is useful when you need to pass configuration to build scripts, custom libraries,
204+
or PlatformIO build environments.
205+
206+
```yaml
207+
# Example configuration entry
208+
esphome:
209+
# ...
210+
environment_variables:
211+
HTTP_PROXY: "http://user:pass@10.10.1.10:3128/"
212+
PLATFORMIO_SETTING_ENABLE_PROXY_STRICT_SSL: "false"
213+
```
214+
215+
> [!NOTE]
216+
> Environment variables set here are only available during the build process. They do not affect
217+
> the runtime behavior of your device.
218+
195219
{{< anchor "esphome-includes" >}}
196220

197221
## `includes`

0 commit comments

Comments
 (0)