Please Help with Notification piston


#1

I am trying to make a notification piston for my driveway. I want the piston to activate the notification - "Driveway Alert" each time the contact sensor is opened. But If that contact sensor was opened 4 times in the last minute the piston should send a different notification - "The drive is too Busy" and stop sending all notifications after that for 15 minutes and then resume normal notification -"Driveway Alert"


#2

heres an example snippet … if you need an example piston let me know:

define
   bool isBusy
   integer count
   datetime lastOpen
end define

if contact sensor changes to open
   if isBusy
      if lastOpen - now() > 15*60*1000
        set isBusy = false
        set count = 0
        set lastOpen = now()
      end if
   end if
   if now() - lastOpen < 1*60*1000
      count = count + 1
   end if
   if count == 4
      set isBusy = true
      send notification the driveway is too busy
   else
      if count < 4
         send notification driveway alert
      end if
   end if
   set lastOpen = now()
end if

#3

Thank you so much!! That is perfect. I cant figure out how to translate that to a piston though. :frowning: sorry I am a newb.


#4

Can you please share an example piston?


#5

on mobile will do later today


#6

woot!! Thank you


#7

try this:


#8

THANK YOU!!! Works like a champ.