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
- Use Tuya Convert to flash device
- Flash the device with the binary inputs firmware
- Connect to the device on it’s broadcasted SSID, then open the devices webpage
- Use the device to activate pins, they’ll be listed in the log output
- Flash the device with the switches firmware
- Connect to the device webpage and activate one switch at a time
- 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
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 |
Be First to Comment