Overview
I'm using ESPHome for a variety of DIY-made devices. This page talks about how I manage my ESPHome configuration and devices.
- Tooling: Documentation for my tooling around ESPHome.
- Boards: ESP32 and ESP8266 boards for ESPHome.
- Components: Electronics components with ESPHome - sensors, displays, LEDs, GPIO and other hardware.
Using esptool
To upload a compiled firmware .bin
file over USB-UART on /dev/ttyUSB0
:
$ chip_name="esp32"
$ uart="/dev/ttyUSB0"
$ esptool.py --chip ${chip_name} -p ${uart} write_flash 0x0 firmware-factory.bin
Example collection
Example from ESPHome Cookbook1:
json::parse_json(id(http_request_id).get_string(), [](JsonObject root) {
id(template_sensor_id).publish_state(root["value"]);
});
Example from HTTP Request component2:
json::parse_json(id(http_request_data).get_string(), [](JsonObject root) {
id(player_volume).publish_state(root["vol"]);
});
Delay an action until something has been in a state for ${wait_time}
:
on_...:
then:
- wait_until:
condition:
for:
time: ${wait_time}
# combined with a lambda condition
condition:
lambda: |-
return id(entity).state;
- lambda: |-
id(entity).do_something();
This syntax is pretty YAML-heavy and hard to remember off-hand.
References
3
Contributing - ESPHome: Development environment, documentation standard, code standard, code generation, directory structure and etc.
4
DIY Examples - ESPHome: Sample configs, examples. blog posts, custom components.