Once a day scene, triggered between 8 am and 9 am with motion.

I would like to setup a scene that is triggered with motion sensor. But it should only run the scene between 8 am and 9 am an only once per day. I have it work for the entire process, but it runs every time the motion is tripped. Two things I am looking to solve.

  1. How can I have it only run between 8 am and 9 am
  2. Only run once per day?

My scene is in my master closet. When I wake up, it will trigger once I walk in, then it will get the weather, announce over my sonos speakers then play music playlist while I get ready. The only problem I have is the two issues above. Need to limit when it gets triggered. Tried Global variables, but when you restart, save via console, they get reset, so if I was testing other stuff, this will reset the morning process. Thinking about creating a local file, then every night clear them out. Just not sure the process or best way. Anyone have any suggestions?


I run similar scenario’s using some Luup. I use min/max time to set the time frame and a virtual switch (created through plugin) to run it only once. code looks like this

[code]local t = os.date(‘*t’)
local current_second = t.hour * 3600 + t.min * 60 + t.sec
local min_time_in_seconds = 8 * 3600 + 0 * 60
local max_time_in_seconds = 9 * 3600 + 0 * 60

local scene = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,55)

if (current_second > min_time_in_seconds) and (current_second < max_time_in_seconds)
return true
return false
return false

In the scene you switch on the virtual switch and after nine switch off the virtual switch and will will do the trick again the next day.
This is only one solution, there are more e.g. use PLEG.

Create an input Trigger:
Motion When motion detector detects motion

Create a condition:
MorningActivity 08:00:00; Motion; 09:00:00

Leave the Repeat checkbox uncheched.

Add an action to the MorningActivity condition to turn on the light.

Thanks will try when i get home.

I installed Program Logic Event Generator and followed your instructions. I used LUUP code to trigger my actions. But does not appear to work. Attached my setups.

Instead of snapping these windows … please post the output of the “Status” command … We can see everything important about your setup … including seeing if/when it was triggered.

Prefer to be posted as PDF (You can get a free PDF printer … search Google … I use CutePDF)

It worked this morning. I think it was tripped once before yesterday, since I have only once, did not trip when I tried yesterday. Thanks for helping so quick.