Domoticz dummy device allow to recover measures (temperature probe, detector of presence…) or to send orders to a DIY connected object, for example a relay. Virtual devices can also be used to display information retrieved from an online service (weather, air quality, road traffic,…). We’ll see how to retrieve measures temperature and humidity from a probe made with ESP Easy and how to drive a relay with a WeMos D1 Mini.
Creating a virtual device (Dummy)
Go to the menu settings then material
In the Type list, choose Dummy (Does nothing, use for virtual switches only).
Name material. If you have developed probes (or other connected object) using firmware ESP Easy, give a descriptive name with the node number to help you more easily find you in your cloud of objects.
— Projets DIY (@projetsdiy) October 10, 2016
In my case, I standardized the name with the material used, ESPEasy, the number of the node. Here, it gives Wemos_ESPEasy_1.
Note. You can create a single virtual hardware to control all your devices, it’s just a matter of organization and now. I find easier and clearer to group devices on same hardware. If we remove the material, associated devices will be deleted at the same time.
Once established, you will have a new material in your list with a button create virtual sensors.
Create a virtual device (sensor)
Press create virtual sensors. Give it a name. We will get the measure of a digital Barometer (made in this article). In the list, choose Temp-Humidity-Baro.
Go to the devices. You will find your new sensor. You now have sound ID (Idx) needed to show action from a script, an ESP Easy object…
Receive and display measurements from a sensor
In this example, go to the interface of ESP Easy configuration and indicate the IDX No. 22 to the sensor BMP180.
I configured sending measures every 20 seconds. It is too much, especially for use on battery of course.
Retrun on Domoticz. Refresh the pages of the devices. You should receive the first data.
Now go to weather, you’ll find your barometer.
In Temperature, you will find the temperature measured by the BMP180 with the dew point calculated at each reception of measurement.
Send a command from a virtual sensor: drive a relay…
Now imagine you want to drive a relay using ESP Easy. Return to material to create a new sensor. Choose the type of switch (Switch).
Go to the switches and edit.
Choose an icon, for example Generic which symbolizes a power button. in the Action On field enter the command. In this example, I used a relay shield on a Wemos D1 Mini (presented here). The http request is written as
http://ip/control?cmd,gpio,id,0 ou 1
- to activate: http://192.168.1.21/control?cmd=gpio, 5, 1
- for disable: http://192.168.1.21/control?cmd=gpio, 5, 0
Can also determines a delay before sending a command (ON or OFF). The switch-on delay is cut immediately after the receipt of the status change. The extinction time-out is counted after execution of the command. Very practical and very simple implementation, this solution avoids develop scenarios in many situations. Here are two small cases of application:
- If we detect presence in a room, we light the lamp immediately (time ignition = 0) and we turn it off after 30 seconds (delay extinction = 30).
- One detects the opening of the automatic gate, we send a signal on the dry contact using a relay after 20 seconds (delay ignition = 20) and free the relay 1 second (after extinction = 1).
Save and go back on the switches pages.
Press the button, you should hear ‘Slam’ the relay.
That is, it’s over for this short presentation on the sensors and virtual devices under Domoticz. Very simple to implement and very powerful.