Rules for PIR combination ??

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
vincen
Normal user
Posts: 92
Joined: 26 Jun 2017, 07:15

Rules for PIR combination ??

#1 Post by vincen » 08 Sep 2017, 13:15

Hi

I have wired two PIR sensor on my ESP to cover correctly a room with strange layout. I only want one signal to come back on MQTT to tell me if there is someone in the room or not. Instead of getting both PIR back to my automation system, I was thinking to use rules in ESP to combine both PIR such as as soon as one detects something it sends signal to tell it is, and as soon as both PIR detects no more anything then send signal to say room empty.
Is it possible to use AND in rules ? and what is best or possible ? Get a logic rule to trigger an other GPIO and I link that GPIO to a switch to send back mqtt message or directly trigger the MQTT message from rules ?

Side note: running ESP Easy 2 dev 11 just in case.

Thanks for advice as never used yet the rules :D

Vincèn

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Rules for PIR combination ??

#2 Post by toffel969 » 10 Sep 2017, 10:52

vincen wrote: 08 Sep 2017, 13:15 Hi

I have wired two PIR sensor on my ESP to cover correctly a room with strange layout. I only want one signal to come back on MQTT to tell me if there is someone in the room or not. Instead of getting both PIR back to my automation system, I was thinking to use rules in ESP to combine both PIR such as as soon as one detects something it sends signal to tell it is, and as soon as both PIR detects no more anything then send signal to say room empty.
Is it possible to use AND in rules ? and what is best or possible ? Get a logic rule to trigger an other GPIO and I link that GPIO to a switch to send back mqtt message or directly trigger the MQTT message from rules ?

Side note: running ESP Easy 2 dev 11 just in case.

Thanks for advice as never used yet the rules :D

Vincèn
Yes it is possible with rules, though I really don't see the point.

Code: Select all


on pir1#switch=1 do
Publish Mqtt msg
Endon
On pir2#switch=1 do
Publish mqtt msg
Endon

For and

Code: Select all

On pir1#switch=1 do
If [pir2#switch]=1
Do something
Endif
Endon
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Rules for PIR combination ??

#3 Post by toffel969 » 10 Sep 2017, 10:54

Please look for the rules tutorial in the wiki, it will answer your questions. Why are you stingy with devices on your home automation?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

vincen
Normal user
Posts: 92
Joined: 26 Jun 2017, 07:15

Re: Rules for PIR combination ??

#4 Post by vincen » 10 Sep 2017, 11:18

toffel969 wrote: 10 Sep 2017, 10:52For and

Code: Select all

On pir1#switch=1 do
If [pir2#switch]=1
Do something
Endif
Endon
Thanks that's what I wanted to do ;)
toffel969 wrote: 10 Sep 2017, 10:54Please look for the rules tutorial in the wiki, it will answer your questions. Why are you stingy with devices on your home automation?
Sorry but what do you mean by "stingy devices" ??

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Rules for PIR combination ??

#5 Post by toffel969 » 10 Sep 2017, 15:00

Why don't you want to have both pir on your controller? You can just make them into 1 virtual pir in domoticz/openhab/ whatever
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Rules for PIR combination ??

#6 Post by toffel969 » 10 Sep 2017, 15:03

vincen wrote: 10 Sep 2017, 11:18
toffel969 wrote: 10 Sep 2017, 10:52For and

Code: Select all

On pir1#switch=1 do
If [pir2#switch]=1
Do something
Endif
Endon
Thanks that's what I wanted to do ;)

Be aware that "do something" will only happen when both pit are triggered at the same time
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests