Detecting Grandpa Out of Bed Too Long

About: Retired engineer with a strong interest in DIY projects for family caregivers who are located remotely from their loved ones with a focus on seniors and those with accessibility needs.

Background

While there have been bed alarm monitors for many years that are just simple bed pad contact closures ringing a local alarm for care providers when someone gets out of bed, there hasn’t been a way for remote family caregivers to track a loved one’s out of nightly out of bed episodes.

Basic solution

Beautyrest Sleeptracker and Withings Sleep both provide a means for remote family caregivers to receive a daily report not only of their loved one’s out of bed episodes but also comprehensive sleep behavior pattern reports. These devices are Internet connected pads that fit BETWEEN the mattress and box spring and are unnoticeable by the loved one. The only requirement is that the loved one’s home has a Wi-Fi connection

Advanced solution

In addition to daily reports, the Withings Sleep mat also provides real-time status of “in-bed” and “out-of-bed” events through IFTTT, an Internet connected app for remote family caregiver smartphones. This can be useful if the caregiver wants to be alerted if the loved one is out of bed during the night.

The main problem with just using this raw data is that you will be alerted EVERY TIME the loved one gets out of bed.... to solve this you need to add another free Internet service, Stringify , which will start a 15 minute timer (or your choice of timeout) and only notify you if the loved one fails to get back into bed before that timeout.

Items needed at loved one's home:

Withings sleep pad

Wi-Fi

Items needed at your home

Your smartphone

Free IFTTT account

Free Stringify account

Supplies:

Step 1: Setting Up IFTTT

I suggest that you first test the in-bed and out-of-bed alerts without the use of the Stringify timer just to be sure you have the Withings sleep alerts working through IFTTT.

1. Log into the Withings app and click on Devices

2. Click on Configure IFTTT

3. Create an IFTTT account (if you don't have one)

4. In IFTTT, click on My Applets then then "+"

5. in the "This" portion select "Withings Sleep"

6. Login with your Withings account and select "When I get into bed"

7. Setup your times and select your sleep sensor

8. Click "Create trigger"

9. For the "that" portion, I suggest you just use notifications to get a quick test.

10. Repeat the above for "When I get out of bed"

Later, you will come back and edit the "that" portion of these IFTTT applets to use the Stringify Flows you created in the steps below.

Step 2: Setting Up Stringify Flows

You will need to create three "Flows". One for each if the IFTTT actions (in-bed & out-of-bed) as well as an "awake" flow to perform the "AND" function if the loved one gets back in bed before the timer expires. This is key to you not getting false alarms when they just were out of bed a short time.

Note that the in-bed and out-of-bed Flows use variables (things) "proceed" and "timeout" as logic events to be analyzed by the awake Flow. The Flows are "connected" by the "connect" things.

I suggest you add additional "notification" things when you are testing as they serve as useful "print" statements for debugging

Step 3: In-bed Flow

In Bed Flow:

o Triggered by the IFTTT Withings “In-Bed” trigger

o Sets the “proceed” variable to “false” (this prevents notification from being sent)

o Connects to the “Awake” Flow

Step 4: Out-of-bed Flow

·
Out of Bed Flow

o Triggered by the IFTTT Withings “Out-of-bed” trigger

o Sets the “proceed” variable to “true” (this can be overridden by a later in-bed trigger)

o Starts the “out-of-bed” timer (typically 15mins- your choice)

o Sets the “timeout” variable to “true” on timeout

o Connects to the “Awake” Flow

Step 5: Awake Flow

Awake Flow

o Performs an “AND” function IF "proceed" AND "timeout" are BOTH true.

o “proceed” variable is true (unless IFTTT in-bed trigger fires again)

o “timeout” variable is true (meaning the 15-minute timer has expired)

o Sends Notification to remote family caregiver’s smartphone indicating that loved one has been out of bed too long

Note that the above logic allows the timer to be started by an out-of-bed trigger, but does NOT allow the notification to be sent IF the loved one gets back into bed BEFORE the “timeout” variable is set to true

Step 6: Updating IFTTT Applets

Now that the Stringify flows have been created, you need to modify, or create new, IFTTT applets that will use the Stringify In Bed and Out of Bed Flows as IFTTT "that" actions

Step 7: Testing

Although you can set this up remotely as it all runs on your smartphone, the best way to test it is at your loved one's bed.

I suggest you set the timeout value short to run tests and be sure your IFTTT active time values are changed to allow your testing during the day

1. You should get a notification on your smartphone if you get out of bed and stay out of bed exceeding the timeout values

2. You should NOT get a notification if you return to bed before the timeout.

After testing, be sure to change the IFFT active time and Stringify timeout value back to what is best for your loved one.

Remember, you can always adjust these settings remotely later if you need to as they are stored in the IFTTT and Stringify apps on the Internet

Share

    Recommendations

    • IoT Challenge

      IoT Challenge
    • Gardening Contest

      Gardening Contest
    • Arduino Contest 2019

      Arduino Contest 2019

    Discussions