From the kitchen drawer
YAML snippet maker
Pick an ingredient, give it a name and a pin, and add it to the card. The maker writes a starting snippet you can paste into a device configuration, grouped under sensor:, binary_sensor:, switch: and i2c:. It only arranges what you type into fixed templates: it does not know your board, and it does not check whether a pin exists, is free or is safe to use.
Your recipe card
No ingredients yet. Add one in the form and the draft YAML appears here.
Draft YAML
How the snippet is written
Each ingredient becomes one of these fixed templates. Words in capitals are replaced with what you typed. Indents are two spaces per level.
sensor:
- platform: dht
pin: PIN
temperature:
name: "NAME Temperature"
humidity:
name: "NAME Humidity"
update_interval: SECONDSs binary_sensor:
- platform: gpio
pin: PIN
name: "NAME" switch:
- platform: gpio
pin: PIN
name: "NAME" i2c:
sda: SDA_PIN
scl: SCL_PIN What the maker assumes
- Several ingredients of the same kind are listed under one key:
sensor:,binary_sensor:orswitch:hold a list. If your file already has that key, paste the list items under it rather than adding the key a second time. - The
i2c:block holds a single bus as a mapping, not a list. If your configuration already has ani2c:block, edit it instead of pasting a second one. When you configure more than one bus, the I²C page uses a list of entries with uniqueidvalues, and a sensor on a particular bus setsi2c_id; see “Multiple I²C Buses” on that page. - The DHT template leaves out
model:, so ESPHome uses its default model detection. The DHT page lists the models you can set if detection fails. - Names are written in double quotes, with any quote or backslash you type escaped.
- The update interval is whole seconds from 1 to 86,400, written as for example
60s. The starting value of 60 is ESPHome’s default for the DHT sensor. The upper limit is this maker’s own choice, not an ESPHome rule. - Pins are copied exactly as you type them. A warning appears when the same pin number is used twice on the card, so 16 and GPIO16 count as the same pin and the same SDA and SCL pin is refused. The maker cannot resolve board-specific names such as D2, so it does not catch those, and it does not check whether a pin exists, is free or is safe.
- Editor limits, which are this maker’s own and not ESPHome rules: 20 ingredients on the card, names up to 60 characters and pin labels up to 24 characters.
- The snippet is a draft, not a checked configuration. Add this draft to an ESPHome configuration for your board, and configure networking and integration for your setup: ESPHome documents Wi-Fi, Ethernet, the native API and MQTT as options. Check every setting against the official component page before you install it.
Sources
- DHT Temperature+Humidity Sensor, ESPHome documentation (esphome.io)
- GPIO Binary Sensor, ESPHome documentation (esphome.io)
- GPIO Switch, ESPHome documentation (esphome.io)
- I²C Bus, ESPHome documentation (esphome.io)
- Ethernet Component, ESPHome documentation (esphome.io)
- MQTT Client Component, ESPHome documentation (esphome.io)