ESP8266 with ESP Easy

Step-by-step how-to guide install the ESP Easy firmware on a ESP8266 based ESP-01.

ESPEasy offers a very intuitive interface for configuring sensors that can be linked to Home Automation platforms, such as (but not limited to) Domoticz, OpenHab, Home Assistant. It can also be configured to function autonomously without depending on additional platforms or software. For example, with ESPEasy it becomes extremely easy to hook up sensors to Domoticz with JSON or MQTT.

What is ESPEasy?

ESP Easy is a free and open source MCU firmware for the Internet of things (IoT) and originally developed by the LetsControlIt.com community (formerly known as ESP8266.nu community). It runs on ESP8266 Wi-Fi based MCU (microcontroller unit) platforms for IoT from Espressif Systems. The name “ESP Easy,” by default, refers to the firmware rather than the hardware on which it runs. At a low level, the ESP Easy firmware works the same as the NodeMCU firmware and also provides a very simple operating system on the ESP8266.
Source: https://en.wikipedia.org/wiki/ESP_Easy

ESPEasy releases

The ESPEasy project was a bit dormant until recently 2 developers (grovkillen and TD-er) revived this project recently. We expect a new stabe release soon but until that moment, we can work with the Github releases.
The downside is that these release could contain ‘features’ and as such, not yet ready for a production environment. Please be aware that the latest releases are only suited for the ESP-01S and not the ESP-01 model due to the minimal memory constriction of 1MB. The ESP-01 is only equipped with 512KB of memory and not suited for the latest ESP Easy release.

ESP-01 and ESP-01s

The ESP8266 is a low-cost Wi-Fi microchip, with a full TCP/IP stack and microcontroller capability, produced by Espressif Systems in Shanghai, China. It’s called a SoC: System On a Chip. The chip first came to the attention of Western makers in August 2014 with the ESP-01 module, made by a third-party manufacturer Ai-Thinker.

The ESP-01 comes in 3 different models:
– ESP-01 Blue (this is the original ESP-01)
– ESP-01 Black
– ESP-01S Black

LED differences between the ESP-01 and the ESP-01S
LED differences between the ESP-01 and the ESP-01S
Source: https://www.esp8266.com/viewtopic.php?f=13&t=13659

These are the relevant differences:

  • Functional these models are not different. The work in the same way, have the same SOC ESP8266 chip, same power requirements, etc.
  • There is no difference between the ESP-01 blue model and the ESP-01 black model. But keep in mind that the ESP-01 and the ESP-01S are both black.
  • The main difference is that the ‘new’ ESP-01S model has 1MB memory instead of 512KB.
  • With the ESP-01S the power red LED is removed, and the blue LED is on pin 2 now.
    ESP-01: Blue LED on TX
    ESP-01S: Blue LED on GPIO2 (low = on)
  • To get the ESP-01 to boot from flash, you need to supply 3.3V to the CH_PD pin to boot correctly and able to flash the ESP. With the new ESP-01S you no longer have to do this, only VCC and GND is sufficient.
  • The stability and wifi range slightly improved with the new ESP-01S.
  • Because the ESP-01 model is only equipped with 512KB of memory, these models are not suited for the latest ESPEasy releases. You can either upgrade the memory (with W25Q32FVSSIG for example) or use the ESP-01S model.

For a complete overview of the ESP-01 (not the ESP-01S) you can view the cheat sheet below. Be aware that the ESP-01S is a bit different, as stated earlier, but for the most these specs are similar to the ESP-01. It’s still the same SOC.

ESP8266 ESP-01 Cheat Sheet
ESP8266 ESP-01 Cheat Sheet
Source: https://www.instructables.com/id/Definitive-Guide-to-Setting-Up-Your-New-ESP01-Modu/

Programming the ESP-01(S)

ESP-01(S) USB UART programmer
ESP-01(S) USB UART programmer

To program the ESP-01(S) we can use a special programmer tool that we can use in China. This is a much easier method then hooking up the ESP to a serial interface, where we need a breadboard or solder to connect the ESP and program it. This way, you can easily reprogram the ESP without rerouting or adapting your setups.

These nifty programmers come in 2 models, with a CH340G and and CP2102/CP2104 USB to serial USB bus converter chip. The CP210X chip has much better driver support for Windows then the CH340G, but as a trade-off they are a bit more expensive (just a few cents). This is why I recommend that, if you are working with Windows, to use CP210X based devices.

Not relevant to this specific post but in general when buying in China, watch out with FT230 based devices. The (Chinese) market is flooded with a lot of counterfeit FTDI FT230 chips and the manufacturer kills these chips with a driver update. I unfortunately learned this the hard way, (about 4 chips/devices later). For more information about this, check this Hackaday article: https://hackaday.com/2014/10/22/watch-that-windows-update-ftdi-drivers-are-killing-fake-chips/

Prerequisites

Tested with

  • ESP-01S
  • Windows 10, version 1909
  • ESP Easy, release mega-20200608

Step 1: Download the latest ESPEasy firmware

Go to the Github page of the ESPEasy project and download the latest MEGA release. Download the one starting with “ESPEasy_ESP82xx_”. After downloading, unzip the file to your favorite location.

Yes, these downloads are a bit ‘fat’ with 60~70MB, but they include a range of different firmware, tools and source code. But it still fits on a single zipdisk (or about 200+ floppies), should the need arise.

https://github.com/letscontrolit/ESPEasy/releases

Step 2: Connect ESP programmer with ESP-01S

Next step is to plug in the ESP Programmer with a ESP01S attached to it. Always, first plug in the ESP in the programmer, then connect the programmer to your computer. After connecting the programmer to your system, wait a bit so your system can properly recognize the programmer and connect it as a serial port. This can take up to 1-2 minutes.

If you have more then one serial port on your device, you can gain more insight with the Windows Device Manager:

  1. Open the Device Manager by pressing the Windows Key + R. Type “devmgmt.msc” (without the “”) and press Enter.
  2. Expand the Ports (COM & LPT) section.
  3. Find the USB Programmer and make a note of the correct COM port (That’s the serial port).

Step 3: Start ESP Easy Flasher

Next is to start the ESP.Easy.Flasher.exe application. You will receive a UAC (User Account Control) warning, which you can safely accept and continue. After a few seconds, the application will start.

Step 4: Flash the ESP-01S

Once the ESP Easy Flasher application has started, it will search your system for serial ports. Once it has found the port (or if you have more then one serial port, select the correct serial port), you can continue to select the correct firmware.

Select the following firmware for your ESP-01S:
ESP_Easy_mega_<date>_normal_ESP8266_1M.bin
In this case, I selected the following firmware:

Selecting the correct firmware for the ESP-01S with the ESP Easy Flasher tool
Selecting the correct firmware for the ESP-01S with the ESP Easy Flasher tool

Next is to press the “Flash ESP Easy FW” button. And then it’s flashing, see that little blue led getting a hart-attack for a few seconds. Lovely.

After flashing the the ESP-01, you can press the button on the side of the programmer tool to reset, or just uplug the whole thing and plug it back in. From this moment onward, the ESP-01 only need power (and occasionally a bit of tough love).

Once the ESP-01 is booted back up, you need to connect to it using WiFi. Just look at the available wireless networks and you should find an network called “ESP-Easy”. The password is “configesp” (without the ” “).

Connect to the ESP-Easy wifi network…

Windows can take a bit of time for figuring out the the connection, but eventually it should get the status “No Internet, secured”. That’s perfectly fine.

If your browser does not automatically kick in, you can open your browser and open the URL http://192.168.4.1. This should bring you to the ESP Easy wifi page, where we can hook up the ESP-01 to our home network. Select your wifi network and fill in the corresponding password below. Click on Connect and let the magic happen.

Magic sometimes takes a few seconds!

Once its connected, the status will update with the current network configuration. In my case, it received the IP address 10.1.3.71 (I have a bit odd home network). This is the moment you can disconnect from the ESP Easy wifi network and reconnect to your regular network.

ESP Easy perfectly connected to the home wifi network!

Now, we have a working ESP-01 with the latest ESP Easy firmware…
Enjoy!

More Information:

READ MORE
flower care

Mi Flora plant sensor

Step-by-step how-to guide install the Mi Flora plant sensor on a Raspberry Pi 4, with the latest Raspbian Buster image and Domoticz.

For this how-to we will be using our highly regarded Python Plugin Manager. In case you have not installed this yet, take a look at the prerequisites, you will find a link to the related how-to to install this.

Please be aware that when you buy your Flower Mate from China, you need to buy the International model and NOT the Chinese/Asian model!

There are also reports that Xiaomi would or could be bricking these devices using the native Flower Care app. Personally I do not have experienced these issues, but just to be safe:

You don’t need the Flower Mate app to get this device working with Domoticz!!!

This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!

This tutorial has been verified with:
Domoticz 2020.1
Python Plugin Manager version 1.5.1
The Mi Flower Mate plugin version 1.0.0

Prerequisites

Tested with

  • Raspberry Pi 4 (MEM 2GB with 16GB sd-card)
  • Raspbian Buster Lite 4.19, Februari 2020
  • Domoticz Stable 2020.1 (compile date 22-3-2020)
  • Domoticz Python plugin manager dated March 29, 2020

Step 1: Install the Bluepy library

Before we can install the plugin we need to install the bluepy library. This library enables Python to talk to Bluetooth devices under Linux. Without this library, the plugin can’t talk to your Flower Mate. Start by connecting with SSH to your Domoticz installation and run the following commands:

sudo apt-get install python3-pip libglib2.0-dev -y
sudo pip3 install bluepy

Step 2: Install the Mi Flower Mate Plugin

Next is to install the Mi Flower Mate Plugin with the Python Plugin Manager (PP-Manager). Add a new hardware device under Domoticz and use the following settings to create the hardware device (and activate the plugin):

  • Enabled: Enabled
  • Name: PP-Mi Flower Mate
  • Type: Python Plugin Manager
  • Data Timeout: Disabled
  • Plugin to install: Xiaomi Mi Flower Mate
  • Auto Update: All (NotifyOnly)
  • Security Scan: False
  • Debug: False
Installing the Xiaomi Mi Flower Mate plugin with the Python Plugin Manager
Installing the Xiaomi Mi Flower Mate plugin with the Python Plugin Manager

Reboot Domoticz once you have installed the new hardware device, to load the plugin within Domoticz. You can reboot Domoticz from the webinterface menu: Setup -> More Options -> Restart System.
Or with SSH: sudo reboot

The next step is to add the Xiaomi Mi Flower Mate hardware device, after the plugin has been activated.
Use the following settings:

  • Enabled: Enabled
  • Name: Mi Flower Mate
  • Type: Xiaomi Mi Flower Mate
  • Data Timeout: Disabled
  • Device selection: Automatic *
Adding the Mi Flower Mate hardware device
Adding the Mi Flower Mate hardware device

Once a Flower Mate device is found, it will automatically add the found sensors to Domoticz:

Mi Flower Mate device found in Domoticz
Mi Flower Mate device found in Domoticz

* Device selection

For the device selection you can also add the devices manually. This is especially useful if you have multiple devices or if you have ‘interference’ from the flower mate of your neighbor(s).

If you are using the manual option, scan for your Flower Mates to find their mac-addresses by entering this command into a terminal:

sudo hcitool lescan

Let it run for a while (or for the inpatient ones, whip out the battery from the flower mate and put it back in). After a while, bluetooth devices in the area will start to show up. Look for found devices named “Flower care” or similar.

Bluetooth scanning for Flower Mate devices
Bluetooth scanning for Flower Mate devices

Step 3: Enabling the device in Domoticz

Once you have acquired your Flower Mate device in Domoticz, automatically or manually, you need to enable the device in order to receive updates. This is done this way as this enables the plugin to actively pull an update from the Mi Flower Mate device. But only once, not continuously (by design to save power and put you in control).

Pull a Flower Mate Update
Pull a Flower Mate Update

Step 4: Automatically update the sensors

However, as great as it is to manually update the sensors every time, automatically updating your Mi Flower Mate sensors would be even better. Luckily, we can do this very easily under Domoticz, thanks to the design choices the developer made.

I present you 2 different options:

  • Option A: Using a device timer
  • Option B: Using a Blockly script

Option A: Create device timers

The easiest way to automatically trigger an update of the sensors is to enable the devices and enable a timer for this device. After you enabled all the Mi Flower Mate devices, look for it under the Switches tab in Domoticz.

Then click on the “Timers” button to configure the timer:

Adding a timer under Domoticz
Adding a timer under Domoticz

On of the nice things of working with timers is that you can add multiple timers. In this example I created 4 timers, to the sensors receives an update every 6 hours.

Keep in mind that the more frequent you pull an update from your Mi Flower Mate, the worse the energy consumption will be and the faster the battery will be drained!

Configuring timers for the Mi Flower Mate
Configuring timers for the Mi Flower Mate

Option B: Create a Blockly script

In this example I created a fairly easy to duplicate Blockly script to update the sensors daily. There are others ways to script this, even better with LUA, Python or dzVents scripts. But this example should give you a fairly good start with Blockly. Keep in mind that the more frequent you pull an update from your Mi Flower Mate, the worse the energy consumption will be and the faster the battery will be empty!

Mi Flower Update Script
Mi Flower Update Script

Don’t forget:

  • Save your script!
  • Enable the “update Mi Flowermates” device under Devices!

More information:

READ MORE

P1 Energy Meter for Domoticz

Step-by-step how-to guide connect the P1 Landis+Gyr Energy meter, on a Raspberry Pi 4, with the latest Raspbian Buster image and Domoticz.

This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!

Until recently most Dutch household’s where provided with an old analog energy meter, for electricity and natural gas. These meters have been replaced in recent years (per designation of Dutch law) with a new generation P1 smart energy meters. Apart from the fact that the energy companies can now remotely read out the meters, they are also equipped with a local data port. This port can be utilized to constantly monitor these energy-meters including the meter values.

In this how-to we are going to connect this smart meter to our Raspberry Pi based Domoticz installation.

This tutorial has been verified with:
Domoticz 2020.1

Prerequisites

Tested with

  • Raspbian Buster Lite 4.19, Februari 2020
  • Domoticz Stable 2020.1 (compile date 22-3-2020)
  • TFDI FT232RL based USB to serial to RJ11 cable (P1 cable)

USB to serial to RJ11 cable

Our Chinese friends are well versed in preparing and making P1 cable solutions that also work well in combination with Domoticz. Under prerequisites are 2 links included with which you can order them ready-made. Also, these cables can often be ordered well through European web shops with a shorting shipping time (but often the price is higher).

For this post I ordered a cable from China and took it apart for you, so that you can see for yourself how they work. That way you can save even more costs by ordering the parts separately in China and assembling them yourself.

Configuring the P1 Smart Meter

Once you have the right cable, you can hook it up to your energy meter and Domoticz. After this, configure the new hardware device as follows:

  • Enabled: Enabled
  • Name: P1 Energy Meter
  • Type: P1 Smart Meter USB
  • Data Timeout: Disabled
  • Serial Port: Select your USB to serial adapter, in this case the TFDI FT232RL chip based adapter
  • Baudrate: 115200 bits per second (baud)
  • CRC message validation: Enabled
  • Rate Limit: empty
Configure the P1 hardware in Domoticz
Configure the P1 hardware in Domoticz

It can take a while for all devices to become visible in Domoticz, as these devices will only receive an update if the value in the meter changes. For example the gas meter, it will often take a while before it becomes visible. Certainly in the summer, when gas consumption is low, this can take some time.

P1 devices appear in Domoticz
P1 devices appear in Domoticz

READ MORE