Page 1 of 1

Rules. Pulling my hair out.

Posted: 25 Feb 2018, 21:12
by sparkes
Hi

I have several ESP EASY's around my house doing various tasks but this one it just taking the piss out of me.

I have some rules set up and they all work except 1.

2 buttons with MQTT both ways. My iPhone can turn everything on and off and can see when they've been turned of physically.
The problem is with physical buttons 2 it can turn off but not on.

I must of missed something obvious.

Here are my rules:

Code: Select all

on Switch#Switch1 do                  // Button 1 ON
  if [Switch#Switch1] = 1
     gpio, 16,1			          // LED
     gpio, 5,0			          // Relay
  else
     gpio, 16,0
     gpio, 5,1
  endif
endon

on Switch#Switch1 do         	   // Button 1 OFF
  if [Switch#Switch1] = 0 
     gpio, 16,0			           // LED
     gpio, 5,1			           // Relay
  else
     gpio, 16,1
     gpio, 5,0
  endif
endon

on Switch#Switch2 do                 // Button 2 ON
  if [Switch#Switch2] =1
     gpio, 13, 1                            // LED
     gpio, 4, 0                              // Relay
  else
     gpio, 13, 0
     gpio, 4, 1
  endif
endon

on Switch#Switch2 do	         // Button 2 OFF
  if [Switch#Switch2] =0
     gpio, 13, 0			         // LED
     gpio, 4, 1			         // Relay
  else
     gpio, 13, 1
     gpio, 4, 0
  endif
endon

Re: Rules. Pulling my hair out.

Posted: 25 Feb 2018, 21:18
by grovkillen
Which gpio are we taking about?

Re: Rules. Pulling my hair out.

Posted: 25 Feb 2018, 21:34
by Meek
For example of Rules with Device setting, you could consider to take a look at http://www.meek-ha.com/manuals/meek-mt1-information/

For your code, you might simplify it as follows :
-----------------------------------------------------------------------------
on Switch#Switch1=1 do // Button 1 ON
gpio, 16,1 // LED
gpio, 5,0 // Relay
else
gpio, 16,0
gpio, 5,1
endif
endon

on Switch#Switch2=1 do // Button 2 ON
gpio, 13, 1 // LED
gpio, 4, 0 // Relay
else
gpio, 13, 0
gpio, 4, 1
endif
endon
endon
-----------------------------------------------------------------------------

Hope this works for you.

Re: Rules. Pulling my hair out.

Posted: 25 Feb 2018, 22:03
by sparkes
Thank you.. I'll go and have a look at this now.