WebCoRE newbie. I have a piston with two motion sensors to turn off one light switch. and with Bobbles help I believe I have that working correctly. Now I am trying to figure out a way to have a different sensor timeout for different time of the day, like when we go to bed. I’ve seen examples of “Only when-time is between” but I can’t seem to locate that and how would be the best way to lay that out. This is what I am working with. Thanks
Here is how I do what you are looking for. I have an integer variable delayHours that has a ternary expression checking the location mode. If the current mode is Sleep then the delay will be 8 otherwise it will be 4.
Below in the code it is used as wait {delayHours} hours.
Is this the sort of thing you mean.
Between 06:00 and 22:00 the original 2 motion sensors control shutting off the light.
Between 22:00 and 06:00 a different motion sensor controls shutting off the light.
EDIT: Do you use day and night modes.
If you do then there is another way of doing it.
EDIT2: This is a better way of doing it.
I was thinking last night about the day and night mode, I don’t currently use modes. Also I’m having trouble finding “time is between”. I need to do a little research on how to utilize the modes.
I actually want to use the same sensors but not to have as long of timeout after we go to bed.
Example
During the day 15 minute timeout
During bedtime, little or no timeout. The sensors have a 4 min timout
Personally I would do it the following way.
If you want a different delay time for the two scenarios then you need two turn off statements.
One for wait 10 mins between 5 and 10 and one for 5 mins between 10 and 5.
If you are using the same sensors then you can delete the second if statement and delete the time in the first if.
Lots of way to skin a cat though.
Thanks, I’ll look at it, I’m not second guessing you, however I would of thought the “or” statements would decide the time frame timeout and send it to the off switch depending on the time. The reason I don’t have a timeout on the first argument is because the motion sensors have a 4 min timeout and that is enough for the nighttime. And from what I can tell “so far” it does seems to be working as intended. I am using the same sensor during both time frames.