Rules. Pulling my hair out.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
sparkes
Normal user
Posts: 11
Joined: 25 Feb 2018, 20:57

Rules. Pulling my hair out.

#1 Post by sparkes » 25 Feb 2018, 21:12

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

User avatar
grovkillen
Core team member
Posts: 3439
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rules. Pulling my hair out.

#2 Post by grovkillen » 25 Feb 2018, 21:18

Which gpio are we taking about?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Meek
Normal user
Posts: 59
Joined: 31 Oct 2017, 15:50
Contact:

Re: Rules. Pulling my hair out.

#3 Post by Meek » 25 Feb 2018, 21:34

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.

sparkes
Normal user
Posts: 11
Joined: 25 Feb 2018, 20:57

Re: Rules. Pulling my hair out.

#4 Post by sparkes » 25 Feb 2018, 22:03

Thank you.. I'll go and have a look at this now.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests