How I accomplished this, will be shown in this topic. It might be useful to get new users started
What i wanted was a double switch, a pir sensor and my barometer. The switches and pir sensor can be used to switch whatever domoticz device I want, you will be able to add actions in the domoticz web interface.
To start, I needed a power supply both 3.3v and 5v. The pir sensor needs 5v minimum, the esp module 3.3. So i created this simple PSU.
Next thing is wiring my switch. Because the pir sensor i'm using will be active high, i disabled the switch pull-up function in my esp sketch. The switches will be active high as well. Therefore i needed a pull-down resistor on my switch input pin. I created a simple jumper pull-down wire. Cutting it in half with a 10k resistor in between as seen in the next two pictures.
Let's wire everything:
Next thing is assigning the functions using the web-interface:
The esp module updates virtual switches in domoticz. What is did for my left switch, was using a json command as on- and off function. My left switch controls the ceiling light, but that light can also be switched using two remote controls, and a device in domoticz. In order to keep things working I have installed it like this:
Switch 1: Ceiling light living room : idx 1
Switch 2: Remote control 1 ceiling light living room subdevice : idx 2
Switch 3: Remote control 2 ceiling light living room subdevice : idx 3
Switch 4: Virtual switch ceiling light living room : idx 4
So i assigned the left switch to idx 4. In domoticz, I edited the virtual switch:
As you can see, i assigned a on- and off function to my esp-switch. The action is:
Code: Select all
The right switch can be assigned to whatever device I will, but I use it to activate a scene, On activates the evening scene, if light intensity is < x then it turns on a couple of lights. When i switch it off, it activates the away from home scene, shutting all lights and printers etc. off. The pir sensor will be activated. When coming home, it turns on some lights if light intensity < x.
.. and where done..
Oh.. and next time.. I will try to drill the pie-hole in the centre of the plate