need help in rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
rajbadri
Normal user
Posts: 56
Joined: 21 Dec 2015, 21:38
Location: India

need help in rules

#1 Post by rajbadri » 28 Aug 2017, 21:37

I am trying this in Rules

on GPIO13#value do
if [GPIO13#value] = 0
NeoPixelAll,0,0,255
timerSet 1,30 // 30 sec timer
endon
on Rules#Timer=1 do
NeoPixelAll,0,0,0
endif
endon


but it does not trigger and nothing happens.

Thanks in advance

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

Re: need help in rules

#2 Post by grovkillen » 28 Aug 2017, 22:54

Is your device named "GPIO13" and it's value named "value"?
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:

User avatar
rajbadri
Normal user
Posts: 56
Joined: 21 Dec 2015, 21:38
Location: India

Re: need help in rules

#3 Post by rajbadri » 29 Aug 2017, 04:49

shot.png
shot.png (56.32 KiB) Viewed 5925 times

User avatar
rajbadri
Normal user
Posts: 56
Joined: 21 Dec 2015, 21:38
Location: India

Re: need help in rules

#4 Post by rajbadri » 29 Aug 2017, 04:51

I have tried this but does not work

on lock#Switch do
if [lock#Switch]=0
NeoPixelAll,0,0,255
timerSet 1,30 // 30 sec timer
endon
on Rules#Timer=1 do
NeoPixelAll,0,0,0
endif
endon

User avatar
rajbadri
Normal user
Posts: 56
Joined: 21 Dec 2015, 21:38
Location: India

Re: need help in rules

#5 Post by rajbadri » 29 Aug 2017, 04:56

lock is a pushbutton in domoticz which I use to activate gpio13 to 1 and 0

this is the log
Screen Shot 2017-08-29 at 8.25.18 AM.png
Screen Shot 2017-08-29 at 8.25.18 AM.png (80.64 KiB) Viewed 5923 times

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

Re: need help in rules

#6 Post by grovkillen » 29 Aug 2017, 09:31

rajbadri wrote: 29 Aug 2017, 04:51 I have tried this but does not work

on lock#Switch do
if [lock#Switch]=0
NeoPixelAll,0,0,255
timerSet 1,30 // 30 sec timer
endon
on Rules#Timer=1 do
NeoPixelAll,0,0,0
endif
endon
Almost nailed it:

Code: Select all

on lock#Switch do
 if [lock#Switch]=0
  NeoPixelAll,0,0,255
  timerSet 1,30 // 30 sec timer
 endif
endon

on Rules#Timer=1 do
 NeoPixelAll,0,0,0
endon
You had put the "endif" in the next "on"-sequence. This caused the interpreter to not understanding the code.
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:

User avatar
rajbadri
Normal user
Posts: 56
Joined: 21 Dec 2015, 21:38
Location: India

Re: need help in rules

#7 Post by rajbadri » 29 Aug 2017, 11:39

will try
Thanks

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

Re: need help in rules

#8 Post by toffel969 » 30 Aug 2017, 22:31

Should also work like this

Code: Select all

on lock#Switch=0 do

  NeoPixelAll,0,0,255
  timerSet 1,30 // 30 sec timer

endon

on Rules#Timer=1 do
 NeoPixelAll,0,0,0
endo
No if statement required, and find it good practice as additional nested if statement is possible
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 25 guests