Advertisement
flycat

ESPeasy rules example

Dec 28th, 2022 (edited)
1,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. // Actual Docs: https://espeasy.readthedocs.io/en/latest/
  2.  
  3. // After reboot set gpio to OFF
  4. on System#Boot do
  5.  gpio,22,1 // Prevent relay turning on during boot
  6. // Monitor GPIO,22
  7. endon
  8.  
  9. // Change state of relay when button press
  10. On Button#State do
  11. If [Button#State] = 1
  12.  if [Plugin#GPIO#Pinstate#22] = 0
  13.   GPIO,22,1
  14.  Else
  15.   GPIO,22,0
  16.  Endif
  17. Endif
  18. endon
  19.  
  20. // When button (move sensor) pressed set gpio to ON waiting 10sec and set gpio to OFF
  21. On Button#State do
  22. If [Button#State] = 1
  23.  GPIO,22,0
  24.  TimerSet,1,10
  25. Endif
  26. endon
  27.  
  28. On Rules#Timer=1 do
  29.  gpio,22,1
  30. Endon
  31.  
Tags: esp SmartHome
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement