In my previous tutorial, “Create a battery-powered Zigbee temperature sensor with an ESP32C6,” I explained in detail how to program a temperature sensor, based on an ESP32-C6 microcontroller and a BME280 sensor, communicating via the Zigbee protocol with its Home Assistant server.

In this new tutorial, I’ll show you how to configure this sensor with ESPHome. This tool allows for simple configuration using YAML, requiring no programming skills whatsoever.
Since Zigbee support isn’t yet integrated into ESPHome, the sensor will communicate with the Home Assistant server via Wi-Fi.
Because the sensor is battery-powered, I focused my efforts on optimizing its energy consumption.
Here’s the configuration that allows the sensor to record temperature, pressure, and humidity every 15 minutes, and then transmit this data to the Home Assistant server via Wi-Fi:
esphome:
name: capteur-temp-esp32c6
friendly_name: capteur-temp-esp32c6
on_boot:
then:
- output.turn_on: rf_switch
- delay: 100ms
- output.turn_on: antenna_select
esp32:
board: esp32-c6-devkitc-1
framework:
type: esp-idf
# Enable logging only for warnings
logger:
level: WARN
# Enable Home Assistant API
api:
encryption:
key: "your-key"
ota:
- platform: esphome
password: "your-pwd"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true # Disable Wi-Fi scanning, direct connection to ssid
on_connect:
# Update sensors
- component.update: bme280_measure
- component.update: battery_voltage
- delay: 5s # Delay to ensure that data is sent to HA
- deep_sleep.enter: deep_sleep_1
output:
- platform: gpio
pin: GPIO03
id: rf_switch
inverted: true # turn_on → set GPIO3 to LOW
- platform: gpio
pin: GPIO14
id: antenna_select
inverted: false # turn_on → set GPIO14 to HIGH
i2c:
sda: GPIO22
scl: GPIO23
scan: False
sensor:
- platform: bme280_i2c
id: bme280_measure
temperature:
name: "Temperature BME280"
pressure:
name: "Pressure BME280"
humidity:
name: "Humidity BME280"
address: 0x76
update_interval: never
- platform: adc
pin: GPIO0
name: "Battery Voltage"
id: battery_voltage
update_interval: never
attenuation: 12db # For ADC inputs > 1.1V (extends range to ~2.45V)
filters:
- multiply: 2.0 # Voltage divider (div 2) compensation
# Deep sleep configuration to save power
deep_sleep:
id: deep_sleep_1
sleep_duration: 15min # Sleep duration between wake-ups
Optimizing Wi-Fi configuration
In this ESPHome configuration, setting fast_connect to true disables Wi-Fi network scanning, thus speeding up the connection to your network:
fast_connect: true # Disable Wi-Fi scanning, direct connection to ssid
The on_connect block allows actions to be executed as soon as the Wi-Fi connection is established. The component.update instruction triggers the update of the relevant sensor. Therefore, the BME280 measurements and battery voltage are automatically updated thanks to this configuration:
on_connect:
# Update sensors
- component.update: bme280_measure
- component.update: battery_voltageThis update is followed by a 5-second delay, the time required for the sensor to transmit its data to the Home Assistant server via Wi-Fi. The ESP32C6 then enters deep sleep mode to minimize battery consumption.
- delay: 5s # Delay to ensure that data is sent to HA
- deep_sleep.enter: deep_sleep_1 Deep sleep configuration
Deep sleep is generally configured by two parameters:
- run_duration : The duration for which the ESP32C6 must be active, i.e., executing code.
- sleep_duration : The duration for which the ESP32C6 remains in deep sleep mode.
Here, only the sleep_duration parameter is configured. Indeed, the activity duration should not be defined if you want the ESP32C6 to enter deep sleep mode via the deep_sleep.enter instruction.
# Deep sleep configuration to save power
deep_sleep:
id: deep_sleep_1
sleep_duration: 15min # Sleep duration between wake-upsExternal antenna configuration
As explained in the ESP32C6 Getting Started guide, enabling the external antenna requires specific configuration. By default, the ESP32C6 uses its internal ceramic antenna for Wi-Fi.
The choice between the internal and external antennas is made via GPIO pin 14. For this selection to take effect, GPIO pin 3 must first be set low, which activates the RF switch control.
- GPIO14 in low state (default setting): the device uses the integrated ceramic antenna.
- GPIO14 high: the device switches to the external antenna.
Here is the configuration to use in ESPHome to activate the external antenna:
esphome:
name: capteur-temp-esp32c6
friendly_name: capteur-temp-esp32c6
on_boot:
priority: 600
then:
- output.turn_on: rf_switch
- delay: 100ms
- output.turn_on: antenna_select
output:
- platform: gpio
pin: GPIO03
id: rf_switch
inverted: true # turn_on → set GPIO3 to LOW
- platform: gpio
pin: GPIO14
id: antenna_select
inverted: false # turn_on → set GPIO14 to HIGHMeasuring Wi-Fi signal strength
To confirm that the sensor is receiving a good Wi-Fi signal, it is useful to configure the RSSI reporting in Home Assistant.
This information is provided by ESPHome and is measured in dBm. To obtain it, simply declare the wifi_signal sensor in the ESPHome configuration:
sensor:
- platform: wifi_signal
name: "Signal WiFi"
id: wifi_signal_strength
update_interval: never The measurement is refreshed when the ESP32-C6 is connected to the Wi-Fi network:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true # Disable Wi-Fi scanning, direct connection to ssid
on_connect:
# Update sensors
- component.update: bme280_measure
- component.update: battery_voltage
- component.update: wifi_signal_strength
- delay: 5s # Delay to ensure that data is sent to HA
- deep_sleep.enter: deep_sleep_1 The RSSI feed to Home Assistant confirms the beneficial contribution of using an external antenna.


Power consumption
When the sensor is active and transmitting its data to the Home Assistant server via Wi-Fi, its power consumption fluctuates between 25-80 mA. When the ESP32C6 is in deep sleep mode, its power consumption is 15 μA.
The following video illustrates the sensor’s power consumption when it wakes up from sleep (t = 3 s), takes measurements, transmits them to the Home Assistant server via Wi-Fi, and then returns to deep sleep (t = 10 s).
