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 https://github.com/billw2/rpi-clone.git
$ 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.
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.
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.