# https://github.com/somarkram/esphome-examples/blob/d316a7bf3b68ad635c96c0e74be8be6dfc326ade/sonoff-th16-si7021.yaml
substitutions:
name: sonoff-th16-rcwl0516
friendly_name: Sonoff TH16
esphome:
name: $name
comment: Sonoff TH16
name_add_mac_suffix: true
# This will allow for (future) project identification,
# configuration and updates.
project:
name: cpyarger.sonoff-th16-rcwl0516
version: "1.1"
esp8266:
board: esp01_1m
dashboard_import:
package_import_url: github://cpyarger/esphome-templates/sonoff-th16-si7021.yaml@main
# Wifi Setup
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable logging
logger:
# Enable Home Assistant API
api:
#ota:
# - platform: esphome
# password: "9090909090"
# num_attempts: 3
# safe_mode: no
status_led:
pin:
number: GPIO13
inverted: True
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Button"
on_press:
then:
- light.toggle: this_light
- platform: status
name: "${friendly_name} Status"
- platform: gpio
pin: GPIO14
name: "MW Sensor Bathroom L1"
id: mw_sensor_bath_L1
device_class: motion
filters:
- delayed_off: 10s # wait for 10 seconds without motion to send OFF.
# Play with this value, to find the right balance. For bed/bathroom or office it can be much higher compare to a walk through hallway.
output:
- platform: gpio
id: output_1
pin: GPIO12
light:
- platform: binary
output: output_1
name: "${friendly_name} Light"
id: this_light
# Sensors definitions
# See https://esphome.io/components/binary_sensor/ for all config Parameters
# https://vdbrink.github.io/esphome/microwave_radar_sensor_rcwl-0516.html
this code works flawless now, thanks to @ShadowFist
Linking .pioenvs/sonoff-th16-rcwl0516/firmware.elf
RAM: [==== ] 38.1% (used 31248 bytes from 81920 bytes)
Flash: [==== ] 37.2% (used 380875 bytes from 1023984 bytes)
Building .pioenvs/sonoff-th16-rcwl0516/firmware.bin
esp8266_copy_factory_bin([".pioenvs/sonoff-th16-rcwl0516/firmware.bin"], [".pioenvs/sonoff-th16-rcwl0516/firmware.elf"])
esp8266_copy_ota_bin([".pioenvs/sonoff-th16-rcwl0516/firmware.bin"], [".pioenvs/sonoff-th16-rcwl0516/firmware.elf"])
======================== [SUCCESS] Took 301.46 seconds ========================
INFO Successfully compiled program.
ERROR Cannot upload Over the Air as the ota configuration is not present or does not include platform: esphome
I tried to do an OTA update before installind the device into it’s not very nice to access location.
Can the sonoff TH16 receive OTA updates, it is limited regarding memory?
INFO ESPHome 2025.7.4
INFO Reading configuration /config/esphome-web-7f9f08.yaml...
ERROR Error while reading config: Invalid YAML syntax:
while parsing a block collection
in "/config/esphome-web-7f9f08.yaml", line 28, column 3
expected <block end>, but found '<block mapping start>'
in "/config/esphome-web-7f9f08.yaml", line 29, column 4
To clean your cache, for your ESPHome device, select the three dots on the bottom right corner (the “Overflow menu”), and then the “Clean Build Files”. This will purge the existing files, and result in a fresh download of the subroutine files needed to compile your final code, possibly eliminating conflicting version issues and corrupt files. Your next compile will take a few seconds longer while it downloads, but that is a one off, and gives you confidence you have good files. The new files are “cached” again, until they need to be overwritten, usually as part of an upgrade. Given there are upgrades of different software all the time, the chances of some being the wrong version can vary, depending on the order they are installed and the dependency lookup tables. Flush and re-download takes care of it. Use wisely, especially if having errors.
Bonus: Disk space savings as some of the old crud hangs around forever if you don’t flush it.