webCoRE presence sensor: Sleep Capability (What is it; how to use it)


#1

A number of users seem curious as to the purpose and functionality of the sleep capability within the webCoRE presence DTH. As @ady624 likes to say I pushed to include the feature. So that said, it’s my deal to explain some use cases and purpose behind adding the capability.

Let’s start with 2 questions.

  1. Do you use user(s) presence as a trigger (going or coming), and/or user presence as a condition (ie. user1 Home, motion detected, turn on light only if user2 is away)
  2. In your automations, do you use modes to differentiate between some form of day vs night, (awake vs asleep) automations?

If you answered yes to either question, but especially to both of these questions, user wake status tracking is another step in better customizing and evolving your automations to be more intelligent and tailored to each user.

There are so many use cases. Here are just a few ideas

  • Whether you want a light (like a “stairs nightlight”) to come on, or at what level it comes on depending if a specific user is sleeping. Let’s say user 3’s room is near those stairs, they sleep with the door open, and if they are home and sleeping. So when that user is home/sleeping only turn the lights to 10% for 3 minutes at night, whereas that user is away or present and awake, the more convenient 50% brightness till motion not detected for 10 minutes is your go to choice.
  • You and the wife go to bed at different times, on occasion or often, no matter. Let’s say she goes to bed at 21:00, you at 22;15. She runs “goodnight wife” bedroom shuts down, but you’re still up. Maybe it shuts off Lights in areas you wouldn’t use, but leaves on your office lights and the kitchen. Rather than the last user going to bed and running goodnight, you do it individually. Now the common area stuff shuts off only when the last user goes to bed, but the kids areas and her spaces shut off when she goes to bed.
  • Take that a step further. you have a room air conditioner. You like the room cold AF. Your wife doesn’t care either way. So you only have it turn on when you go to sleep, not her.
  • She drinks coffee. You don’t. You get up at 06:00. Her at 07:00. Why not have the coffee totally fresh for her at 07:00 rather than an hour old on the hot plate from when you ran good morning, rather than good morning husband.
  • What about when young adult kids stay up later than you?
  • In any case, have whoever the last goodnight routine (between present users) shut everything off.
  • Let’s say a user has to be up daily by 06:00 for school on weekdays. If at 06:45, either the user is not “awake” or their light manually turned on, have their lights start flashing, have their room sonos start blaring and flash color light red until they run good morning (userX)

As you can see, there are an endless combinations of scenarios where an individual’s sleep status is a useful variable/trigger.

In the past, I accomplished this with a virtual switch for each user that their goodnight and good morning routines turned on and off. This works splendidly. But I’m kind of OCD and wanted presence and sleep status as all part of the user’s condition, rather than 2 separate handlers.
So I pestered @ady624 to add the capibility if we developed it. He was very gracious and agreed. @bangali wrote the functions into the DTH, and I customized the layout and tile style/icons.

My OCD basically was the force behind the idea, because why should you have to to 2 separate places to see the relevant user specific conditions and triggers. Rather than simply a user presence sensor, this DTH is intended to be a user status/condition monitor.
Why waste 2 spots in your favorites list, or 2 tiles on your actiontiles dashboard? See what I’m saying here?

As to whether you use the capability or not, you now have a one stop shop device that tracks the user, not just if they are home or not.
If you chose not to use it, the sleeping/awake tile will never change, nor do anything for you. It will also not interfere with the Device simply being a presence sensor. So there’s no downside here.

Now let’s say you use it.
There are 3 statuses on the main tile.

  • Home
  • Home (sleeping)
  • Away

The main tile is simply a display tile. It is no different than setting a piston state based on the conditions of various variables. It is a single tile user readout of the various possible combination of states. In the device’s expanded page, line 2 displays the separate presence and sleeping statuses.

Functional elements:

  • The sleep capability can be manually toggled by touching the tile rather than solely by piston triggering. (thanks Ady!)
  • The capabilities are separate. Either can be used as a condition or trigger
  • If a user is still asleep (forgot to run wake up routine) and leaves the house, the DH will automatically toggle the sleep status to awake. You don’t need a piston setup to do this.

Need ideas, or assistance with setting up automations based on the condition, post below or send me a PM. Happy to offer any advice on use cases and setup that I can. And I hope you all can make use of this to evolve your rules further.


[Install Instructions] webCoRE Presence Sensor on your iPhone (beta)
#3

Reserved


#4

I like it. I’m one of those people who has been using global variables to accomplish the same thing, and I can see how putting it all in one place makes better sense. What I don’t like is now I have to go bank and tinker with all the pistons I insisted I would never tinker with again. :upside_down_face:

Just thinking out loud, I can see taking this one step further. You could add an alarm clock to the app so that not only would I be able to see what time my wife plans on waking up (with her schedule, that would be helpful), but so that various alarms could trigger specified pistons. Her “wake up” alarm would trigger the coffee pot, turn on the lights to her preference, warm up the shower, play music, or whatever else is in her routine. Maybe I’d have a “cooking” alarm that would warm up the oven, or a “guest” alarm that would turn on the outdoor and porch lights before the guest arrive. I’m doing some of those things now, but in somewhat convoluted ways.


#5

Me too


#6

This might be too much, but would it be possible to have the Sleep / Awake adjusted by the gyro in the phones? So if you pick up the phone in the am (or with a piston after a certain time in case you check your phone) it would automatically put the phone in awake?

Or @ady624, Android has the ability to use Widgets so you can add buttons to the homescreen. Would it be possible to have a widget available to push the button instead of having to go into the app to hit awake?


#7

As to widgets, make a virtual momentary button in IDE.
Add it to favorites/widgets.
Set WC piston to watch for that button.
If button pressed, presence.sleep to awake


#8

The ST Widgets run routines and the routines cannot use buttons, only switches, so you would need to create an awake routine (on) and a sleep routine (off) which should work. I was just thinking of the WC app having a toggle like widget button.


#9

You want SharpTools. You can have widgets for things and integrate with Tasker. You could make a virtual momentary button in IDE. Add it to SharpTools. Place it as a widget. Set WC piston to watch for that button. If button pressed, presence.sleep to awake


#10

If you are looking for a sleep sensor (Android only), look at this app: http://sleep.urbandroid.org/

I wear my Android watch at night with this app which tracks your sleep patterns, snoring, heart rate, etc. No clue how accurate it actually is but it doubles as my alarm clock as well. Nice thing about this app is it works with IFTTT so I have it setup when I start the sleep on this app at night, it’ll turn off my lights, set my alarm, etc plus it’ll set my webCoRE Presence Sensor to sleep as well. webCoRE Presence Sensor has replaced the switch I had created previously for when I was asleep.

Here’s my posting on the Example Pistons section on how I set this up:
https://community.webcore.co/t/start-good-night-routine-with-motion-and-sleep-on-android-app/


#11

I forgot about sharptools widgets. Ill give that a shot.


#12

It’s a great tool. use this to trigger the sleep capability in the DTH if you want to!


#13

I already do, see my example piston I posted :slight_smile: https://community.webcore.co/t/start-good-night-routine-with-motion-and-sleep-on-android-app/


#14

What would be cool is for the iOS app, is to tap into HealthKit. The iPhone seems to be able to track my sleep pretty well (not sure how it knows when i go to sleep…i do have ‘Bedtime’ configured but don’t actually follow it rigorously). That way, the sleep toggle for on/off does not need to only rely on pistons firing or events happening…just getting the data from the phone itself to sleep and wake. :slight_smile:


#15

@ady624 can the mobile app tap healthkit?


#16

Sleep doesn’t seem to work anymore :slight_smile: On the ST app, hit Sleep and when you refresh it’s back to awake. Tried using a piston to set it to asleep and doesn’t as well. Is this happening for everyone else?


#17

No. But I’m on the road a couple more days. I’ll try when home


#18

I’m having no problems with any of my pistons that sets the WebCore DTH to Sleep or Awake. It works great for me:

I trigger it using the piston I posted above and have a few other pistons as well that triggers it with my good night (set to sleeping) and good morning pistons (set to not sleeping)


#19

Found out the issue. I was testing it while i was out from home. It only stays asleep if you’re at home - which makes sense!


#20

My current setup is pretty basic in terms of devices, so this isn’t something I can test myself. So far I just have contact sensors on the exterior doors and ground floor windows, no motion sensors. I’m also still (slowly) adding smart switches, so my light control ability is limited (I have two hallways that are both 5-way circuits, so that adds up quickly). But I was wondering how well this works with pets. Do you have to rely on the motion sensor’s ability to ignore pets (which I never really trust)?


#21

I don’t get how this feature is accessed. I think I am missing something. Is there a tutorial on this? Or how do I get this ability in webCoRE?