You can do this with either the Smart Light app or CoRE, they both allow you to set restrictions on activities. I personally am using CoRE since I am working with a combination of my phone and my wife’s, but Smart Lighting would work too if you’re just using one phone. So in your case, for example, your Phone Charging switch would trigger a Bed Time switch, but only during a fixed time window. Then you set up your Bed Time switch to trigger the Goodnight routine.
Here’s a screenshot of the restrictions in Smart Apps
Here’s a screenshot of the CoRE piston I’m using to trigger the Bed Time virtual switch, which then triggers the Goodnight routine. Each of the Chris and Jody charging switches are set by IFTTT. Hope this helps.
I use Routines to trigger night mode. It turns off the lights and sets the thermostat temp based on the time I set. When I go to bed earlier than the set time, I just tap the routine in the app. I normally check my phone for battery amount, messages, calls alarms etc right before going to sleep anyway so tapping the app is no big deal.
I have a spare motion detector I might set up in a box on the night stand to trigger night mode and good morning mode.
your solution sounds very interesting. Could you please explain how do you trigger if your phone is charging or not? How do you set the virtual “Phone Charging Switxh” to on or off?
Since I needed to consider both my wife’s presence and phone and mine, I am using CoRE to conditionally set the “Bed Time” virtual based on who is home and what the charging states are. It’s set up with a mode restriction of Home only (so if we are on vacation and someone is house sitting, it doesn’t shut everything down on them when we go to bed), and a time restriction of 9:00pm to 5:30am.
Thanks for the very detailed and hepful description. One additional question from my site?
Why do you use the “Switch activities home phrase” smart app instead of changing the mode directly with CoRE? Should also work directly in CoRE?
Yes I think may be better to use only one simulated switch (for each phone) and changing directly from CoRE.
Thanks for sending the CoRE logic you developed. Afrer the Then path there is an Else path to switch the “Bed Time” off, isn’t it?
Thanks for the information I just tried to set it up but everything went wrong with the Good Morning. I also have to include in the piston the presence of both phones the combination which one is UNPLUGGED and the THEN path with the Bed Time to switch off.
I’m only using my wife’s phone to trigger Good Morning. Mine is on a wireless charger so it actually stops charging when it hits 100%, then starts again at 98%, then stops at 100%, etc, so that causes problems. If I was using both though, I think it would go something like this:
If
Each of Jody or Chris presence is present
AND
Any of Jody Phone Charging or Chris Phone Charging Switch is Off
OR
Chris Presence is present
AND
Jody Presence is not present
AND
Chris Phone Charging switch is off
OR
Jody Presence is present
AND
Chris Presence is not present
AND
Jody Phone Charging Switch is off
THEN
Using Bed Time
Turn Off
I updated my CoRE pistons last night also, to directly run the Good Night and Good Morning routines instead of switching the virtual Bed Time switch on and off, and they work, so I deleted the Switch Triggers Home Routine rule and removed the Bed Time virtual switch. Simplifies things a little bit and worked the same when I tested.