We continue our series of articles on the firmware ESP Easy. In this article, we will learn how to integrate projects based ESP8266 in Jeedom. It is possible to recover from sensors (temperature, humidity, brightness,…) and measures to control actuators, for example a relay. There is nothing very complicated to integrate objects DIY ESP Easy based in Jeedom, just a few undocumented tips…
— Projets DIY (@projetsdiy) October 10, 2016
List of material
To do this tutorial, I used the previous project used to create a virtual barometer BME280 under Domoticz. For this tutorial, you will use only the BMP180 to get the measure of air pressure and temperature as well as a shield relay which will fly with a virtual button under Jeedom.
|Wemos D1 Mini or other ESP8266 ESP-12|
|Atmospheric pressure sensor|
|Wemos Relay shield (for Wemos D1 Mini)|
10A – 250VAC or 10A – 30VDC
|Monochrome OLED display 168×64 pixels 0.96″ (optional)|
|Dupont jumper (optional)|
|Component||Pin||Arduino Pin||Equivalence ESP8266 (Wemos D1 mini)|
|OLED SSD1306 0.96″||VDC||5V||5V|
|Led WiFi activity||Pole +||GPIO-12||D6|
Set up Jeedom
To access all of the settings, the best is to activate the expert mode before you begin.
Internal Jeedom network configuration
before you can use the ESPeasy plugin, you have to configure the IP address of the internal access. Otherwise, the module will not work and worse still no error message says not to do.
in the first field, enter the IP address of your home automation box. For example 192.168.1.24. Do not change the port (80 by default) unless you have implemented a port forwarding (read article to find out how). Save the configuration and refresh the page. You must have the OK status before going any further.
Install the plugin virtual
Install the virtual plugin that will serve us to create a virtual command button to toggle the relay.
Install and configure the plugin ESP Easy
Now go in the management of plugins and install the ESPeasy plugin, which is located in the home automation protocol section. This plugin is free.
After installation, activate and initiate the installation of the dependencies by pressing raise . The operation lasts a few minutes (it is function of your equipment). Meanwhile, you can set up your ESP8266.
Configure the communication with Jeedom on ESP8266
ESP Easy firmware does not support natively support Jeedom. This isn’t a problem, we’ll simply use the generic HTTP protocol.
In the configuration of the plugin, have has everything what need us:
- controller to enter ESPEasy IP. This is the IP address provided in the internal access previously. If the field is empty, it is that there is a problem in the configuration.
- port controller : it’s the 8121
- Publish template : sets the mask of sending data to Jeedom
Accessing the interface of ESP Easy configuration and go to the Config page:
- Protocol : choose Generic HTTP
- Locate Controller : select Use IP address
- Controller IP : specify the IP address of the Jeedom box
- Controller Port : specify 8121
- save with submit
Then go to the Tools page and Advanced . In the field Publish Template paste
device = % sysname % & taskid = % id % & cmd = % valname % & value = % value %
Save with submit .
Include ESP Easy objects
Now the dependencies should be installed (status OK green). Launch the daemon and open the log Espeasy_node . If everything is correctly configured, you should begin to receive the first messages of the ESP8266.
note. The time of receipt of the first message will depend on time for update of the measures. To develop the configuration, set a delay of a few seconds (for example 5) the Delay of the Device on ESP Easy field.
As soon as you receive your first message, you can leave the configuration of the plugin ESPeasy.
Press the green button inclusion Mode. According to the time of publication, Jeedom will detect new objects and add them to the list my espeasy. Each object will take the name that has been assigned in the name page Config . Click Mode inclusion to complete inclusion.
Click the icon of the object to complete the configuration:
- set a object parent
- choose one category
- check activate and visible
- If your object can be associated with a specific category, choose here in the list of choices.
Then go to the tab controls. There is an information command (Pressure and Temperature). Rename the command names in french and indicate the unit of measure. You can also enable the history of measures.
Save the configuration and go to the dashboard to see the measures sent by your digital barometer.
Driving a relay ESP Easy with Jeedom
You probably noticed but there is Subscribe template. To control actuators, going to therefore use a URL (like on Domoticz by the way). In this example, we’re going to turn a relay connected to the GPIO 16 (PIN D0 D1 Mini Wemos).
Return to the configuration of the ESPeasy object and go to the tab controls then click on Add a command to action . Do two times to add two commands.
In the first line created, name IT. In the Task and Variable field paste gpio, 16, 1 . In the second line, give the OFF name and paste gpio, 16, 0.
Turn off the display of the two commands and save.
In the value field, the plugin automatically created command recognized by ESP Easy URL.
You can test the relay activates and deactivates by pressing test .
Create a command button virtual
Go to Plugins-> programming-> virtual and then press Add.
Choose a parent object, a class, select and make visible. Go to the Commands tab and add 2 virtual controls.
For the first, name IT. In the value (upper field) field, click search equipment. Find the order to activate the relay (ON) as in this screenshot. Do the same for the extinction of the (OFF) relay command. You can test that the controls work well using the button test .
Save and go to the dashboard.
You can now drive your relay with Jeedom, measures of all kinds, etc. without programming thanks to ESP Easy.