Domoticz ESPEasy hardware Home Automation Raspberry Pi

Home Automation and The Internet of Things – Controlling

In the previous part we finalised the configurations for the IoT ESPEasy devices to give local control capability. In this  instalment we complete the configuration that enables our devices to create an integrated home automation system.

The criteria that I set for my selecting the Home Automation control software is:

  1. All normal control actions fully contained in the home LAN. This means us ‘cloud’ based solutions (including Alexa and Google Home) are excluded, as I want to minimise my exposure to outside dependencies and potential security problems.
  2. The software should be free and open source, with an active community for support.
  3. The software should be easily configurable and extensible through built-in scripting and/or other external mechanisms.

After a some of investigation, I decided to settle on Domoticz software running on a standalone Raspberry Pi Model 3B+ running Raspbian (a GNU/Linux distribution based on Debian). This combination seemed to fit my specifications (and wallet!), and there was a lot of information related to interfacing ESPEasy interface to this configuration.

Raspberry Pi Setup

This was my first time using a Raspberry Pi, so I opted for a starter kit that gave me everything I needed to get going with a minimum of fuss. I got mine from Core Electronics, but there are many similar packages available from other sources.

The hardware and software in the kit was enough to get started, but a useful addition I got on eBay was a short lead with a switch for the power supply. Once full installed this is not really used but being able to easily power the device up and down was really useful during my journey up the learning curve.

Installing Raspbian is a simple process described in many places. The help section of the Raspberry Pi web site is a useful starting point for lots of the ‘newbie’ questions. Domoticz also has a Wiki article specifically about setup steps to prepare for Domoticz.

As the RasPi sits in my not-so-easily-accessible communications cabinet, it is being used in ‘headless mode’ (ie, with no screen nor keyboard). In this configuration, it is useful to have the following software installed on the computer you use to access the RasPi before going too deep in the Domoticz setup process:

  • RealVNC to allow GUI access to the RasPi. This opens a window on the client computer (Windows 10 in my case) and shows the host computers ‘display’. I have also installed this on my iPad and it all works well. Setting up the RasPi for remote access is covered here on the RasPi site. An added bonus is that VNC can be used to access the RasPi server from outside my home with very minimal added setup and industrial-grade security.
  • PuTTY to allow character terminal access to the RasPI. Strictly not necessary if you can access the GUI, but useful to do some quick changes that are easier done from the command line. You can also open multiple independent PuTTY sessions under one login compared to all VNC sessions showing the same desktop.

Installing Domoticz

Once the Raspberry Pi is set up, Domoticz can be installed by following the  instructions on the Domoticz Wiki site. I picked the ‘easy way’ and it worked with no problems.

One thing to note is that Domoticz acts as a web server on your network and so should be given a fixed IP address. I set this up by reserving an address at the DHCP server on my home router. I did the same for all the ESPEasy devices.

Domoticz Server Configuration

We now need to connect the Domoticz server to the ESPEasy devices and get them to start communicating. You can access the Domoticz Server by opening server’s fixed address ( in my case), port 8080 (the HTTP port):

This will make the server display the Domoticz dashboard on your web browser. There are a few steps to the configuration, involving a number of the Domoticz menus, but none of it is complex.

To start the new configuration, add a new item of Hardware from the Setup menu, shown below.

The hardware to add from the drop down list is the ‘Dummy’ hardware type. This allows arbitrary virtual sensors to be connected. You can call the device whatever you like – mine is ‘Virtual’ – as highlighted below.

Once the hardware is added, you can use the Create Virtual Sensors GUI button to add in the ESPEasy switches. When this button is clicked, a dialog like the one below is displayed. You only need to enter the name of the device (‘Sonoff_18’ in this case) and select that it is a ‘Switch’ type of device from the drop down list. when required, all additional ESPEasy devices are added from this GUI interface.

This new device is now ready for configuration, which consist of providing the link from Domoticz top end to the field hardware and vice versa.

From the Setup menu, select the Devices menu button. This will display the list of currently configured devices, as shown below.

Note the number in the ‘Idx’ column of your new device. This is important when we later edit the ESPEasy switch configuration.

You can look at the at the device faceplate in the Switches display (selected from the top line menu items).

This faceplate allows you to edit the parameters for the switch, using the display shown below. The important items to configure are the switch type (select ‘On/Off’) and the commands used to actually switch the device on and off. These are the same commands that were used from the browser interface in the previous part of this series, referencing the on and off events configured in the ESPEasy controller for the switch.

ESPEasy Device Configuration

We now need to shift attention to the ESPEasy switch to complete the other end of the configured command path.

Open the configuration pages for the ESPEasy in your web browser and select the Controllers tab. Create a new controller by editing the first slot and selecting the ‘Domoticz HTTP’ controller type from the list.

The display will show a page similar to the one below. You should enter the IP address for your Domoticz server and enable the Controller. This completes the communications path between the Server and the ESPEasy device.

The next thing is to create the link between the ESPEasy switch device and the Server faceplate/switch object. This is done by using the Domoticz device Idx that we noted earlier (11 in this case).

For both the switch and the relay, in turn, Select the Devices tab and edit the Data Acquisition section (highlighted) by ticking the box next to the (1) and adding in the Idx. This tells ESPEasy to send the data item labelled (1) in the Values list below to the Domoticz device with id 11. We do both the switch and the relay so that local manual operations will be reflected correctly in the Domoticz dashboard.

Also note that the Send Boot state check box is selected. This will ensure that when the device is powered up it will initialise the Domoticz server with the correct current state.

That’s it. The configuration is completed and you should be ready to switch the ESPEasy device from the Domoticz dashboard.

Exercising Control

Switching the device on and off is done by clicking on the icon for the device on the faceplate. The display should also show the correct status when manual switching happens.

Timer sequences for one one switch can be created from the Timers GUI button on the switch switch faceplate. To create the same timer for a switching group you can use the Scene option from the Setup menu.

All up this configuration meets my expectations and is useful for the type of automation I want to carry out. However, it does suffer from one drawback that will be discussed and resolved in the next instalment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s