Skip to content

How to Easily Configure New Unknown Devices with ESPHome

Last updated on August 31, 2024

Over the years, I’ve configured a few new devices with ESPHome. Lately, I loved being able to use Tuya Convert to flash new devices without ever having to unscrew and screws. While Tuya Convert makes the process of putting the initial firmware very easy, it also means I’m now not taking the devices apart. This means I can’t trace the pins to know which pin is doing what.

For me, most of these devices are ESP8266s in some type of smart home gadget. To identify the pins, I’ve created two firmware configs. The first has all of the pins set as binary inputs and the second has all of the pins set as switches. I’ve provided the code for the firmware and precompiled bin files.

Steps for identifying the pins

  1. Use Tuya Convert to flash device
  2. Flash the device with the binary inputs firmware
  3. Connect to the device on it’s broadcasted SSID, then open the devices webpage
  4. Use the device to activate pins, they’ll be listed in the log output
  5. Flash the device with the switches firmware
  6. Connect to the device webpage and activate one switch at a time
  7. Create your ESPHome config and finally flash your device through the web GUI

The code below is used for both versions of the firmware, I just comment out the conflicting parts. For those that want it the easy way, here are the precompiled versions:

substitutions:
  platform: ESP8266
  board: esp01_1m
  device_name: esphome_new_device_assistant
  friendly_name: "ESPHome New Device Assistant"
  reboot_timeout_wifi: 90s
  reboot_timeout_api: 1800s
  output_power: 17dB

esphome:
  platform: ${platform}
  board: ${board}
  name: ${device_name}
  esp8266_restore_from_flash: true

wifi:
  ssid: esphomeesphome
  password: esphomeesphome
  fast_connect: on
  reboot_timeout: ${reboot_timeout_wifi}
  output_power: ${output_power}
  ap:
    ssid: "ESPHome New Device Assistant"
    password: "esphomeesphome"

api:
  reboot_timeout: ${reboot_timeout_api}

ota:

web_server:
  port: 80

logger:

captive_portal:


#################################

switch:
# - platform: gpio
#   name: "${friendly_name} GPIO0"
#   pin:
#     number: GPIO0
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO1"
#   pin:
#     number: GPIO1
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO2"
#   pin:
#     number: GPIO2
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO3"
#   pin:
#     number: GPIO3
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO4"
#   pin:
#     number: GPIO4
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO5"
#   pin:
#     number: GPIO5
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO9 - DO NOT USE!!"
#   pin:
#     number: GPIO9
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO10 - DO NOT USE!!"
#   pin:
#     number: GPIO10
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO12"
#   pin:
#     number: GPIO12
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO13"
#   pin:
#     number: GPIO13
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO14"
#   pin:
#     number: GPIO14
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO15"
#   pin:
#     number: GPIO15
#     mode: OUTPUT
#     inverted: True
# - platform: gpio
#   name: "${friendly_name} GPIO16"
#   pin:
#     number: GPIO16
#     mode: OUTPUT
#     inverted: True

## REBOOT SWITCH
- platform: restart
  name: "${friendly_name} REBOOT"


binary_sensor:
- platform: gpio
  name: "${friendly_name} GPIO0"
  pin:
    number: GPIO0
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO1"
  pin:
    number: GPIO1
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO2"
  pin:
    number: GPIO2
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO3"
  pin:
    number: GPIO3
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO4"
  pin:
    number: GPIO4
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO5"
  pin:
    number: GPIO5
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO9 - DO NOT USE!!"
  pin:
    number: GPIO9
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO10 - DO NOT USE!!"
  pin:
    number: GPIO10
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO12"
  pin:
    number: GPIO12
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO13"
  pin:
    number: GPIO13
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO14"
  pin:
    number: GPIO14
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO15"
  pin:
    number: GPIO15
    mode: INPUT_PULLUP
    inverted: True
- platform: gpio
  name: "${friendly_name} GPIO16"
  pin:
    number: GPIO16
    mode: INPUT_PULLUP
    inverted: True

Published inDIY HardwareESPHome

Be First to Comment

Leave a Reply

Discover more from D Khaz

Subscribe now to keep reading and get access to the full archive.

Continue reading