Friday, October 13, 2023

ESPEasy part 1: IOT without programming

For an index to all my stories click this text

A few year ago on an electronics fair I stumbled upon some guys who were controlling ESP8266's with something called ESP Easy. I looked into it and forgot about it. ESP Easy was at that time immature and had limited purpose for me.

But boy has that changed !!!
ESP Easy is now a mature product with no less then 7 developers working at the software and 3 guys working on the documentation. It still has some quircks but overall it is becoming a mature and very usable project. It is well maintained and updates regular appear.  However I have to say that, despite 3 people working at it, the documentation is really lousy.

If you need a quick way to add some sensors or actuators to your home automation system make sure to check this out !!

What we are going to do.

In this story we are going to make a switch in Domoticz that sets a led on or off on an ESP8266 without a line of programming !!!

What is ESP-Easy

ESP Easy started out as a project to, in an easy way, attach sensors and actuators to an ESP8266 with the purpose to send the data to Domoticz. Further more the idea was that you did not need a lot of programming knowledge to get started. Everything could be done with a few mouse-clicks and some easy to understand commands. The on-line manual says it like this: So the idea was to have something plug and play to hook up sensors to Domoticz.

Well in a way they have succeeded in this. ESP Easy has a nice looking interface. No drivers need to be installed (all are aboard). Hundreds of sensors and actuators work direct out of the box. For simple tasks no programming is involved. And for some more complex tasks a simple programming language (called rules) is build in.
ESP Easy does not only connects to Domoticz (by HTTP and MQTT) but also to Thingspeak, Home Assistant, OpenHab, PiDome MQTT, Emoncms and it has generic HTTP and UDP.
The build-in Generic HTTP makes it possible to send commands to many other services and even to other ESP's.

ESP-Easy has its own installer. You only have to connect the ESP8266 (or ESP32) to your computer with an USB cable and start the install software. A few minutes later you are set to go.

Just have a look at the list of sensors and actuators and be impressed:
https://www.letscontrolit.com/wiki/index.php?title=Devices

Any Flaws ???

Yes there are some quircks.
As far as I have tested the software works flawlessly. The problems are in the documentation.

First there is a easy to use web-based installer that replaces the old installation procedure. However there is no mention (well I could not find it) in the documentation. Don't worry it is covered here !!

Not all pages are real-time updated. It took me a while to realise this, and therefore was at first confused about the workings of a simple switch.

It took me some time to figure out how to send data over HTTP. Again a lack in the documentation. And the same happened when I wanted to attach a TM1637 7 segment display. I'll explain these later on in this story.

Nevertheless when you get used to the way of explanation in the documentation it is a very usefull project.

Installing ESP Easy


Installing the ESP Easy software is incredibly easy........if you know how.

The documentation sends you to the Github pages where you can find all published versions. You can download one of these and use the supplied installation program. Look for a direct installable binary in the releases section: https://github.com/letscontrolit/ESPEasy/releases

The installation program is however not easy to use and has been modified from previous versions which were much better. So we are going to take another road.

By chance I blundered upon a webinstaller. You can find it here:
https://td-er.nl/ESPEasy/latest/

This is the easiest way to install ESPeasy on an ESP8266 or ESP32.

To use this you need to address this webinstaller with Chrome or MicroSoft Edge. The installer will not work with Firefox !!



This is how the page looks.



Click on the drop-down menu and a long list with available versions appears. Some versions are specifically designed for a purpose like the Climate, Energy or Neopixel versions. You can find the pro's and con's of each version in the Documentation (just click on the highlighted word Documentation). But for general purposes just use the Normal 4M version.



Connect your ESP8266 or ESP32 with a USB cable to your computer and click the blue CONNECT button.
A pop-up window appears in which the USB ports are listed. I had two ESP's attached at the moment but wanted to install ESPEasy to the one connected on COM8. Next click on the blue Connect button.



A new pop-up window appears. Click on "INSTALL NORMAL 4M".



Press the boot button on the ESP8266 or ESP32 and installation begins.



After a few minutes the installation finishes. Then press NEXT.



Press again on the blue CONNECT button and again a pop-up window appears. This time you can choose between installing another ESP, configure the Wifi settings or view the logs. This time choose the Wifi settings.
The drop down menu shows all networks in your environment. Choose your router sname and fill in the password. Then click CONNECT again.



Back in the main screen again choose CONNECT and this time choose to view the log files in the pop-up screen.
Halfway the screen you can see the text:

2655 : Info : WIFI : DHCP IP : 192.168.178.211 (ESP-Easy)

This is the IP-address of your ESP-Easy. Of course that number will be different in your case.



Now open your browser on your PC and connect to the IP adress of ESP Easy. The IP address on this webpage is different from the one described above. That is because I did multiple tests and installs when writing this text.

That is all there is to the software installation. Now let us move on to using ESPEasy.
Lets make something simple for starters. Something where no programming for is needed !!! We are going to build a virtual button in the home automation system Domoticz and when that button is pressed a led attached to an ESP8266 will go on. In the real world you would replace that led by a relay, motor or whatever home automation project you have in mind.

If you do not have a Domoticz home automation system, no worries. You can give commands to ESPEasy from your browser !!! Just read on and in the next stories you will find more practical examples.

Breadboard setup




The breadboard setup is simple. just a led with a current delimiting resistor on D1 and a button on D5.

Sending a command to ESP-Easy.

There are several ways to communicate with ESP Easy. In the beginning of this story I mentioned that you can connect an ESP8266 with ESP Easy to almost any home automation system you can bring up. Communication is two way and can be done with simple HTTP commands or through an MQTT broker. We'll stick to HTTP commands here.

On the ESP Easy website in the documentation section look for GPIO : 

https://www.letscontrolit.com/wiki/index.php?title=GPIO

The command for setting a GPIO pin on is:  
http://<espeasyip>/control?cmd=GPIO,number,1

And for setting the GPIO pin off the command is:
http://<espeasyip>/control?cmd=GPIO,number,0

You need to substitute the word 'number' with the GPIO pin.



We are used to use D1 to D8 for the IO pins when programming the ESP8266 in the Arduino software. However ESP Easy uses the GPIO notation which has a different numbering as you can see in the list above.
Our led is attached to D7. Our first ESP8266 with ESPEasy has IP number 192.168.1.85 So the command to set the led on will be:

http://192.168.1.85/control?cmd=GPIO,13,1

Type this in a fresh tab in your browser, press enter,  and the led will go on. Replace the 1 at the end with 0 and the led will go off again. Remember to replace the IP number with the one your ESP8266 has.


Building a button in Domoticz.

Actually this was already covered in an earlier story on this weblog. You can re-read that here. So I am going over this in a brief way.



In the Domoticz settings menu choose hardware and add a new Dummy virtual switch and call it ESP EAsy led



When done click on the Make Virtual sensor button (Maak virtuele sensor). Call it ESP Easy and as sensor type choose Switch (Schakelaar).



Now switch over to the Domoticz Switches tab and your newly build switch is there.



Click on "Aanpassen" and alter the settings to your liking. The most important part are the Aan actie (On action) in which we fill in the HTTP command that switches the led on:
http://192.168.1.85/control?cmd=GPIO,13,1

And in the Uit actie (Off action) fill in the appropriate command for setting the led off.

Don't forget to save (Opsaan) the settings. And you're done !!!

Done !!

Indeed that is all. We just made a switch in Domoticz that sets a led on or off on our ESP8266 without 1 line of programming !!!

There is more.

Indeed there is. ESP-Easy is chock full with drivers for servo's, temperature sensors, rotary encoders, neopixels, ldr's, pir's, 7 segment displays, oled and tft displays etc. etc. etc. Like said before in this story: have a good look at the documentation and be amazed. The possibilities are immens.

Go ahead and look around in ESP-Easy and play with the options. This story just scratched the surface.

Next time I am going to show how to send data (like temperature values) from ESP Easy to Domoticz and how to send data from one ESP8266 to another ESP8266 both equipped with ESPEasy.

Till that time
Have fun

Luc Volders