I have ESP32 connected to my win10 via USB and connection works - now what?

I have spent hours trying to solve how I can connect this to my home assistant on Raspberry Pi. Every instructible seems to be telling how to connect it via USB, initialize port via device manager and the test the connection with Putty

OK. Thatts fine.

BUT WHAT AFTER THAT???

The instructible talk next about using ESPHome and making your first custom firmware, but how can I before that get this damned thing connected to wifi???

I have seen tons of configuration files to be loaded to ESP32, but how, when I donā€™t have the connection.???

ESPHome requires " Please enter connection settings of your ESPHome node", but how can i insert them, because I cannot get or set them anywhere? The PuTTY terminal, which is the only thing that has let me connect it via USB does not let me to write a single character on the terminal and even if it did, I donā€™t know what should I put there?

Running HA OS with latest updates on Raspberry Pi 4

You appear to be very lost :slight_smile: Lets see if we can help.

The fundamental thing is that the first flash of your esphome firmware must be over usb. So connect the esp32 to your pi via usb.

Then go to the esphome interface on the home assistant web interface, and set up a yaml firmware file.

Then click ā€œinstallā€ and choose the option for uploading to the computer running esphome dashboard.

EDIT: instructables.com is not a source of home assistant or esphome documentation.

I see your pain and I can feel it, because I felt the same when I started out with all of this, and sometimes still do :slight_smile: The documentation is sometimes really weird and cluttered, especially when you donā€™t use the standard way of working.

First question: do you WANT to use your laptop from here on, or would you prefer just to use the Rapsberry and the esphome dashboard inside HA? You have Pi4, depending on the RAM version you have, compiling and flashing directly from the PI would work. I have HA running on an older Pi3, so I use my Win10 Laptop as the main way to manage my esphome devices, as my Pi crashes when I try it directly from there.

If you want to use the laptop for coding and flashing, then this was my way to get things to work:

  1. Install python on the laptop (Installing ESPHome Manually ā€” ESPHome), and really make sure to check the ā€œAdd Python to PATHā€ box, it really really is a must.
  2. connect your esp to a usb port (for me it didnt need a dedicated driver, windows set up the usb to serial port automatically)
  3. go to your command line (cmd) and use the esphome wizard as described in Getting Started with the ESPHome Command Line ā€” ESPHome

This will then create a yaml file in the directory where you called the wizard command, so I would call it from a dedicated esphome directory you created on your laptop before. This is more for having everything in one place, not a technical need.

From there on you can open that yaml file in a good editor (I use notepad++), and when you have a first example code saved, you can compile and flash it to your esp via the run command described in Getting Started with the ESPHome Command Line ā€” ESPHome
During that, if everything works fine and you donā€™t have errors in your code, you have to choose if you want to flash the esp via usb or via WiFi. If you have the esp connected to the laptop anyway I would go for USB.

Once that is done, HA will either bring a notification that it found a new device ready to setup, or you might need to add a new esphome integration manually, the host address is then usually the name of your yaml file, combined with .local, so e.g. livingroom.local if your yaml file was livingroom.yaml.

Important note about this approach: a lot of hints and tipps around esphome usage you find here in the forum and online is based on the assumption that your esphome devices are setup and available via the esphome dashboard within HA. If you go with my approach, your devices will not show up in that dashboard. This does not limit the functionality within HA, but it makes it sometimes harder to use hints and workarounds you find here.

Hope this helps a little. Cheers!

1 Like

Hi

Is it OK to use both?
I intend to use HA ESPHome in my rasp 4 4GB, but could also work directly from PC as well

Iā€™m busy now, so I donā€™t have time to play with these more, i performed the 1st on your list (installing python)

Not that easy as that. From the link provided it instalkled it, yes, nut cmdā€™s ersioon check did not find it. Needless to say i included it to path as well

C:\Users\SystemLord>python --version
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

I did again the the install from MMS store and now it returns the version with

python --version

What comes to path, this is on user variables

image

and thiis on system variables:
image

How ever, installin wheel and esphome with pip returns tons of warnings like

WARNING: The script normalizer.exe is installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.

ā€¦this is just one of them

Do I need to take some steps back anbd try otherwise?

P.S.
what comes to @nickrout 's comment on instructables, it has nothing to do with instructables.com -site, which I donƤt even know, ment just general instructions to be found via Google (which has been sucking for yearsā€¦) from sites like this, but they have not been really useful. E.g. @Lakini 's link I saw many times when searching, but bypassed immediately, since my PC has nothing to do with docker commands etc. stuff described in link.

Did you do a full restart of the laptop after the installation? I think thatā€™s needed for the PATH varibles to fully kick in.

I donā€™t know how the combination of both works, my guess is that when you want to work with the dashboard version anyway, then I would try to go down that route exclusively and ditch the laptop approach. But for that I cannot provide much help.

No, did not restart. Thatā€™s because Iā€™m not on laptop, but on power workstation with loads of software open on my 4 big panels, and getting them back to continue working takes timeā€¦

I thought the path warning thing had something to do with the fact it seemed to have installed itā€™s stuff on some weird cache dir like

...AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts

ā€¦the name of which of course I cannot try to anticipoate add to path, at least beforehandā€¦

I thought after 1st configuration via USB everything should happen via OTA and could do that from several locations & machines, supposing that I can first download the existing conf from ESP and mod that. Which, of course I do not know yet, is it even possible. The upload probably is, yes, but does it include all the comments etc etc.

ā€¦and because it installed it to tha strange cache (I suppose), I need to ask againb, do I need to reinstall it, and if so, how?

That is very old fashioned, nowadays you can just use the esphome from HA web interface, and program your esp on a local computer :thinking:

That is very old fashioned, nowadays you can just use the esphome from HA web interface, and program your esp on a local computer :thinking:

I think his point was, that if some earlier models of RaspPi canā€™t handle it resourcewise, this could be a way to go.

As I do not know yet, how its gonna be, why not make both possibleā€¦ Probably try Raspberry + HAOS + ESPHome first, though.

Still, folks, any idea, should I do something to that Py + wheel + esphome installation?

But which computer does the heavy lifting in that scenario? My understanding so far is that I only have 2 options to choose from: either itā€™s the raspberry that runs HA, or itā€™s my laptop with commandline esphome. If there is a method where I do the management within HA, but at the same time the processing power of the laptop does the compiling etc, then this would work for me, but for now Iā€™ll stick to ā€œall laptopā€.

@mekanics , about your issue with python etc.: I donā€™t know about your concrete error messages, but I remember that when I tried it the first time, I didnt have the PATH box checked, AND didnt reboot my laptop. At the second try I installed everything from scratch, checked the box, and rebooted my laptop. Then it worked like a charm.

Maybe you can try something like this (refresh environment variables without reboot windows 10 | Search For Fun), but now Iā€™m just googling and guessing, sorry.

@Lakini I can habdle env.vars OK, but the point is, why does Py install tremendous amount of stuff into a location like:

C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts

ā€¦and dares then to nag that to such path there are no path variables set?

It just does not seem to make sense, especially, when along that path there is one folder called ā€œcacheā€, and i doubt that in general many pieces of software intended to stay in use for longer period of time purposedly installs their code in folder named caches or temps or alike?

So, this makes me think there actually IS no sense to this and there probably is something wrong. Or the Py installer jus is crap.

Error messages:

 WARNING: The script tabulate.exe is installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pyserial-miniterm.exe and pyserial-ports.exe are installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts alldefconfig.exe, allmodconfig.exe, allnoconfig.exe, allyesconfig.exe, defconfig.exe, genconfig.exe, guiconfig.exe, listnewconfig.exe, menuconfig.exe, oldconfig.exe, olddefconfig.exe, savedefconfig.exe and setconfig.exe are installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script normalizer.exe is installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script async-json-rpc-server.exe is installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script uvicorn.exe is installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pio.exe, piodebuggdb.exe and platformio.exe are installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts espefuse.exe, espsecure.exe and esptool.exe are installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script esphome.exe is installed in 'C:\Users\SystemLord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Especially, when the target folder as a last directory in the path is ā€œScriptsā€. There is an environment variable defined palce for ā€œScriptsā€ and files

image
and

image

Shouldnā€™t the files be there? Those are te paths the installer made and yet, e.g. folder

C:\Program Files\Python310\ 

does not even exist?

Raspberry Pi 4 should be able to deal with itā€¦

PS, if you donā€™t have any hardware, you can also use the online compiler:
https://web.esphome.io/

ESPHome Web allows you to install new versions and check the device logs directly from your browser

OK, I unistalled Python with unistaller.

The interesting part is, that it still starts OK, even it is not anymore visible in the uninstaller. And even after restart. All the files seem to be intact there in that mile-long cache folder. Even after restart. Have to sort out that later.

I plugged my board (ESP32 DevKit V1 ) to the other one of my 2 systems.

Autodiscovery recognizes it as:

image

ā€¦which it might with suitable firmware in some conditions even be, but that was not I was expecting to see.

If I add an itegration ESPHome, I get this:

image

What do I put on the first line? ā€œlocalhostā€ does not seem to work, and digging the device address from Supervisor gives /dev/ttyUSB0. Doesnā€™t seem to work, though

Whats that reference to YAML containing ā€˜apiā€™? With google i found nothing useful.

Is it really so, that for this kind ā€œuse caseā€ I am at now, there are no simple instructions to be found (at least i did not find) and everything has to dragged from various forums bit by bit?

The usb port is used for programming only,
after the programming the network is used.
So for host youā€™ll need to fill in the IP addressā€¦

The IP address can be set manually in esphome yaml, as well as the api parameter

With the esphome you creat the configuration yaml.
After this you will compile the bin file.
The first tine this bin will be flashed on the esp by serial (usb), after that it can updated OverTheAir(OTA)

So for host youā€™ll need to fill in the IP addressā€¦

That has been the point the whole time. How can I connect the damn thing to the network so it even gets the IP, when I have the whole time been trying to get an an answer how to get in the device to do it??? (see first post)

You configure wifi settings in esphome yaml
Then you can either reach it by using the dns name, or lookup the ip in your router

The usb port is used for programming only,
after the programming the network is used.
So for host youā€™ll need to fill in the IP addressā€¦

The IP address can be set manually in esphome yaml, as well as the api parameter

With the esphome you creat the configuration yaml.
After this you will compile the bin file.
The first tine this bin will be flashed on the esp by serial (usb), after that it can updated OverTheAir(OTA)

Earlkier I suippose the discussion was that this 1st time prfogramming is done via Python from PC or from Raspberry with ESPHome.

No it looks like the they, and I also gave up with Python approach.

Now Iā€™m in the situation I have

  1. configured the COM-port parametres.
  2. Checked the connections with PuTTY, and it works.
  3. Currently I connected the module to Raspberry Pi USB port.

WHAT DO I DO NEXT?

Are there any detailed instructions???

Edit: After all this 2 -day discussion Iā€™m sitting exactly in the same spot than in the verys fitrst question.

  1. Obviously I need some kind of configuration file to be made. What should be in it? (link?)
  2. With what & how I push it to the module? (link?)

As stated above, nowadays there is no longer a need for Python or CLI on a PC or laptop to do the initial install of Esphome. It is all done through the Esphome configuration web interface in Home Assistant, as reached from the left menu bar or from the addons page. The add new device button is in the bottom right of the Esphome configuration page.


On your PC or laptop, connect the ESP32 to the usb. Use the web interface from esphome to do add a new device using the wizard. If the browser lacks the proper support it will tell you what it needs to fix it (I needed to use Chrome instead of Firefox and install a driver for the USB chip on the ESP32).

You will need to pick the right board and supply your wifi credentials. Home Assistant will then create your first firmware and flash it for you, complete with the right wifi settings. Youā€™ll see in the logging if it connects to wifi correctly. If it does, you will no longer need the PC usb connection method.

OK, thx! @Edwin_D

This is what I was looking for. Configuration done at this point.

One question remains: I have 2 raspberry Pi 4 4GBs with HAOS running and they both use the same wifi mesh network when applicable. The device just added is visible in both systems. Is it OK to ā€œAdoptā€ it to both? Is there any use for such?

E.g. from possible collision side of things comes into mind, that how is the configuration file (under ā€œEDITā€ in ESPHome display ā€œboxā€) treated?. is it a local copy, or is it a synced copy of what is in the device? Meaning it might cause problems if I edit it from a wrong systemā€¦