Author Topic: Limit Scene to one specific day a week  (Read 161 times)

Offline lmlanning

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Limit Scene to one specific day a week
« on: August 04, 2018, 05:05:25 pm »
I have a sensor on my milk box.  The milk is delivered on Thursday but never at the same time.  I want to be notified if the milk box is opened on Thursday but not on other days.  The scene makes me pick a specific time.  Help.

Online jswim788

  • Hero Member
  • *****
  • Posts: 789
  • Karma: +57/-2
Re: Limit Scene to one specific day a week
« Reply #1 on: August 04, 2018, 05:23:48 pm »
Create your scene to be notified, then add a conditional as shown here: http://forum.micasaverde.com/index.php/topic,18679.msg142023.html#msg142023

That's a general form and is more complicated than it needs to be for your case which could be this:
Code: [Select]
local tNow = os.date("*t")
local dNow = tNow.wday
return (dNow == 5)
Although I think I recall that some notifications happen regardless of the conditional return from the scene.  So you want to make sure you are notified via some action in your scene.

Or try using PLEG.

Offline lmlanning

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Limit Scene to one specific day a week
« Reply #2 on: August 04, 2018, 06:58:53 pm »
Thanks for the reply.  I may have found my solution.  I found that I could limit the device trigger to one day and I used the time from 12 am to 11:59 pm. 
« Last Edit: August 04, 2018, 07:09:43 pm by lmlanning »