Rules with system variable

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
cslehel
New user
Posts: 2
Joined: 02 Apr 2018, 11:43

Rules with system variable

#1 Post by cslehel » 02 Apr 2018, 11:55

Hello,

i have installed 2.0-20180322 on a NodeMCU.
I have two devices, a led and a relay.
I control the led from mqtt, if i turn off the led the relay turns on for a second, then after five seconds the led turns on.
Everything is working except when i reboot the board and connects to the mqtt server, the led turns off and the relay board turns on.
I tried to disable the first command with system variables but without success.

Code: Select all

On System#Boot do    
  gpio,2,0
Endon

On led#state do
  If %uptime%>2
    If [led#state]=1
      LongPulse_mS,5,0,500
      timerSet,1,5
    else
      gpio,5,1
    Endif
  Endif
Endon

On Rules#Timer=1 do
  gpio,2,0
  gpio,5,1
Endon
The led have Inverse logic checked, Mqtt retain message checked, Send boot state checked, Send to controller checked.
The %uptime%>2 does not seems to work.
Someone have any idea how to disable the first switch after the reoot ?

Thank you.

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

Re: Rules with system variable

#2 Post by grovkillen » 02 Apr 2018, 12:07

Multiple ifs is not working. Please study the wiki on rules.
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:

cslehel
New user
Posts: 2
Joined: 02 Apr 2018, 11:43

Re: Rules with system variable

#3 Post by cslehel » 02 Apr 2018, 12:14

Thank you :)

Who is online

Users browsing this forum: Ahrefs [Bot], Anthropic Claude Bot [bot], Bing [Bot] and 15 guests