JGLI Posted February 23, 2017 Share Posted February 23, 2017 I wrote some code to turn on my garage door light if the garage door motion sensor senses motion. I want it to turn off the light if there is no motion for five minutes. My question is will those code keep resetting the timer every time it senses motion? Did I setup the If statements properly (not sure if the nesting is correct) GarageMotion1.tiff GarageMotion2.tiff Link to comment Share on other sites More sharing options...
VINCELdUB Posted February 23, 2017 Share Posted February 23, 2017 You have the right idea, however what you want to do is as follows. When motion sensed ?If Shabbat false -> turn on overhead light -> reset timer 5 min Then go to timer on left side and select when timer expires. When timer 5 min expires -> turn off overhead light Then delete any other programming. Note that there is only one timer. Named garage 5 min. I noticed that you have another timer on the stop sensing script. Only one is needed. And note that you want to reset the timer. Not start it. That way every time it senses motion, it will reset the timer to zero again. Happy Automating! Link to comment Share on other sites More sharing options...
VINCELdUB Posted February 23, 2017 Share Posted February 23, 2017 The reason this won't work well is that it will not turn off the light unless the motion sensor stops sensing after the timer expires. If you have left the room after one minutes then it will have stopped sensing motion and would have nothing to trigger the event "when stops sensing motion" That is why we program to the timer. When the timer expires, it will have the event. That is when you ask it to turn off the light. Happy Automating! Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 Thanks. I see how this is better. Link to comment Share on other sites More sharing options...
VINCELdUB Posted February 23, 2017 Share Posted February 23, 2017 I am glad it works for you. Use this logic for other things as well. Like media is on in a room and off. You can program your lights to dim to different level when watching a different source. Like cable tv is bright but movies is dim. Happy Automating! Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 So this morning when I wasn't at the house (guy was working in garage), the lights were flickering on and off. Seems to be OK now. If the timer is at 0 and you choose Reset Timer does it start it? If no, do I need a Start Timer and t hen and If Timer does not equal 0 Reset Timer? Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 BTW, I got here to fix it and they aren't flickering any more. Link to comment Share on other sites More sharing options...
VINCELdUB Posted February 23, 2017 Share Posted February 23, 2017 If you select reset timer. When the timer reaches zero it uses the stop command and then a start command to start it over. This is automatic and built into the timer Happy Automating! Link to comment Share on other sites More sharing options...
VINCELdUB Posted February 23, 2017 Share Posted February 23, 2017 There are instances where the timer is too short for how sensitive the motion sensor is. Is your motion sensor timer longer than one minute? Happy Automating! Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 Timer is set for 15 minutes. So reset timer will definitely start a timer that has expired. If so, when would you use "Start" timer? Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 Is there anyway of seeing the status of a timer (i.e, how many minutes are left)? Link to comment Share on other sites More sharing options...
Cyknight Posted February 23, 2017 Share Posted February 23, 2017 5 minutes ago, JGLI said: Timer is set for 15 minutes. So reset timer will definitely start a timer that has expired. If so, when would you use "Start" timer? RESET and START work very similar. START will also "set a timer back to zero and run it" but on a RUNNING timer, it will NOT trigger a start and stop event (meaning, programming based on those events do not get triggered) whereas RESET WILL trigger both does events on a running timer (and programming attached to it will trigger again). To round it up: BOTH START and RESET will trigger (only!, so no stop) a Start event. Link to comment Share on other sites More sharing options...
Cyknight Posted February 23, 2017 Share Posted February 23, 2017 4 minutes ago, JGLI said: Is there anyway of seeing the status of a timer (i.e, how many minutes are left)? No, though there is now an experience button stopwatch that will in fact display minutes (ONLY minutes, doesn't do seconds). Link to comment Share on other sites More sharing options...
prabeau Posted February 23, 2017 Share Posted February 23, 2017 Can you not see what timer is doing in composer HE ? Not exactly convenient however. Link to comment Share on other sites More sharing options...
Cyknight Posted February 23, 2017 Share Posted February 23, 2017 9 minutes ago, prabeau said: Can you not see what timer is doing in composer HE ? Not exactly convenient however. You can only see if it's running or not - you cannot see remaining time Link to comment Share on other sites More sharing options...
DIEHARD Posted February 23, 2017 Share Posted February 23, 2017 This is one thing i would love to see added to composer... would be nice when testing at least to be able to see time remaining on a timer... I suppose in a large deployment with touch pads I could see showing a timer for certain things. Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 Thanks guys, I'll keep an eye on it. Not sure why it was blinking on and off this morning. Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 Everyone the problem seems to happen when you press the light switch for the light (i.e, if its not triggered by motion). Lights flicker like crazy. There is no code related to the light when I click on it from the Programming interface. Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 Here is the latest code: Garage-2-23#1.tiff Garage-2-23#2.tiff Garage-2-23#3.tiff Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 I think the problem is that the code was turning the light on every time in senses motion. So I'm trying to setup a boolean that only turns it on if it was off, but I can't get the last command to indent. OnlyTurnOnIfOff.tiff Link to comment Share on other sites More sharing options...
JGLI Posted February 23, 2017 Author Share Posted February 23, 2017 Here is the code that finally worked. Is there an easy way to get the nesting to work - took about 20 minutes to get the lines indented properly. WorkingCode.tiff Link to comment Share on other sites More sharing options...
eddy.trochez Posted February 23, 2017 Share Posted February 23, 2017 To nest: You grab the command by the icon and drop it on top of the other icon. Like the good Jacob Whipple would say: "Icon to icon action." Link to comment Share on other sites More sharing options...
VINCELdUB Posted February 23, 2017 Share Posted February 23, 2017 I remember them saying that 10 years ago in training. I think it was Alan, said "hot icon on icon action" Happy Automating! Link to comment Share on other sites More sharing options...
JGLI Posted February 24, 2017 Author Share Posted February 24, 2017 I would drag it and the icon would change to a right arrow, but when I let go nothing happened. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.