ESPHOME on RPI plus my First October Postbag

Keystudio ESP32 Base


By now you’ll have seen my frantic posting about ESPHOME, running on the PC command line to allow the creation of ESPHOME-equipped ESP32 and ESP8266 devices… I’ve been making little display projects, the likes of which I could only dream of in TASMOTA. I originally tried ESPHOME on the Raspberry Pi using HOME ASSISTANT – and had all sorts of issues – and the native Home Assistant install of course doesn’t have RPI-CLONE as became painfully obvious when the SD failed. I then put ESPHOME on Windows and that works a treat – BUT for the DASHBOARD and according to the ESPHOME forums, Dashboard isn’t supposed to run on Windows yet. I hope they work on that and fix it as it ALMOST works.

Meanwhile, I’ve been off to get a new RASPBIAN image, installed that on a microSD on the PC (My RPIs are not connected to screens and keyboards), added an empty SSH file into the boot partition which appears on the PC – put the SD into my RPi4 which I could now access using SSH (I use Mobaxterm on the PC) and now having access to Raspbian on the new PC, I firstly added RPI-CLONE…

	$ git clone 
	$ cd rpi-clone
	$ sudo cp rpi-clone rpi-clone-setup /usr/local/sbin

And that gave me the confidence to move onto installing ESPHOME on the RPi – which again is just a matter of a couple of lines of instruction. Once that was done, on the RPi4, I had to add ESPHOME to the path (the instruction is on the ESPHOME site – another one-liner…) then ran the instruction:

esphome dashboard config/

I left that running (remember I’m accessing the RPI from my PC using Mobaxterm) and in Chrome on my PC I keyed in the address of my RPi4 and the dashboard port as above and lo and behold – in Chrome on my PC – that SIMPLES project wasn’t there initially – the screen asked me to add a new device – so I picked the name SIMPLES, told the ESPHOME Dashboard I wanted to use an ESP32 and gave it the name and password of the access point the ESP32 should use – and the result… my first project successfully created on the RPi as below.

ESPHOME Dashboard on RPi4

For creating projects on the command line I refer you to my other ESPHOME articles – that’s what I’ve been doing up to now using Microsoft Terminal and Microsoft Visual Studio Code – but now it looks like I no longer need a separate editor as the whole lot is now being done on the RPi (granted, a dark theme would have been nice). See the INSTALL command on the right – just like my previous attempts on the PC – USB first – then WiFi subsequently – I’ll not go into this any further as the principle is identical to the command line version I ran on the PC.

BUT the next question might be: And how do I keep ESPHOME Dashboard running after I close my PC connection to it? I just found that out. A minor variation of the above SSH session. No extra software needed, nohup is already part of the RPi Distro. Simply break out of that command below and the Dashboard will continue to run.

nohup esphome dashboard config/ &

Before leaving – having now managed to get DASHBOARD to keep running – surely a better way is to simply have it run on powerup? Well, because this is a user program not run by root – that took some doing – finally it all came together..

sudo crontab -u pi -e

The -u pi bit is important. This will take you into cron – and at the end of the file that opens – I put THIS…

@reboot sleep 10 && /home/pi/.local/bin/esphome dashboard /home/pi/esphome/config/

After the next reboot – that was DASHBOARD running from powerup on my RPI. Job done.

Meanwhile – the Postbag

I was just beginning to wonder if the postman had deserted me when a barrage of mail arrived yesterday, starting with our normal post-lady delivering a little package featured in the first image up at the top and below. First things first, no I’m not promoting Keystudio or AliExpress – I just happened to search for this ESP32 development board on AliExpress last week as I’m doing lots of work with ESPHOME and I have a couple of ESP32 boards lying around (40 pin board) and like all such boards they are SADLY lacking in grounds and power connectors.

ESP32-based board, mounted on the KeyStudio baseboard

If you check out my main ESPHOME article you’ll see the problem in one photo in particular – as soon as you start adding peripherals such as displays and sensors onto these ESP32 boards in particular, you quickly end up with a dog’s breakfast mess of wires – I use the dupont connector leads you see all over Ebay and AliExpress etc. and I usually end up cutting ground and power lines to graft on new leads for additional peripherals. Very quickly it all gets messy.

SO, last time I was ordering bits and pieces including Dupont connectors I ordered one of the above “shields”. Beware not all ESP32-based boards have the same pinout – compare before considering a “shield. Here on the left, we see the rows of blue, red and black connectors – blue are the ESP32 pins, handily marked on both the top and underside.

Then all the blacks are ground, the reds are 3v3 and the yellow strip of three, top left are 5v. I currently have the board running on USB but I could use the barrel connector (7-12v input) if I wanted – that would also allow me to use the on-off switch you see top left of the image above. Between this and the Dupont connectors I’m in heaven – I can now wire up multiple LEDs, sensors and other devices without bodging. Now, if someone had just thought to stick maybe 3 sets of I2c connectors on the end…

All I need now is a reasonably-priced equivalent shield for the ESP8266 – thanks for your suggestions – they’re on the way.


10 thoughts on “ESPHOME on RPI plus my First October Postbag

  1. My preference is to install on RPI.
    Their website simply says “pip3 install esphome” and nothing else relating to installation. Where does that install and do I need some path amendments.

    1. It installs in a hidden folder somewhere. It puts the ESP binary and more in .local/bin – so I had to add that to my path:

      export PATH=”/home/pi/.local/bin:$PATH”

      I then created under /home/pi the folder set esphome/config

      and then (after a reboot) ran esphome as in the blog above. THAT bit is easy – getting it to KEEP running when the SSH session is done (assuming you have a headless PI) is harder – just cracked that – getting it to run automatically at boot (not really essential but nice to have) is still eluding me.

    1. Thanks. Ordered one from Ali. That eBay user won’t ship to Spain. Amazing considering it came from China…meanwhile some hopeful con artist on is trying to charge twice the price

      1. It’s been a while since I used one of these but I seem to remember that some of the 5V pins near the barrel connector are powered by the USB connector, and other 5V pins are powered by the barrel connector only. So if you have e.g. a LCD screen connected, you may have to swap the power leads if you switch from USB to the barrel connector.

        1. Hi
          I tried a fresh Raspian install followed by ESPhome install but when I progress I get ” esphome: command not found”
          I cannot find any reference to aforementioned path instructions on the ESPhome site.

          1. I ended up creating an ESPHOME folder under /home/pi and inside that is the config folder… if using the dashboard, all yaml files and other info end up in that config folder. On the PC I had an ESPHOME folder and yaml files ended up directly in there. I think the RPi version is better – and anyway the DASHboard doesn’t work properly in Windows which means using the command line (and as the old style CMND makes a mess of control chars they use, that means using the new WINDOWS TERMINAL). Easier just to put the lot on RPi. I have to say, eventually pretty much all info you need is on the ESPHOME site and any that is not, they are on DISCORD.

            To make life easier – I could NOT get the dashboard to start from boot, so I took the next best approach: sudo nano /etc/bash.bashrc – I added this to the file. alias dash=”esphome dashboard esphome/config/”
            So now, from my pi folder (as pi) – I simply key in:

Leave a Reply

Your email address will not be published.

Leave the field below empty!