mirror of
https://github.com/correl/correl.github.io.git
synced 2024-12-29 11:09:24 +00:00
[draft] hue wake-up
This commit is contained in:
parent
51ff0c9281
commit
9295ca4544
4 changed files with 624 additions and 0 deletions
329
_drafts/2018-03-13-hue-wake-up.html
Normal file
329
_drafts/2018-03-13-hue-wake-up.html
Normal file
|
@ -0,0 +1,329 @@
|
||||||
|
---
|
||||||
|
title: "How Does The Phillips Hue Wake-Up Feature Work?"
|
||||||
|
author: "Correl Roush"
|
||||||
|
---
|
||||||
|
<p>
|
||||||
|
I recently got myself a set of Phillips Hue White and Color Ambiance
|
||||||
|
lights. One of the features I was looking forward to in particular
|
||||||
|
(besides playing with all the color options) was setting a wake-up
|
||||||
|
alarm with the lights gradually brightening. This was pretty painless
|
||||||
|
to get set up using the phone app. I'm pretty happy with the result,
|
||||||
|
but there's certainly some things I wouldn't mind tweaking. For
|
||||||
|
example, the initial brightness of the bulbs (at the lowest setting)
|
||||||
|
still seems a bit bright, so I might want to delay the bedside lamps
|
||||||
|
and let the more distant lamp start fading in first. I also want to
|
||||||
|
see if I can fiddle it into transitioning between some colors to get
|
||||||
|
more of a sunrise effect (perhaps "rising" from the other side of the
|
||||||
|
room, with the light spreading towards the head of the bed).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Figuring out how the wake-up settings that the app installed on my
|
||||||
|
bridge seemed a good first step towards introducing my own
|
||||||
|
customizations.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Information on getting access to a Hue bridge to make REST API calls
|
||||||
|
to it can be found in the <a href="https://www.developers.meethue.com/documentation/getting-started">Hue API getting started guide</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div id="outline-container-org3991407" class="outline-2">
|
||||||
|
<h2 id="org3991407">My Wake-Up Settings</h2>
|
||||||
|
<div class="outline-text-2" id="text-org3991407">
|
||||||
|
<p>
|
||||||
|
My wake-up is scheduled for 7:00 to gradually brighten the lights with
|
||||||
|
a half-hour fade-in each weekday. I also toggled on the setting to
|
||||||
|
automatically turn the lights off at 9:00.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-center">
|
||||||
|
<p>
|
||||||
|
<img src="/images/Screenshot_20180313-131855.png" alt="nil"/> <img src="/images/Screenshot_20180313-131858.png" alt="nil"/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Wake up is kicked off at 6:30 with a schedule:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-http"><span style="color: #5fafd7;">GET</span> <span style="color: #ffd700;">http://bridge/api/${username}/schedules/1</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-js">{
|
||||||
|
<span style="color: #ff4ea3;">"name"</span>: <span style="color: #ff4ea3;">"Wake up"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"description"</span>: <span style="color: #ff4ea3;">"L_04_fidlv_start wake up"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"command"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/api/oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8/sensors/2/state"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"body"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"flag"</span>: <span style="color: #5fafd7;">true</span>
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"method"</span>: <span style="color: #ff4ea3;">"PUT"</span>
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"localtime"</span>: <span style="color: #ff4ea3;">"W124/T06:30:00"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"time"</span>: <span style="color: #ff4ea3;">"W124/T10:30:00"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"created"</span>: <span style="color: #ff4ea3;">"2018-03-11T19:46:54"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"status"</span>: <span style="color: #ff4ea3;">"enabled"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"recycle"</span>: <span style="color: #5fafd7;">true</span>
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This schedule triggers a sensor:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-http"><span style="color: #5fafd7;">GET</span> <span style="color: #ffd700;">http://bridge/api/${username}/sensors/2</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-js">{
|
||||||
|
<span style="color: #ff4ea3;">"state"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"flag"</span>: <span style="color: #5fafd7;">false</span>,
|
||||||
|
<span style="color: #ff4ea3;">"lastupdated"</span>: <span style="color: #ff4ea3;">"2018-03-13T13:00:00"</span>
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"config"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"reachable"</span>: <span style="color: #5fafd7;">true</span>
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"name"</span>: <span style="color: #ff4ea3;">"Sensor for wakeup"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"type"</span>: <span style="color: #ff4ea3;">"CLIPGenericFlag"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"modelid"</span>: <span style="color: #ff4ea3;">"WAKEUP"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"manufacturername"</span>: <span style="color: #ff4ea3;">"oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"swversion"</span>: <span style="color: #ff4ea3;">"A_1801260942"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"uniqueid"</span>: <span style="color: #ff4ea3;">"L_04_fidlv"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"recycle"</span>: <span style="color: #5fafd7;">true</span>
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
A rule is triggered by this sensor updating:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-http"><span style="color: #5fafd7;">GET</span> <span style="color: #ffd700;">http://bridge/api/${username}/rules/1</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-js">{
|
||||||
|
<span style="color: #ff4ea3;">"name"</span>: <span style="color: #ff4ea3;">"L_04_fidlv_Start"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"owner"</span>: <span style="color: #ff4ea3;">"oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"created"</span>: <span style="color: #ff4ea3;">"2018-03-11T19:46:51"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"lasttriggered"</span>: <span style="color: #ff4ea3;">"2018-03-13T10:30:00"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"timestriggered"</span>: 2,
|
||||||
|
<span style="color: #ff4ea3;">"status"</span>: <span style="color: #ff4ea3;">"enabled"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"recycle"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"conditions"</span>: [
|
||||||
|
{
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/sensors/2/state/flag"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"operator"</span>: <span style="color: #ff4ea3;">"eq"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"value"</span>: <span style="color: #ff4ea3;">"true"</span>
|
||||||
|
}
|
||||||
|
],
|
||||||
|
<span style="color: #ff4ea3;">"actions"</span>: [
|
||||||
|
{
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/groups/1/action"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"method"</span>: <span style="color: #ff4ea3;">"PUT"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"body"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"scene"</span>: <span style="color: #ff4ea3;">"7GJer2-5ahGIqz6"</span>
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/schedules/2"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"method"</span>: <span style="color: #ff4ea3;">"PUT"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"body"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"status"</span>: <span style="color: #ff4ea3;">"enabled"</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The bedroom group is set to the following scene, which turns on the
|
||||||
|
lights at minimum brightness:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-http"><span style="color: #5fafd7;">GET</span> <span style="color: #ffd700;">http://bridge/api/${username}/scenes/7GJer2-5ahGIqz6</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-js">{
|
||||||
|
<span style="color: #ff4ea3;">"name"</span>: <span style="color: #ff4ea3;">"Wake Up init"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"lights"</span>: [
|
||||||
|
<span style="color: #ff4ea3;">"2"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"3"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"5"</span>
|
||||||
|
],
|
||||||
|
<span style="color: #ff4ea3;">"owner"</span>: <span style="color: #ff4ea3;">"oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"recycle"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"locked"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"appdata"</span>: {},
|
||||||
|
<span style="color: #ff4ea3;">"picture"</span>: <span style="color: #ff4ea3;">""</span>,
|
||||||
|
<span style="color: #ff4ea3;">"lastupdated"</span>: <span style="color: #ff4ea3;">"2018-03-11T19:46:50"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"version"</span>: 2,
|
||||||
|
<span style="color: #ff4ea3;">"lightstates"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"2"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"bri"</span>: 1,
|
||||||
|
<span style="color: #ff4ea3;">"ct"</span>: 447
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"3"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"bri"</span>: 1,
|
||||||
|
<span style="color: #ff4ea3;">"ct"</span>: 447
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"5"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"bri"</span>: 1,
|
||||||
|
<span style="color: #ff4ea3;">"ct"</span>: 447
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Another schedule is enabled by the rule, which fires one minute after
|
||||||
|
its creation:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-http"><span style="color: #5fafd7;">GET</span> <span style="color: #ffd700;">http://bridge/api/${username}/schedules/2</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-js">{
|
||||||
|
<span style="color: #ff4ea3;">"name"</span>: <span style="color: #ff4ea3;">"L_04_fidlv"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"description"</span>: <span style="color: #ff4ea3;">"L_04_fidlv_trigger end scene"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"command"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/api/oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8/groups/0/action"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"body"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"scene"</span>: <span style="color: #ff4ea3;">"gXdkB1um68N1sZL"</span>
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"method"</span>: <span style="color: #ff4ea3;">"PUT"</span>
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"localtime"</span>: <span style="color: #ff4ea3;">"PT00:01:00"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"time"</span>: <span style="color: #ff4ea3;">"PT00:01:00"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"created"</span>: <span style="color: #ff4ea3;">"2018-03-11T19:46:51"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"status"</span>: <span style="color: #ff4ea3;">"disabled"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"autodelete"</span>: <span style="color: #5fafd7;">false</span>,
|
||||||
|
<span style="color: #ff4ea3;">"starttime"</span>: <span style="color: #ff4ea3;">"2018-03-13T10:30:00"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"recycle"</span>: <span style="color: #5fafd7;">true</span>
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
That schedule sets another scene, which transitions the lights to full
|
||||||
|
brightness over the next 29 minutes (1740 seconds).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-http"><span style="color: #5fafd7;">GET</span> <span style="color: #ffd700;">http://bridge/api/${username}/scenes/gXdkB1um68N1sZL</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-js">{
|
||||||
|
<span style="color: #ff4ea3;">"name"</span>: <span style="color: #ff4ea3;">"Wake Up end"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"lights"</span>: [
|
||||||
|
<span style="color: #ff4ea3;">"2"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"3"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"5"</span>
|
||||||
|
],
|
||||||
|
<span style="color: #ff4ea3;">"owner"</span>: <span style="color: #ff4ea3;">"oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"recycle"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"locked"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"appdata"</span>: {},
|
||||||
|
<span style="color: #ff4ea3;">"picture"</span>: <span style="color: #ff4ea3;">""</span>,
|
||||||
|
<span style="color: #ff4ea3;">"lastupdated"</span>: <span style="color: #ff4ea3;">"2018-03-11T19:46:51"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"version"</span>: 2,
|
||||||
|
<span style="color: #ff4ea3;">"lightstates"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"2"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"bri"</span>: 254,
|
||||||
|
<span style="color: #ff4ea3;">"ct"</span>: 447,
|
||||||
|
<span style="color: #ff4ea3;">"transitiontime"</span>: 17400
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"3"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"bri"</span>: 254,
|
||||||
|
<span style="color: #ff4ea3;">"ct"</span>: 447,
|
||||||
|
<span style="color: #ff4ea3;">"transitiontime"</span>: 17400
|
||||||
|
},
|
||||||
|
<span style="color: #ff4ea3;">"5"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"bri"</span>: 254,
|
||||||
|
<span style="color: #ff4ea3;">"ct"</span>: 447,
|
||||||
|
<span style="color: #ff4ea3;">"transitiontime"</span>: 17400
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Finally, an additional rule takes care of turning the lights off and
|
||||||
|
the wake-up sensor at 9:00 (Two and a half hours after the initial
|
||||||
|
triggering of the sensor).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-http"><span style="color: #5fafd7;">GET</span> <span style="color: #ffd700;">http://bridge/api/${username}/rules/2</span>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="org-src-container">
|
||||||
|
<pre class="src src-js">{
|
||||||
|
<span style="color: #ff4ea3;">"name"</span>: <span style="color: #ff4ea3;">"Wake up 1.end"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"owner"</span>: <span style="color: #ff4ea3;">"oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"created"</span>: <span style="color: #ff4ea3;">"2018-03-11T19:46:51"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"lasttriggered"</span>: <span style="color: #ff4ea3;">"2018-03-13T13:00:00"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"timestriggered"</span>: 2,
|
||||||
|
<span style="color: #ff4ea3;">"status"</span>: <span style="color: #ff4ea3;">"enabled"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"recycle"</span>: <span style="color: #5fafd7;">true</span>,
|
||||||
|
<span style="color: #ff4ea3;">"conditions"</span>: [
|
||||||
|
{
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/sensors/2/state/flag"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"operator"</span>: <span style="color: #ff4ea3;">"eq"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"value"</span>: <span style="color: #ff4ea3;">"true"</span>
|
||||||
|
},
|
||||||
|
{
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/sensors/2/state/flag"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"operator"</span>: <span style="color: #ff4ea3;">"ddx"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"value"</span>: <span style="color: #ff4ea3;">"PT02:30:00"</span>
|
||||||
|
}
|
||||||
|
],
|
||||||
|
<span style="color: #ff4ea3;">"actions"</span>: [
|
||||||
|
{
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/groups/2/action"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"method"</span>: <span style="color: #ff4ea3;">"PUT"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"body"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"on"</span>: <span style="color: #5fafd7;">false</span>
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
<span style="color: #ff4ea3;">"address"</span>: <span style="color: #ff4ea3;">"/sensors/2/state"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"method"</span>: <span style="color: #ff4ea3;">"PUT"</span>,
|
||||||
|
<span style="color: #ff4ea3;">"body"</span>: {
|
||||||
|
<span style="color: #ff4ea3;">"flag"</span>: <span style="color: #5fafd7;">false</span>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
295
_drafts/2018-03-13-hue-wake-up.org
Normal file
295
_drafts/2018-03-13-hue-wake-up.org
Normal file
|
@ -0,0 +1,295 @@
|
||||||
|
#+TITLE: How Does The Phillips Hue Wake-Up Feature Work?
|
||||||
|
#+STARTUP: indent
|
||||||
|
#+OPTIONS: toc:nil num:nil
|
||||||
|
#+PROPERTY: header-args :cache yes :proxy socks5://localhost:1214 :resolve bridge:80:192.168.1.199 :var username="uCpPPhYlWIJdOvGuyrsM2EtmaeiVvcTX0WEdAn0P" :pretty :exports both :wrap SRC js
|
||||||
|
|
||||||
|
I recently got myself a set of Phillips Hue White and Color Ambiance
|
||||||
|
lights. One of the features I was looking forward to in particular
|
||||||
|
(besides playing with all the color options) was setting a wake-up
|
||||||
|
alarm with the lights gradually brightening. This was pretty painless
|
||||||
|
to get set up using the phone app. I'm pretty happy with the result,
|
||||||
|
but there's certainly some things I wouldn't mind tweaking. For
|
||||||
|
example, the initial brightness of the bulbs (at the lowest setting)
|
||||||
|
still seems a bit bright, so I might want to delay the bedside lamps
|
||||||
|
and let the more distant lamp start fading in first. I also want to
|
||||||
|
see if I can fiddle it into transitioning between some colors to get
|
||||||
|
more of a sunrise effect (perhaps "rising" from the other side of the
|
||||||
|
room, with the light spreading towards the head of the bed).
|
||||||
|
|
||||||
|
Figuring out how the wake-up settings that the app installed on my
|
||||||
|
bridge seemed a good first step towards introducing my own
|
||||||
|
customizations.
|
||||||
|
|
||||||
|
Information on getting access to a Hue bridge to make REST API calls
|
||||||
|
to it can be found in the [[https://www.developers.meethue.com/documentation/getting-started][Hue API getting started guide]].
|
||||||
|
|
||||||
|
* My Wake-Up Settings
|
||||||
|
My wake-up is scheduled for 7:00 to gradually brighten the lights with
|
||||||
|
a half-hour fade-in each weekday. I also toggled on the setting to
|
||||||
|
automatically turn the lights off at 9:00.
|
||||||
|
|
||||||
|
#+BEGIN_CENTER
|
||||||
|
[[img:Screenshot_20180313-131855.png]] [[img:Screenshot_20180313-131858.png]]
|
||||||
|
#+END_CENTER
|
||||||
|
|
||||||
|
Wake up is kicked off at 6:30 with a schedule:
|
||||||
|
|
||||||
|
#+BEGIN_SRC http
|
||||||
|
GET http://bridge/api/${username}/schedules/1
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS[721397e78d62134b1a3fc260f3432341328f522c]:
|
||||||
|
#+BEGIN_SRC js
|
||||||
|
{
|
||||||
|
"name": "Wake up",
|
||||||
|
"description": "L_04_fidlv_start wake up",
|
||||||
|
"command": {
|
||||||
|
"address": "/api/oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8/sensors/2/state",
|
||||||
|
"body": {
|
||||||
|
"flag": true
|
||||||
|
},
|
||||||
|
"method": "PUT"
|
||||||
|
},
|
||||||
|
"localtime": "W124/T06:30:00",
|
||||||
|
"time": "W124/T10:30:00",
|
||||||
|
"created": "2018-03-11T19:46:54",
|
||||||
|
"status": "enabled",
|
||||||
|
"recycle": true
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
This schedule triggers a sensor:
|
||||||
|
|
||||||
|
#+BEGIN_SRC http
|
||||||
|
GET http://bridge/api/${username}/sensors/2
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS[9ee80a27fcb69491429ac31c2263f0e3a9d670fc]:
|
||||||
|
#+BEGIN_SRC js
|
||||||
|
{
|
||||||
|
"state": {
|
||||||
|
"flag": false,
|
||||||
|
"lastupdated": "2018-03-13T13:00:00"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"on": true,
|
||||||
|
"reachable": true
|
||||||
|
},
|
||||||
|
"name": "Sensor for wakeup",
|
||||||
|
"type": "CLIPGenericFlag",
|
||||||
|
"modelid": "WAKEUP",
|
||||||
|
"manufacturername": "oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG",
|
||||||
|
"swversion": "A_1801260942",
|
||||||
|
"uniqueid": "L_04_fidlv",
|
||||||
|
"recycle": true
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
A rule is triggered by this sensor updating:
|
||||||
|
|
||||||
|
#+BEGIN_SRC http
|
||||||
|
GET http://bridge/api/${username}/rules/1
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS[9a4476721e61544936c6c613d4cb3520cfa99b61]:
|
||||||
|
#+BEGIN_SRC js
|
||||||
|
{
|
||||||
|
"name": "L_04_fidlv_Start",
|
||||||
|
"owner": "oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8",
|
||||||
|
"created": "2018-03-11T19:46:51",
|
||||||
|
"lasttriggered": "2018-03-13T10:30:00",
|
||||||
|
"timestriggered": 2,
|
||||||
|
"status": "enabled",
|
||||||
|
"recycle": true,
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"address": "/sensors/2/state/flag",
|
||||||
|
"operator": "eq",
|
||||||
|
"value": "true"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"address": "/groups/1/action",
|
||||||
|
"method": "PUT",
|
||||||
|
"body": {
|
||||||
|
"scene": "7GJer2-5ahGIqz6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": "/schedules/2",
|
||||||
|
"method": "PUT",
|
||||||
|
"body": {
|
||||||
|
"status": "enabled"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
The bedroom group is set to the following scene, which turns on the
|
||||||
|
lights at minimum brightness:
|
||||||
|
|
||||||
|
#+BEGIN_SRC http
|
||||||
|
GET http://bridge/api/${username}/scenes/7GJer2-5ahGIqz6
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS[bc401edc5343c578204809ec1c80c4ea33747537]:
|
||||||
|
#+BEGIN_SRC js
|
||||||
|
{
|
||||||
|
"name": "Wake Up init",
|
||||||
|
"lights": [
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"5"
|
||||||
|
],
|
||||||
|
"owner": "oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8",
|
||||||
|
"recycle": true,
|
||||||
|
"locked": true,
|
||||||
|
"appdata": {},
|
||||||
|
"picture": "",
|
||||||
|
"lastupdated": "2018-03-11T19:46:50",
|
||||||
|
"version": 2,
|
||||||
|
"lightstates": {
|
||||||
|
"2": {
|
||||||
|
"on": true,
|
||||||
|
"bri": 1,
|
||||||
|
"ct": 447
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"on": true,
|
||||||
|
"bri": 1,
|
||||||
|
"ct": 447
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"on": true,
|
||||||
|
"bri": 1,
|
||||||
|
"ct": 447
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Another schedule is enabled by the rule, which fires one minute after
|
||||||
|
its creation:
|
||||||
|
|
||||||
|
#+BEGIN_SRC http
|
||||||
|
GET http://bridge/api/${username}/schedules/2
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS[e77df321ae45bf4714293b29f3893dc4c9f60317]:
|
||||||
|
#+BEGIN_SRC js
|
||||||
|
{
|
||||||
|
"name": "L_04_fidlv",
|
||||||
|
"description": "L_04_fidlv_trigger end scene",
|
||||||
|
"command": {
|
||||||
|
"address": "/api/oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8/groups/0/action",
|
||||||
|
"body": {
|
||||||
|
"scene": "gXdkB1um68N1sZL"
|
||||||
|
},
|
||||||
|
"method": "PUT"
|
||||||
|
},
|
||||||
|
"localtime": "PT00:01:00",
|
||||||
|
"time": "PT00:01:00",
|
||||||
|
"created": "2018-03-11T19:46:51",
|
||||||
|
"status": "disabled",
|
||||||
|
"autodelete": false,
|
||||||
|
"starttime": "2018-03-13T10:30:00",
|
||||||
|
"recycle": true
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
That schedule sets another scene, which transitions the lights to full
|
||||||
|
brightness over the next 29 minutes (1740 seconds).
|
||||||
|
|
||||||
|
#+BEGIN_SRC http
|
||||||
|
GET http://bridge/api/${username}/scenes/gXdkB1um68N1sZL
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS[d6f7a20f0126174d51c97ce6750d55db6f272c18]:
|
||||||
|
#+BEGIN_SRC js
|
||||||
|
{
|
||||||
|
"name": "Wake Up end",
|
||||||
|
"lights": [
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"5"
|
||||||
|
],
|
||||||
|
"owner": "oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8",
|
||||||
|
"recycle": true,
|
||||||
|
"locked": true,
|
||||||
|
"appdata": {},
|
||||||
|
"picture": "",
|
||||||
|
"lastupdated": "2018-03-11T19:46:51",
|
||||||
|
"version": 2,
|
||||||
|
"lightstates": {
|
||||||
|
"2": {
|
||||||
|
"on": true,
|
||||||
|
"bri": 254,
|
||||||
|
"ct": 447,
|
||||||
|
"transitiontime": 17400
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"on": true,
|
||||||
|
"bri": 254,
|
||||||
|
"ct": 447,
|
||||||
|
"transitiontime": 17400
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"on": true,
|
||||||
|
"bri": 254,
|
||||||
|
"ct": 447,
|
||||||
|
"transitiontime": 17400
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Finally, an additional rule takes care of turning the lights off and
|
||||||
|
the wake-up sensor at 9:00 (Two and a half hours after the initial
|
||||||
|
triggering of the sensor).
|
||||||
|
|
||||||
|
#+BEGIN_SRC http
|
||||||
|
GET http://bridge/api/${username}/rules/2
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+RESULTS[ee4cd6526272ed2dffa60219ce11199b30165fe7]:
|
||||||
|
#+BEGIN_SRC js
|
||||||
|
{
|
||||||
|
"name": "Wake up 1.end",
|
||||||
|
"owner": "oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8",
|
||||||
|
"created": "2018-03-11T19:46:51",
|
||||||
|
"lasttriggered": "2018-03-13T13:00:00",
|
||||||
|
"timestriggered": 2,
|
||||||
|
"status": "enabled",
|
||||||
|
"recycle": true,
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"address": "/sensors/2/state/flag",
|
||||||
|
"operator": "eq",
|
||||||
|
"value": "true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": "/sensors/2/state/flag",
|
||||||
|
"operator": "ddx",
|
||||||
|
"value": "PT02:30:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"address": "/groups/2/action",
|
||||||
|
"method": "PUT",
|
||||||
|
"body": {
|
||||||
|
"on": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": "/sensors/2/state",
|
||||||
|
"method": "PUT",
|
||||||
|
"body": {
|
||||||
|
"flag": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
#+END_SRC
|
BIN
images/Screenshot_20180313-131855.png
Normal file
BIN
images/Screenshot_20180313-131855.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
BIN
images/Screenshot_20180313-131858.png
Normal file
BIN
images/Screenshot_20180313-131858.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
Loading…
Reference in a new issue