mirror of
https://github.com/correl/correl.github.io.git
synced 2024-12-27 11:07:35 +00:00
[draft] finish hue wake-up
This commit is contained in:
parent
d461fd3ac9
commit
96e5b494fa
6 changed files with 57 additions and 57 deletions
|
@ -28,9 +28,9 @@ 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-org00a0920" class="outline-2">
|
||||
<h2 id="org00a0920">My wake-up settings</h2>
|
||||
<div class="outline-text-2" id="text-org00a0920">
|
||||
<div id="outline-container-orgcb557c8" class="outline-2">
|
||||
<h2 id="orgcb557c8">My wake-up settings</h2>
|
||||
<div class="outline-text-2" id="text-orgcb557c8">
|
||||
<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
|
||||
|
@ -39,24 +39,24 @@ automatically turn the lights off at 9:00.
|
|||
|
||||
<div class="org-center">
|
||||
<p>
|
||||
<img src="/images/Screenshot_20180313-131855.png" alt="nil"/> <img src="/images/Screenshot_20180313-131858.png" alt="nil"/>
|
||||
<img src="/images/Screenshot_20180313-182434.png" alt="nil"/> <img src="/images/Screenshot_20180313-182438.png" alt="nil"/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgc0f4909" class="outline-2">
|
||||
<h2 id="orgc0f4909">Finding things on the bridge</h2>
|
||||
<div class="outline-text-2" id="text-orgc0f4909">
|
||||
<div id="outline-container-orgb533fb6" class="outline-2">
|
||||
<h2 id="orgb533fb6">Finding things on the bridge</h2>
|
||||
<div class="outline-text-2" id="text-orgb533fb6">
|
||||
<p>
|
||||
The most natural starting point is to check the schedules. Right off
|
||||
the bat, I find what I'm after:
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8cf23dd" class="outline-3">
|
||||
<h3 id="org8cf23dd">The schedule</h3>
|
||||
<div class="outline-text-3" id="text-org8cf23dd">
|
||||
<div id="outline-container-org0792257" class="outline-3">
|
||||
<h3 id="org0792257">The schedule …</h3>
|
||||
<div class="outline-text-3" id="text-org0792257">
|
||||
<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>
|
||||
|
@ -67,7 +67,7 @@ the bat, I find what I'm after:
|
|||
<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;">"address"</span>: <span style="color: #ff4ea3;">"/api/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/sensors/2/state"</span>,
|
||||
<span style="color: #ff4ea3;">"body"</span>: {
|
||||
<span style="color: #ff4ea3;">"flag"</span>: <span style="color: #5fafd7;">true</span>
|
||||
},
|
||||
|
@ -114,9 +114,9 @@ flag to true.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orga693028" class="outline-3">
|
||||
<h3 id="orga693028">… triggers the sensor</h3>
|
||||
<div class="outline-text-3" id="text-orga693028">
|
||||
<div id="outline-container-orgc27ffad" class="outline-3">
|
||||
<h3 id="orgc27ffad">… triggers the sensor …</h3>
|
||||
<div class="outline-text-3" id="text-orgc27ffad">
|
||||
<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>
|
||||
|
@ -135,7 +135,7 @@ flag to true.
|
|||
<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;">"manufacturername"</span>: <span style="color: #ff4ea3;">"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</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>
|
||||
|
@ -152,9 +152,9 @@ sensor.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org826fcd2" class="outline-3">
|
||||
<h3 id="org826fcd2">… triggers a rule</h3>
|
||||
<div class="outline-text-3" id="text-org826fcd2">
|
||||
<div id="outline-container-org44bbaad" class="outline-3">
|
||||
<h3 id="org44bbaad">… triggers a rule …</h3>
|
||||
<div class="outline-text-3" id="text-org44bbaad">
|
||||
<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>
|
||||
|
@ -163,7 +163,7 @@ sensor.
|
|||
<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;">"owner"</span>: <span style="color: #ff4ea3;">"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</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,
|
||||
|
@ -206,9 +206,9 @@ each of the actions.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd3092c6" class="outline-3">
|
||||
<h3 id="orgd3092c6">… which sets the scene</h3>
|
||||
<div class="outline-text-3" id="text-orgd3092c6">
|
||||
<div id="outline-container-orgb90f963" class="outline-3">
|
||||
<h3 id="orgb90f963">… which sets the scene …</h3>
|
||||
<div class="outline-text-3" id="text-orgb90f963">
|
||||
<p>
|
||||
The bedroom group (<code>/groups/1</code> in the rule's action list) is set to
|
||||
the following scene, which turns on the lights at minimum brightness:
|
||||
|
@ -227,7 +227,7 @@ the following scene, which turns on the lights at minimum brightness:
|
|||
<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;">"owner"</span>: <span style="color: #ff4ea3;">"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</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>: {},
|
||||
|
@ -257,9 +257,9 @@ the following scene, which turns on the lights at minimum brightness:
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf293374" class="outline-3">
|
||||
<h3 id="orgf293374">… and schedules the transition</h3>
|
||||
<div class="outline-text-3" id="text-orgf293374">
|
||||
<div id="outline-container-org5ae0873" class="outline-3">
|
||||
<h3 id="org5ae0873">… and schedules the transition …</h3>
|
||||
<div class="outline-text-3" id="text-org5ae0873">
|
||||
<p>
|
||||
Another schedule (<code>/schedules/2</code> in the rule's action list) is enabled
|
||||
by the rule.
|
||||
|
@ -275,7 +275,7 @@ by the rule.
|
|||
<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;">"address"</span>: <span style="color: #ff4ea3;">"/api/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/groups/0/action"</span>,
|
||||
<span style="color: #ff4ea3;">"body"</span>: {
|
||||
<span style="color: #ff4ea3;">"scene"</span>: <span style="color: #ff4ea3;">"gXdkB1um68N1sZL"</span>
|
||||
},
|
||||
|
@ -310,9 +310,9 @@ applies, there's no real problem with it.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4ad1a9b" class="outline-3">
|
||||
<h3 id="org4ad1a9b">… to a fully lit room</h3>
|
||||
<div class="outline-text-3" id="text-org4ad1a9b">
|
||||
<div id="outline-container-org2ead4a1" class="outline-3">
|
||||
<h3 id="org2ead4a1">… to a fully lit room …</h3>
|
||||
<div class="outline-text-3" id="text-org2ead4a1">
|
||||
<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>
|
||||
|
@ -326,7 +326,7 @@ applies, there's no real problem with it.
|
|||
<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;">"owner"</span>: <span style="color: #ff4ea3;">"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</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>: {},
|
||||
|
@ -365,9 +365,9 @@ specified in deciseconds).
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgbdc2c15" class="outline-3">
|
||||
<h3 id="orgbdc2c15">… which will be switched off later.</h3>
|
||||
<div class="outline-text-3" id="text-orgbdc2c15">
|
||||
<div id="outline-container-orgb5c1bbc" class="outline-3">
|
||||
<h3 id="orgb5c1bbc">… which will be switched off later.</h3>
|
||||
<div class="outline-text-3" id="text-orgb5c1bbc">
|
||||
<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
|
||||
|
@ -382,7 +382,7 @@ triggering of the sensor).
|
|||
<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;">"owner"</span>: <span style="color: #ff4ea3;">"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"</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,
|
||||
|
@ -432,9 +432,9 @@ the bedroom, and set the sensor's flag to <code>false</code>.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8708191" class="outline-2">
|
||||
<h2 id="org8708191">Where to go from here</h2>
|
||||
<div class="outline-text-2" id="text-org8708191">
|
||||
<div id="outline-container-org37adedd" class="outline-2">
|
||||
<h2 id="org37adedd">Where to go from here</h2>
|
||||
<div class="outline-text-2" id="text-org37adedd">
|
||||
<p>
|
||||
The wake-up config in the phone app touched on pretty much every major
|
||||
aspect of the Hue bridge API. Given the insight I now have into how it
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#+TITLE: How Does The Phillips Hue Wake-Up Feature Work?
|
||||
#+STARTUP: indent
|
||||
#+OPTIONS: toc:nil num:nil
|
||||
#+PROPERTY: header-args :cache yes
|
||||
#+PROPERTY: header-args:http :post anonymize(json=*this*) :proxy socks5://localhost:1214 :resolve bridge:80:192.168.1.199 :var username="uCpPPhYlWIJdOvGuyrsM2EtmaeiVvcTX0WEdAn0P" :pretty :exports both :wrap SRC js
|
||||
#+PROPERTY: header-args :cache yes :eval never-export
|
||||
#+PROPERTY: header-args:http :post anonymize(json=*this*) :resolve bridge:80:192.168.1.199 :var username="uCpPPhYlWIJdOvGuyrsM2EtmaeiVvcTX0WEdAn0P" :pretty :exports both :wrap SRC js
|
||||
|
||||
#+name: anonymize
|
||||
#+BEGIN_SRC emacs-lisp :var json="" :exports none :results silent
|
||||
|
@ -41,7 +41,7 @@ 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]]
|
||||
[[img:Screenshot_20180313-182434.png]] [[img:Screenshot_20180313-182438.png]]
|
||||
#+END_CENTER
|
||||
|
||||
* Finding things on the bridge
|
||||
|
@ -49,14 +49,14 @@ automatically turn the lights off at 9:00.
|
|||
The most natural starting point is to check the schedules. Right off
|
||||
the bat, I find what I'm after:
|
||||
|
||||
** The schedule
|
||||
** The schedule ...
|
||||
|
||||
#+BEGIN_SRC http
|
||||
GET http://bridge/api/${username}/schedules/1
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[d969a24ceb98afc9fdf55b6fe0e69bf8e9841a7b]:
|
||||
#+begin_example
|
||||
#+RESULTS[185c8bd9c6da61034cb699944dfb1827d2d08282]:
|
||||
#+BEGIN_SRC js
|
||||
{
|
||||
"name": "Wake up",
|
||||
"description": "L_04_fidlv_start wake up",
|
||||
|
@ -73,7 +73,7 @@ the bat, I find what I'm after:
|
|||
"status": "enabled",
|
||||
"recycle": true
|
||||
}
|
||||
#+end_example
|
||||
#+END_SRC
|
||||
|
||||
This is a recurring schedule item that runs every weekday at 6:30. We
|
||||
can tell this by looking at the =localtime= field. From the
|
||||
|
@ -88,13 +88,13 @@ Since this schedule is enabled, we can be assured that it will run,
|
|||
and in doing so, will issue a =PUT= to a sensors endpoint, setting a
|
||||
flag to true.
|
||||
|
||||
** ... triggers the sensor
|
||||
** ... triggers the sensor ...
|
||||
|
||||
#+BEGIN_SRC http
|
||||
GET http://bridge/api/${username}/sensors/2
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[f4396e8f480506f7dd144f7819d649dc4b462e57]:
|
||||
#+RESULTS[6660e5539302c8863c2d7cd9417e3996c35b2b87]:
|
||||
#+BEGIN_SRC js
|
||||
{
|
||||
"state": {
|
||||
|
@ -120,13 +120,13 @@ a [[https://www.developers.meethue.com/documentation/supported-sensors#clipSenso
|
|||
schedule. Essentially, by updating the flag state, we trigger the
|
||||
sensor.
|
||||
|
||||
** ... triggers a rule
|
||||
** ... triggers a rule ...
|
||||
|
||||
#+BEGIN_SRC http
|
||||
GET http://bridge/api/${username}/rules/1
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[9a4476721e61544936c6c613d4cb3520cfa99b61]:
|
||||
#+RESULTS[449d90a31c32d4630701c75e4655ccb6378d8655]:
|
||||
#+BEGIN_SRC js
|
||||
{
|
||||
"name": "L_04_fidlv_Start",
|
||||
|
@ -168,7 +168,7 @@ to =true=. When that happens, the bridge will iterate through its
|
|||
rules, find that the above condition has been met, and iterate through
|
||||
each of the actions.
|
||||
|
||||
** ... which sets the scene
|
||||
** ... which sets the scene ...
|
||||
|
||||
The bedroom group (=/groups/1= in the rule's action list) is set to
|
||||
the following scene, which turns on the lights at minimum brightness:
|
||||
|
@ -177,7 +177,7 @@ the following scene, which turns on the lights at minimum brightness:
|
|||
GET http://bridge/api/${username}/scenes/7GJer2-5ahGIqz6
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[bc401edc5343c578204809ec1c80c4ea33747537]:
|
||||
#+RESULTS[acf0f0fd18efd18cdf94d2c1175f148f9cd85733]:
|
||||
#+BEGIN_SRC js
|
||||
{
|
||||
"name": "Wake Up init",
|
||||
|
@ -213,7 +213,7 @@ the following scene, which turns on the lights at minimum brightness:
|
|||
}
|
||||
#+END_SRC
|
||||
|
||||
** ... and schedules the transition
|
||||
** ... and schedules the transition ...
|
||||
Another schedule (=/schedules/2= in the rule's action list) is enabled
|
||||
by the rule.
|
||||
|
||||
|
@ -221,13 +221,13 @@ by the rule.
|
|||
GET http://bridge/api/${username}/schedules/2
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[e77df321ae45bf4714293b29f3893dc4c9f60317]:
|
||||
#+RESULTS[b408558373a001cc2354c960171b21df2669ab85]:
|
||||
#+BEGIN_SRC js
|
||||
{
|
||||
"name": "L_04_fidlv",
|
||||
"description": "L_04_fidlv_trigger end scene",
|
||||
"command": {
|
||||
"address": "/api/oV5vUaXuBwEAA6sjnvqr8n6fBLlzWLjG4x4SIyD8/groups/0/action",
|
||||
"address": "/api/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/groups/0/action",
|
||||
"body": {
|
||||
"scene": "gXdkB1um68N1sZL"
|
||||
},
|
||||
|
@ -255,13 +255,13 @@ This one, strangely, is applied to group =0=, the meta-group including
|
|||
all lights, but since the scene itself specifies to which lights it
|
||||
applies, there's no real problem with it.
|
||||
|
||||
** ... to a fully lit room
|
||||
** ... to a fully lit room ...
|
||||
|
||||
#+BEGIN_SRC http
|
||||
GET http://bridge/api/${username}/scenes/gXdkB1um68N1sZL
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[aebfa5482ad6b3a13ccdfc1135c028f97bfcb965]:
|
||||
#+RESULTS[d73d2de48bbff9ac73185999ff3671ddf159dc0d]:
|
||||
#+BEGIN_SRC js
|
||||
{
|
||||
"name": "Wake Up end",
|
||||
|
@ -313,7 +313,7 @@ triggering of the sensor).
|
|||
GET http://bridge/api/${username}/rules/2
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[42d351c0d43cbf15dec13438ff53997cab22d177]:
|
||||
#+RESULTS[68cbdf0c611d00ec6d86daa820d2dbe672f1d452]:
|
||||
#+BEGIN_SRC js
|
||||
{
|
||||
"name": "Wake up 1.end",
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 41 KiB |
Binary file not shown.
Before Width: | Height: | Size: 40 KiB |
BIN
images/Screenshot_20180313-182434.png
Normal file
BIN
images/Screenshot_20180313-182434.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
BIN
images/Screenshot_20180313-182438.png
Normal file
BIN
images/Screenshot_20180313-182438.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
Loading…
Reference in a new issue