My Built-in-wall domoticz switch + pir + barometer

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

My Built-in-wall domoticz switch + pir + barometer

#1 Post by rtenklooster » 29 Aug 2015, 12:46

To enlarge the WAF ( Wife Acceptance Factor), i have updated my regular light switches to esp smart switches.
How I accomplished this, will be shown in this topic. It might be useful to get new users started :)
Image
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.
Image

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.
Image
Image

Let's wire everything:
Image
Image

Next thing is assigning the functions using the web-interface:
Image

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:
Image
As you can see, i assigned a on- and off function to my esp-switch. The action is:

Code: Select all

http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=1&switchcmd=Toggle
This action is the same for both on- and off commands. Using the toggle function assures me, the device doesn't get switched on- or off twice. If this switch would be the only switch for my ceiling light, I would be using cmd=On & cmd=Off.

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 ;)
Richard - Groningen (NL) - Image

BertB
Normal user
Posts: 1001
Joined: 25 Apr 2015, 14:39

Re: My Built-in-wall domoticz switch + pir + barometer

#2 Post by BertB » 29 Aug 2015, 19:02

Interesting example.
What do you use to power this up?

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: My Built-in-wall domoticz switch + pir + barometer

#3 Post by rtenklooster » 30 Aug 2015, 20:50

BertB wrote:Interesting example.
What do you use to power this up?
I have drilled a hole trough the wall. The other side of the wall has a central heating radiator covering the hole. I use a simple mobile phone charger.
Richard - Groningen (NL) - Image

lopo
Normal user
Posts: 2
Joined: 05 Sep 2015, 23:34
Location: Figaredo-Asturias

Re: My Built-in-wall domoticz switch + pir + barometer

#4 Post by lopo » 21 Sep 2015, 19:30

Hi rtenklooster very good post.

For simplicity, if u like use the pir sensor with 3,3vcc check the latest link.

http://techgurka.blogspot.pt/2013/05/ch ... otion.html

Dylantje
Normal user
Posts: 255
Joined: 11 Oct 2015, 16:51

Re: My Built-in-wall domoticz switch + pir + barometer

#5 Post by Dylantje » 22 Oct 2015, 08:46

nice...!!!
Great option..
Is this like a Zwave switch, with feedback of the status?

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: My Built-in-wall domoticz switch + pir + barometer

#6 Post by rtenklooster » 22 Oct 2015, 09:15

[quote="lopo"]Hi rtenklooster very good post.

For simplicity, if u like use the pir sensor with 3,3vcc check the latest link.

http://techgurka.blogspot.pt/2013/05/ch ... otion.html[/quote]
Thanks for the suggestion... seems to be a nice workaround:)
[quote="Dylantje"]nice...!!!
Great option..
Is this like a Zwave switch, with feedback of the status?[/quote]
Well.. it's a combined switch / actuator. If sending fails domoticz shows an error, but i'm not shure about that, just because it always works.
Richard - Groningen (NL) - Image

the cosmic gate
Normal user
Posts: 102
Joined: 14 Nov 2015, 20:17

Re: My Built-in-wall domoticz switch + pir + barometer

#7 Post by the cosmic gate » 25 Nov 2015, 20:22

but how did you config the motion sensor ??
Trying to build almost the same as you use, but cant find the HC-SR501 PIR option. Or did you config a normal switch ?

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: My Built-in-wall domoticz switch + pir + barometer

#8 Post by rtenklooster » 26 Nov 2015, 19:06

Hi, I just configured it as a switch indeed :)
Richard - Groningen (NL) - Image

mkotek
Normal user
Posts: 116
Joined: 15 Dec 2015, 10:58
Location: Lomianki, Poland
Contact:

Re: My Built-in-wall domoticz switch + pir + barometer

#9 Post by mkotek » 20 Dec 2015, 10:44

Richard,
Can you please describe in more details, how do you configure your PIR to be active high
I am using SR501, but if the sensor is not detected (ESP turned off or lost connectivity), the Motion Sensor state in Domoticz is On, which is not what I would like.
Can you post your exact configuration on Easy ESP side and Domoticz as well as any scripts in play, if you have any? And of course any non standard wiring, if there is any.
By default, the PIR is active HIGH -> Motion means: HIGH signal on the corresponding pin.
So, this means you should disable the pull-up function on this input pin, else it will be high all the time, and not noticing any changes.
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.

maciekelga
Normal user
Posts: 4
Joined: 02 Feb 2016, 08:25

Re: My Built-in-wall domoticz switch + pir + barometer

#10 Post by maciekelga » 02 Feb 2016, 08:51

Hi,
I`m trying to build my own wall switch module with ESP 8266 (ESP12). I have configured one GPIO - 0 as input with pull up, module is assigned to ON/OFF switch via WIFI to Domoticz. When I change state on pin 0 lamp in Domoticz is also change state, everything is working. On ESP is firmware R048 ESP Easy. Problem is when I change state of switch in Domoticz, then ESP doesn`t see this changing.

I tried with this trick:
"As you can see, i assigned a on- and off function to my esp-switch. The action is:
Code: Select all
http://127.0.0.1:8080/json.htm?type=com ... cmd=Toggle

This action is the same for both on- and off commands. Using the toggle function assures me, the device doesn't get switched on- or off twice. If this switch would be the only switch for my ceiling light, I would be using cmd=On & cmd=Off."

I also tried just put this command in browser but I get error message. IP addres and IDX is correct.

mkotek
Normal user
Posts: 116
Joined: 15 Dec 2015, 10:58
Location: Lomianki, Poland
Contact:

Re: My Built-in-wall domoticz switch + pir + barometer

#11 Post by mkotek » 02 Feb 2016, 10:14

IP address has to be of your Easy ESP, not Domoticz.
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.

maciekelga
Normal user
Posts: 4
Joined: 02 Feb 2016, 08:25

Re: My Built-in-wall domoticz switch + pir + barometer

#12 Post by maciekelga » 02 Feb 2016, 11:11

Yes of course:)
I put IP address of my ESP.

maciekelga
Normal user
Posts: 4
Joined: 02 Feb 2016, 08:25

Re: My Built-in-wall domoticz switch + pir + barometer

#13 Post by maciekelga » 02 Feb 2016, 11:14

I`m also from Poland ;)

mkotek
Normal user
Posts: 116
Joined: 15 Dec 2015, 10:58
Location: Lomianki, Poland
Contact:

Re: My Built-in-wall domoticz switch + pir + barometer

#14 Post by mkotek » 02 Feb 2016, 14:21

What you have posted: http://127.0.0.1:8080/json.htm?type=com ... cmd=Toggle is the operation that changes state of the switch in Domoticz and this does not make sense.
What you need to put in there is command that will tell ESP to perform operation on GPIO. Like: http://<esp_ip>/control?cmd=GPIO,2,1 for GPIO 2 and action On, if Active High is your on action for the switch.
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.

maciekelga
Normal user
Posts: 4
Joined: 02 Feb 2016, 08:25

Re: My Built-in-wall domoticz switch + pir + barometer

#15 Post by maciekelga » 02 Feb 2016, 14:23

What you have posted: http://127.0.0.1:8080/json.htm?type=com ... cmd=Toggle is the operation that changes state of the switch in Domoticz and this does not make sense.
It was just example, I of course insert my ESP IP address.

mkotek
Normal user
Posts: 116
Joined: 15 Dec 2015, 10:58
Location: Lomianki, Poland
Contact:

Re: My Built-in-wall domoticz switch + pir + barometer

#16 Post by mkotek » 02 Feb 2016, 14:38

maciekelga wrote:
What you have posted: http://127.0.0.1:8080/json.htm?type=com ... cmd=Toggle is the operation that changes state of the switch in Domoticz and this does not make sense.
It was just example, I of course insert my ESP IP address.
Please check your email. It is not only about the address, but also about the whole URL - you are sending action that Domoticz will perform anyway, but you are not telling ESP to change status of GPIO. Look at my next sentence in this post.
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.

User avatar
ManS-H
Normal user
Posts: 232
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: My Built-in-wall domoticz switch + pir + barometer

#17 Post by ManS-H » 08 Sep 2016, 18:29

Richard,
What kind of switches did you use? Pulse or the normal On/Off switches

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: My Built-in-wall domoticz switch + pir + barometer

#18 Post by rtenklooster » 18 Sep 2016, 00:05

ManS-H wrote:Richard,
What kind of switches did you use? Pulse or the normal On/Off switches
Normal switches
Richard - Groningen (NL) - Image

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests