Rule Problems

43 views
Skip to first unread message

PPee

unread,
Jun 12, 2020, 1:15:32 PM6/12/20
to TasmotaUsers

Hi All,
I have flashed a esp8266EX with tasmota and connected a temp sensor (AM2301) GPIO 14, a magnetic reed contact (doorsensor) GPIO 12 and a PIR sensor GPIO 13. 12 and 13 both set as Switch1 and Switch2. I connected to my MQTT server and that works fine with the temperature sensor. The switches however report the same message on MQTT, so you cannot distinguish wich one is triggered. So I added a rule

SwitchMode1 1
SwitchTopic 1
Rule1 on Switch2#state=1 do publish stat/%topic%/PIR1 ON endon on Switch2#state=0 do Publish stat/%topic%/PIR1 OFF endon
Rule1 1

But nothing changes on the tasmota console.
Do I miss something?
PPee 

Philip Knowles

unread,
Jun 12, 2020, 3:01:43 PM6/12/20
to PPee, TasmotaUsers

The worked example on the Buttons and Switches page is

Backlog SwitchMode 1; SwitchTopic 0
Rule1 on Switch1#state do Publish cmnd/custom-topic/SWITCH %value% endon
Rule1 1

Regards

 

Phil K

 

Sent from Mail for Windows 10

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/e73f743e-23a8-43b1-bce3-acc99d65f702o%40googlegroups.com.

 

PPee

unread,
Jun 13, 2020, 4:41:34 AM6/13/20
to TasmotaUsers
Thx Philip, That did it !!
BR PPee

PPee

unread,
Jun 16, 2020, 8:31:24 AM6/16/20
to TasmotaUsers
mmmm..
just had to reinstall Tasmota because of Wifi problems, and now I suddenly have problems with my rules...
Based on Philips mail I defined two rules,

For the DOOR sensor - Switch1:
Backlog SwitchMode 1; SwitchTopic 0; Rule1 on Switch1#state do Publish stat/%topic%/DOOR %value% endon; Rule1 1

For the PIR sensor - Switch2:
Backlog SwitchMode 1; SwitchTopic 0; Rule2 on Switch2#state do Publish stat/%topic%/PIR %value% endon; Rule2 1 

The DOOR works fine, 0 for closed and 1 for opened
The PIR only reports 2 and I would like it to report 1 for motion detected and 0 for back to basic state (as it did before the reinstall of Tasmota

Any suggestions where the mistake is and how to adapt Rule2

Thx,
PPee


On Friday, 12 June 2020 19:15:32 UTC+2, PPee wrote:

Philip Knowles

unread,
Jun 16, 2020, 8:58:30 AM6/16/20
to PPee, TasmotaUsers

You might need to use switchmode1 1 and switchmode2 1...

 

Regards

 

Phil K

 

Sent from Mail for Windows 10

 

--

You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

PPee

unread,
Jun 16, 2020, 9:39:43 AM6/16/20
to TasmotaUsers
You're a genius !!
Thx

On Friday, 12 June 2020 19:15:32 UTC+2, PPee wrote:
Reply all
Reply to author
Forward
0 new messages