Shared variables bedTime and wakeUpTime as basis for automation plans

Here is the tweetstorm I posted (as hkoren on twitter) earlier today. @Ben got me to come and post it here:

1/ The hardware for my #IoT smart home is installed. The software to make automation => smart hasn’t been written yet.

2/ Use case: I say to my [Android gear] watch: “OK Google, let’s try to go to bed at 9 tonight” and the default time for bed gets overridden that night.

3/ color temp of phillips hue lights start to warm at bedTime-2hrs, flash to remind me to take pills at bedTime-1hr, slowly fade to bedTime

4/ I say to my watch “OK Google, going to bed”, Signal goes to smartthings which turns off all the lights.

5/ if I don’t go to bed when I intended, the house lights will flash and I’ll get a notification at bedTime+30m

6/ “OK Google, waking up at 7 tomorrow” sets wakeUpTime. smartthings starts brewing coffee at wakeUpTime-10m. Cool lights slowly fade in

7/ if the set wakeUpTime makes it infeasible to prepare for & travel to an event, you are warned & a more appropriate wakeUpTime is proposed


@Ben: lets work with the smartthings community to have all your ideal scenarios come to fruition!

Me: it begins with a open service that allows the wakeUpTime and bedTime variables to be written, read, and triggering calls on change.


How can we make this dream happen?

OK, this is crazy…as in crazy awesome! I love it. First note - don’t leave us iOS people out of the picture! My smart watch is coming…at some point!!!

Not being a developer, but playing on TV and in past jobs, I can see some ways to do this. I can also think of half a dozen people on this board who, together, could make this happen.

First, ST has scheduling capabilities - as evident by the simple “Turn lights on using a schedule” app. Basically, I’m envisioning a master SmartApp, let’s call it the Schedule Controller, that would execute other smart apps at specific times. That seems like it has the most flexibility and greatly simplifies the process since we only have to worry about a single smartapp.

So, saying the phrases listed above would command the Schedule Controller to “start the shot clock” for the the task mentioned - in this case, bedtime. By identifying this as a different instance of the Scheduler Controller SmartApp from the “wake up time” command listed above, we can then have multiple master command phrases that trigger multiple timed events.

Nice things to have in this Schedule Controller SmartApp:

  • variable number of steps to add to the schedule with both T-minus and T-plus timing
  • the ability to have multiple smartapps execute “at the same time” in the app. Basically, the ability to assign multiple smartapps to a step in the multi-step process
  • “wizard-like interface” similar to the awesome SmartAlarm app recently written by @geko - I especially like all the help and instructions in the app

I think some of the functionality I’m envisioning above may not currently exist in the ST API.

I’m sure if I think about this over some lovely cocktails this evening I’ll have a few more epiphanies.

We have started some gear prototyping internally but wonder if someone here in the community might get it done faster. At this point I anticipate some support for this coming by fall.

Looks like this could be done with one SmartApp and then the included dashboards. It really depends on how regimented “bedtime” is.

Would you want to detect when you are sleeping / in bed? This could be done with beacons or something like the Jawbone Up24.

Voice control - there are several ways to add this (before we get native support for it) - there is the app called Shortcut, the Ubi, and a few others. These could tie into your calendar with IFTTT.

This one requires some smarts and I am not sure how to do it at this time. Wonder what some others here think of how to accomplish this.

I just unboxed my Gear two days ago, it is quite a revolutionary gizmo. Unfortunately I don’t have the personal bandwidth to contribute much more than some ideas. I am heartened by the promises made to embrace it as a platform.

Bedtime was extraordinarily un-regimented, it has gotten moreso with the ability to have certain things happen at a certain time. But a fixed time doesn’t meet my requirement. I need flexibility. I go to bed at a different time on the weekend than I might during the week. I might be forced to work till late at night one particular evening, and to override the default with one swift command. The more things that I want to have linked to my intended sleep/wake time, the more of a UX disaster trying to do this with the current ST interface becomes.

Unfortunately the lights/switch dashboard is almost totally useless when it comes to doing anything I want. No dimming ability, no color setting ability. (separate discussion…)

I think the binary Sleeping/not sleeping or in bed/not in bed is both overly simplistic as well as an extraordinarily complicated problem…(see scott jenson’s article about this). Weather I’m in bed or not does not reveal what I intended to do while going to bed. The point of this isn’t to achieve instantaneous IFTTT sort of reactions, but to give a means of expressing aspirations and have the home react to what you want to happen with a series of actions that gently encourage you to achieve what you want to happen. (I.e: Going the *F to sleep…)

A voice control won’t come close to solving the “start brewing coffee 10m before I wake up” problem.

With things like Android Wear and Siri out in the wild, Native support for voice controls in smartthings is not something I would recommend trying to tackle. Like the Lights & switches dashboard, shortcut only turned on/off particular devices, it didn’t allow for signaling intent, or even something as simple as a hello home action. The Ubi is not interesting to me since getting one of those in each room is going to get cost prohibitive fast. I don’t want to have to shout so the Ubi can hear me when I can whisper into my wristwatch. Voice control can work OK with a device that you can hold in your hand, it is going to be fantastic with one that is strapped to your body.

All I need from SmartThings to hook into the (yet to be built/identified) “Shared variables API”, and then for the SmartApps to do things that are relative (before, at, after) to those times.

The calendar related stuff is wayyyy outside your scope for sure. For now, you/ST shouldn’t be concerned about how wakeUpTime gets set… just figure out how to make stuff happen based on wakeUpTime.

Of course iOS needs to be a factor in this, as does setting these sorts of variables from all sorts of different platforms.

Scheduling is already built into most of the smart apps already, but the timings are always “absolute”, and never relative. I think that is the key to making this happen.

The sort-of exception to this now within ST is the “Night Light” app, which allows lights to turn off some time after motion stops at a certain sensor.

(Perhaps some “virtual motion sensor” could read the shared variable and trigger upon the timer reaching that point, but that would be a rather horrible kludge of a solution.)

The point is that the these times aren’t very specific at all, and change from day to day based on the cycle of the week, and based on exceptional events that might come up to derail the aspiration for strict regimentation.

Truth to this. I think your ideas are great, but I don’t think another SmartApp is the right approach to solving problem, at least until SmartApps are no longer confined to a portrait-oriented Android or iOS 6+ mobile phone/tablet.

Not only do I want to set or override variables from my smart phone or smart watch, I want to be able to do it from a browser, dragging a slider to offset the standard or current time to the exception to the norm, I want to be able to type “bedtime 9; wakeup 7” into my terminal window and have it set the shared variables.

The “Timely” alarm clock is notable as far as what I consider to be a beautiful UX for setting a wakeUpTime variable.

Imagine modifying wakeUpTime within the context of a SmartApp: you have to find your phone, unlock it, go to the home screen, find then ope the ST app, if you’re not there already, navigate back to the start screen of ST, scroll to the Convenience section, open the Scheduled Controller app, find then open the variable you want to change, change the variables value, hit Done. Well if you’ve gotten this far, you’re realizing by now how the voice command in my use case is an absolute game changer as far as UI/UX goes.

I think this “Shared variable” bit needs to be another kind of service that goes in between Smartthings and other kinds of command systems for this to really work right.

look forward to those epiphanies. I am thinking that this shared variable thing should be open source library that Smartthings, or anybody else, can integrate with or deploy wherever they might like. Worry about pretty UI’s and ST integration after that initial hole is filled:

here is the system flow I envision:

  1. Front end interface - Android wear, web/mobile app, etc.
  2. Action to set shared variable - RESTful API call
  3. Shared variable storage - Server based application (self hosted or proprietary)
  4. Shared variable change notification - RESTful API call
  5. Home Automation System - Smartthings, Vera, Revolv, HomeKit, etc…
  6. End Device

Of course steps 1-5 could potentially all exist within the ST app & cloud, but if that’s the exclusive domain of the implementation, I don’t think it will work as well as it would otherwise.

It would be great to have the ability to say “I’m ready for bed” to both Siri and to Google Now and have that start turning everything off. The point I want the developers to consider is start this process and give me time to get to bed. Allow me to set a time before all the lights would be turned completed off. Also something to consider I might want to turn on the bedroom light as I start this process.

One more thing, we also need integration to the Logitech Harmony Hub to shut down everything.

Corey,

What I am doing with ST now along these lines is that I have a “Bedtime” action that is set to be triggered at a certain time (10:45). This is an abrupt point at which the lights dim to 10%. (side note: oh how I long for granular controls that allow for 1% dimming, which is actually somewhere around 20% dim on hue bulbs, 10% is closer to 30% luminance, and not very dim at all).

Any pre-set “bedTime” variable should not be confused with the time that you actually end up tucking into bed and wanting all the lights in the house out. In my HA dream land, saying “I’m ready for bed” would be the equivalent of setting bedTime to NOW, which would trigger the Bedtime action.

An augmented version of your command: “I’m ready for bed in 10 minutes” should provide a slow fade to very dim light rather than the abrupt level change which is possible now.

The control which ST Hello home gives us now, might not as easy to activate as “the clapper”, but at least it’s quieter. The smart watch or UBI voice command is also not suitable for lights out. If I need to make any noise to trigger an action to turn out the lights, my wife and baby will get woken up by the racket. Voice commands are not a panacea

Although I’m using hello home for “lights out” now, I don’t have the patience or the self control to also use hello home for bed time, or to bother accessing it more than once an evening for that mater.

I do hope that a redesigned ST app makes hello home significantly more accessible than it currently is. I’d like for an action invocation to be no more than two taps away from any point in the ST app. Currently it from 3-5 taps away on top of the trouble to get into the ST app. If there was a two-tap ST android home screen widget, I’d enjoy using this system so much more than I do currently.

While we are making a wish list, having the granular controls for separate dimmers within an action is the other piece I need today. I have a dimmer for my lights and a dimmer for my ceiling fan. I don’t want to set the same % for all my dimmers as it works today.

Oh god, please yes! I have a bunch of LED bulbs and Linear dimmers. They work great, but 10% on the LED bulbs is pretty bright when I have the kitchen lights come on in Night mode and someone walks into the area. When I have tested the bulbs with the slider, 2% is actually what I want.

I also long for the day when I can individually set dimmer percentages in a mode or action rather than all dimmers to 30% or something like that.

Even better - if I have a group of lights set to different percentages (say 40%, 30% and 60%), I would love to be able to use a slider for the group. Meaning if I slide the slider, they all go up at the same rate but from the % they started from. So, I could move them up to 50%, 40%, and 60%. There are times when you need to have different dimmers in a group move together at different levels.

1 Like