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


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


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/


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:


@ady624 can the mobile app tap healthkit?


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?


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


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)


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!


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)?


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?



I click “Asleep” tile, being at “Home”, but nothing happens.

In live logs I see error:
“java.lang.NullPointerException: Cannot invoke method sort() on null object”

I am using Android phone. Am I missing something?



Ok, first, the capibility is nested within the webcore presence sensor that is part of the webcore app for your smartphone.
Second, think of the sleep status similarly to a virtual switch with on/off capability.

In and of itself it doesn’t do anything. It’s not an actually a physical device, nor is it automatically triggered.

That said, it is a separate capibility within the presence sensor DH, (again, the same as if a virtual switch was nested within the DH).

The ways I use it:

I use Alexa/IFTTT to trigger my sleep and wake routines:

“Alexa, trigger Goodnight”

when alexa triggers “goodnight”, send webhook(a)

when IFTTT webhook(a) runs, set 'Presence sensor - cozdabuch' to sleeping
when 'Presence sensor - cozdabuch' changes to sleeping: [goodnight actions run]


“Alexa, trigger Good Morning”

when alexa triggers “good morning”, send webhook(b)


  • when IFTTT webhook(b) runs, set 'Presence sensor - cozdabuch' to not sleeping

  • when 'Presence sensor - cozdabuch' changes to sleeping: [good morning actions run]

I also have certain things happen/not ‘only when’

'Presence sensor - cozdabuch' is not sleeping
'Presence sensor - wife' is not sleeping

  • if master bathroom door opens
    – then turn on master bathroom lights


'Presence sensor - cozdabuch' is sleeping AND 'Presence sensor - wife' is sleeping

if any of 'Presence sensor - cozdabuch' or 'Presence sensor - wife' change to awake

  • Thermostat: Downstairs set to heat
  • Thermostat: Downstairs set to 72

Hopefully this helps getting some idea what the sleep capability is and good ways to make use of it.


You can trigger it to sleeping or not sleeping any way you want, I simply use alexa.
But you could have it set to

if time is between say 9pm-1am,
if user 1’s nightstand lamp turns off
or maybe bedroom lights turn off
or whatever you want.

same goes in the morning. have it by a preset action like the bathroom door opens, bathroom lights come on, motion in the hallway, alarm turns off, or maybe even a specific time every morning (say on the weekdays only), etc.

basically whether you trigger it manually or automatically, it doesn’t matter, it’s simply there to “track” whether a user is asleep or awake. almost like having a mode for a user rather than the entire hub itself



Double check that your WC smartapp is the lastest version.
Then check your device handler (WC presence sensor) is the latest version
Also, if using iOS, you can DL the WC iOS app directly from the appstore.

Let us know if you’re still having issues


Can you do the same thing with Modes? ie: Goodnight, Good morning?


I suppose you could but unless you’re living alone, or you and other people in the house are on the exact same schedule, you have to start having multiple modes to cover for who is awake or asleep.

What happens when you control or restrict your automations based on modes when one person is awake and the other is asleep.

The sleep feature Really shines in multi user households.


Could you integrate this with Fitbit?


you can use it with anything compatible with ST.

it’s just a ST device that you can trigger.


if FITBIT changes to sleeping
then WebcorePresence:sleep change to sleeping

if FITBIT changes to awake
then WebcorePresence:sleep change to not sleeping

I don’t know if fitbit integrates with ST directly or not. If it doesn’t you can use IFTTT.

IF FITBIT changes to sleeping
THEN send webhook A

IF webhook A is received
then WebcorePresence:sleep change to sleeping

IF FITBIT changes to not sleeping
THEN send webhook B

IF webhook B is received
then WebcorePresence:sleep change to not sleeping


Is there a way to turn this into a virtual presence sensor for those that don’t have phones? If not is there a virtual presence sensor with sleep capabilities or other capabilities. I can’t find one.When I try to just create one it won’t let me manually change the presence.

Also how can I use what floor someone is on I see it on the app? That would really be helpful as well for things like waking and security sense everyone sleeps on the top floor of my house.

Also I use the sleep capability with this Withings/Nokia Sleep - Sleep Tracking Pad IFTTT throws a virtual switch in ST which then sets my presence to sleep. Very useful for bedroom motion detectors that turn on lights.


Create a generic device in IDE, then reassign DH to this one.