# Overnight time-range doesn't seem to work as advertised?

**URL:** <https://community.smartthings.com/t/overnight-time-range-doesnt-seem-to-work-as-advertised/234367>\
**Category:** SmartApps & Automations\
**Created:** [November 11, 2021, 6:14pm UTC](https://community.smartthings.com/t/overnight-time-range-doesnt-seem-to-work-as-advertised/234367 "2021-11-11T18:14:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SM0001](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/sm0001/32/129829_2.png) [@SM0001](https://community.smartthings.com/u/SM0001)\
**Post date:** [November 11, 2021, 6:14pm UTC](https://community.smartthings.com/t/overnight-time-range-doesnt-seem-to-work-as-advertised/234367/1 "2021-11-11T18:14:52Z")

</div>

Hi - maybe someone smarter than me can help as I’m having no luck.  
I have a simple plug-switch (Jasco) and I have one of those radiator-heaters plugged into it.  
I’m trying to setup logic to leave the heater on during the daytime (8:30am-10:30pm).  
Between 10:30pm and 8:30am - I’m trying to setup an automation routine to turn the plug-switch on for 15 minutes and then off for 15 minutes. This would cut the usage by 50% overnight - and I can vary the off-time as needed if I want it warmer or cooler overnight.  
I can get the start/stop logic to work pretty simply in the automation-routine.  
But once I add logic to have the time limited to 10:30pm-8:30am - everything seems to stop working.  
I have 3 routines setup to try to accomplish this:  
1 - at 8:31am - turn on the plug-switch.  
2 - at 10:31pm - turn off the plug-switch.  
3 - If 10:30pm-8:30am (next day) - every day precondition.  
and if plug-switch is off for 15 minutes  
then turn on plug-switch and set turn-off after 15 minutes.  
The code works fine turning it on/off every 15 mins - but once I add in the 10:30-8:30 time constraint it never wakes up.  
Unsure what to do next on this - I could have written a Groovy smart-app to handle this but now prefer (need to) use the supplied automation-routine interface.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Mariano\_Colmenarejo](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/mariano_colmenarejo/32/220132_2.png) [@Mariano\_Colmenarejo](https://community.smartthings.com/u/Mariano_Colmenarejo)\
**Post date:** [November 11, 2021, 7:25pm UTC](https://community.smartthings.com/t/overnight-time-range-doesnt-seem-to-work-as-advertised/234367/2 "2021-11-11T19:25:46Z")

</div>

> [@SM0001](#):
>
> I have 3 routines setup to try to accomplish this:  
> 1 - at 8:31am - turn on the plug-switch.  
> 2 - at 10:31pm - turn off the plug-switch.  
> 3 - If 10:30pm-8:30am (next day) - every day

This should work fine.  
I have tested it with 1 minute **on** and another **off.**

check that in the third automation, that the plug condition **off** for 15 minutes, **it is not a precondition.**

You can also try turning **off** the plug a little later than 10:31 p.m. since the shutdown time starts counting from the first shutdown after 10:30 p.m. or try period 10:25 p.m. to 8:30 a.m. next day

---

<div class="post-metadata">

**Author:** ![milandjurovic71](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/milandjurovic71/32/208047_2.png) [@milandjurovic71](https://community.smartthings.com/u/milandjurovic71)\
**Post date:** [November 12, 2021, 12:58pm UTC](https://community.smartthings.com/t/overnight-time-range-doesnt-seem-to-work-as-advertised/234367/3 "2021-11-12T12:58:35Z")

</div>

Or try fast Automations. I have selected random times.

 ![Screenshot_20211112-065719_SmartThings](https://global.discourse-cdn.com/smartthings/original/3X/4/d/4de22a8d01ec973a11ada904806a287af63f58dd.jpeg)

 ![Screenshot_20211112-065817_SmartThings](https://global.discourse-cdn.com/smartthings/original/3X/b/9/b9933de57c0eb67a079222be1b874121375ef67d.jpeg)

---

<div class="post-metadata">

**Author:** ![SM0001](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/sm0001/32/129829_2.png) [@SM0001](https://community.smartthings.com/u/SM0001)\
**Post date:** [November 17, 2021, 3:24am UTC](https://community.smartthings.com/t/overnight-time-range-doesnt-seem-to-work-as-advertised/234367/4 "2021-11-17T03:24:32Z")

</div>

Hi - thanks very much for the replies and suggestions - however it seems my hub may have needed to be restarted or something similar. We had a hard power-failure here which took us offline for a long time. After power was restored and the hub came back up - the automation now seems to be working just fine.

Maybe there was something residual in the hub from earlier attempts at trying this?  
Either way - I’ll know to restart my hub before I throw up the white-flag when what should work doesn’t.

Thanks again.
