ESP Nodemcu v3 not detected in ESPHome

Tags: #<Tag:0x00007f3269bd2818>

Hi,
I’m sure I am making a rookie mistake, but I just received my first ESP8266s and wanted to start playing with ESPHome. I installed the addon for Hass.io, created the first node, but am unable to get hassio see the device so I can select and flash it for the first time (after that over the air can be used as I understand it).
I am running Hassio on an RPI3 and the only options it sees is the over the air and the USB stick plugged in with the Zigbee2MQTT controller.

I have tried:

  • changing USB cables
  • changing USB ports in the RPI
  • pressing the flash button on the ESP.
  • restarting the addon when doing the above as per the documentation to allow the USB to be seen (although I don’t even see it in the hardware button in the supervisor section).

Is there something basic I forget? I know you can flash through the Arduino IDE, but I’d not be sure how to do that if you are using the ESPHome module and not traditional MQTT protocol to integrate with Home Assistant as the file generated by ESPHome uses us a YAML file, so I am under the impression that I can only flash through the ESPHome module on the RPI… not?

Thanks for any guidance from a newbee in this journey… Eager to get started, to learn more and help others!

Try

Works for me

1 Like

You can compile and download generated .bin file.
I do this on my ESP32 devices:
With Arduino IDE load the OTA Web Updater sketch, fill up the infos ( SSID, password ) and upload it to the esp.
Then the esp will be available with a basic http site, just upload that .bin and after the upload it will be visible in esphome/HA.

Thanks for the feedback! This looked like a simple solution, but unfortunately doesn’t seem to work for me. I think the main issue is that the USB is not detected in the hardware part of the supervisor, even prior to (re)starting the add-on…

What does it mean?
I don’t know about esp8266 but with esp32 you have to check the right partition size, it has to allow OTA.

Duh… wanted to answer @MarkB1, will correct the post. I am looking into your suggestion now, but need to find the scetch and install the board in Arduino IDE.

No problem, i’m not an esp8266 owner but it’s not that hard find a sketch ( many are prebuilts when you install the board ):
immagine


immagine

I found this and it compiles, if you want to try:

// I use for my toys simple OTA through a browser.
// When using port mapping on router, it works from anywhere.
// Here is the entire code that is necessary for that.
// The uploaded file must, of course, be in binary form as *.bin
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPUpdateServer.h>
const char* ssid =     "YourSSID";     // Set your router SSID
const char* password = "YourPassword"; // Set your router password
#define OTAUSER         "admin"    // Set OTA user
#define OTAPASSWORD     "admin"    // Set OTA password
#define OTAPATH         "/firmware"// Set path for update
#define SERVERPORT      80         // Server port
ESP8266WebServer HttpServer(SERVERPORT);
ESP8266HTTPUpdateServer httpUpdater;
//-----------------------------------------------------------------
void setup(void) {
  WiFi.begin(ssid, password);
  /* wait for WiFi connect */
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
  }
  httpUpdater.setup(&HttpServer, OTAPATH, OTAUSER, OTAPASSWORD);
  HttpServer.onNotFound(handleNotFound);
  HttpServer.begin();
}
void loop(void) {
  HttpServer.handleClient();       // Listen for HTTP requests from clients
  // ...
  // ...
}
/* Send HTTP status 404 Not Found */
void handleNotFound() {
  HttpServer.send(404, "text/plain", "404: Not found");
}

Sorry I was getting ahead of myself before, first as correctly said by Malaga83 create your node.
Below is an example yaml config for one of my Nodemcu webserver and ota enabled.

esphome:
  name: node_mcu_ct_clamp_sensor
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "redacted"
  password: "redacted"  
  power_save_mode: none
  
  manual_ip:  
   static_ip: 192.168.0.xx
   gateway: 192.168.0.2
   subnet: 255.255.255.0


  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "NodeMcu Ct Clamp Sensor"
    password: "OwrTFHz9S8uO"

captive_portal:

# Enable Web server.
web_server:
  port: 80

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

text_sensor:
  - platform: version
    name: "ESPHome Version NodeMcu Ct Clamp Sensor"
    
# Example configuration entry

  - platform: wifi_info
    ip_address:
      name: ESP IP Address NodeMcu Ct Clamp Sensor
    ssid:
      name: ESP Connected SSID NodeMcu Ct Clamp Sensor
    bssid:
      name: ESP Connected BSSID NodeMcu Ct Clamp Sensor
      
      
# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time
    
   

sensor:
  - platform: ct_clamp
    sensor: adc_sensor
    name: "Measured Current"
    update_interval: 10s
    filters:
      - calibrate_linear:
          - 0.0 -> 0
          - 0.01826 -> 5.15
          - 0.01952 -> 6.754
          - 0.01925 -> 7.09
          - 0.04057 -> 16.02
          - 0.07834 -> 31.37
            
          
  - platform: adc
    pin: 17
    id: adc_sensor


  - platform: ct_clamp
    sensor: adc_sensor
    name: "raw values"
    update_interval: 10s
    unit_of_measurement: mA
    accuracy_decimals: 5    
    
    
# Sensors with general information.

  # Uptime sensor.
  - platform: uptime
    name: node_mcu_ct_clamp_sensor Uptime

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: node_mcu_ct_clamp_sensor WiFi Signal
    update_interval: 60s



status_led:
  pin:
     number: D4
     inverted: TRUE

So after creating and validating the yaml hit compile and download binary.

image

upload your binary with


download page

Binary should upload and if successful you should see the log output in the console window

I then had to use the ping configurations in my first post to see the device online or offline status.

You should only need to use this method the first time you upload a esphome binary, after that ota works fine for me.

1 Like

Thanks both for your great help so far! New discoveries made…

  • Apparently there are different types of cable for microUSB… I had tried 2 and when trying to connect with these cables to the PC, the PC did not discover the devices either… so I found a few other cables and I found one that makes it discover on the PC!
  • So with this new cable I connected it to the RPI and Bingo! It discovered the device! Issue now is : When selecting upload for the node in ESPHOme, my RPI crashes and goes in a hung state at complilation… (memory issue?- should this not be possible on an RPI?

These are my system sensors before the upload action and looks OK (CPU somewhat higher than normal due to the boot).

  • When using the same cable on a PC, as said, it detects the device, but I cannot select it in the Arduino IDE as it looks like it is missing a driver to recognize the device.
    image

So both routes seem to be stuck at the moment - I either need to find a driver for the PC or find out why the RPI crashes… Anyone has any idea?

For COM driver: C:\Program Files (x86)\Arduino\drivers
Check this: https://www.arduino.cc/en/Guide/DriverInstallation
This is my ESP COM:
immagine

Thanks @MarkB1 and @Malaga82 ! I found the right driver somewhere else and indeed I am now able to compile and flash via the Arduino IDE. I installed the Webupdater and now can upload through that…

I’m however now still stuck with the fact that to generate the file, I have to compile with ESPHome on the RPI and it crashes for me, so don’t get to the point of the file generation. Do you have ESPHome running on an RPI3 with this addon too and works for you or you have a different configuration?

i do have a pi3 b+, but at the moment is off.
Do you have a swap file? Maybe you can try to create one and add it if don’t have it.
I don’t know if you have hassOS installed or supervised ( HA on top of a linux installation ) and if it can be done.
Maybe this is related?

Mine is on my dev system Pi 2 works fine


image

Maybe try using the beta or dev versions of ESPhome?

Do you have supervised install on linux system( raspbian? ) ?
Maybe @Piggyback has hassOS installed directly on sd, so the system is a bit different.

Correct. Hassio (or HassOS indeed) directly on SD and based on the thread @Malaga82 found, it does look as a memory issue. I didn’t think i have that many add-ons running (“heavy ones” I would think are Unifi controller and Zigbee2MQTT).

I’ll look into

  1. Disable addons during compile and see if that works
  2. Dev branch and see if that makes a difference.
  3. the swap file option for sure and if that can be done. I use an SD card larger than the space that is being used by HA.

If that doesn’t work, I guess I’ll just have to flash it through Arduino IDE and use traditional MQTT…

First option already worked! Definitely the issue was memory usage…
I was able to finish the compile and upload only disabling the Unifi controller addon. It used 33% of memory. When disabling, total memory usage went down from 77% to 43% and that was sufficient to complete the compile. So I at least have a workaround now!!
Thanks again for the help!!!

So to completely solve my issue from the beginning of the post :1) use a decent USB microUSB cable and 2) ensure enough available memory to complete the compilation!

:smiley: :+1:

1 Like

Tks, it work for me too. It take me 1 day to find solution

1 Like

You need at least 500 MB of free memory to compile/upload an EspHome module.
Also, not all USB cables transfer data, a lot of them just provide the 5 volts but they do not have the wires to transfer data.