<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="/feeds.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://chameth.com/">
    <title>Chameth.com - posts like g15-ram-upgrade, reverse-engineering-arctis-pro-wireless-headset, travel-toolkit but not debugging-beyond-the-debugger</title>
    <subtitle>Personal homepage of Chris Smith</subtitle>
    <link href="https://chameth.com/feeds/posts/like/g15-ram-upgrade,reverse-engineering-arctis-pro-wireless-headset,travel-toolkit/unlike/debugging-beyond-the-debugger/" rel="self"/>
    <link href="https://chameth.com/"/>
    <icon>https://chameth.com/favicon.png</icon>
    <updated>2025-01-02T00:00:00Z</updated>
    <id>https://chameth.com/</id>
    <author>
        <name>Chris Smith</name>
    </author>
    <entry>
        <title>Building a travel toolkit</title>
        <link href="https://chameth.com/travel-toolkit/"/>
        <updated>2025-01-02T00:00:00Z</updated>
        <id>https://chameth.com/travel-toolkit/</id>
        <content xml:lang="en" type="html">&lt;figure class=&#34;image left&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/travel-toolkit/bag.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/travel-toolkit/bag.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/travel-toolkit/bag.png&#34; alt=&#34;UGREEN Travel Accessories Bag&#34; loading=&#34;lazy&#34; width=&#34;365&#34; height=&#34;578&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;The container for my toolkit, a UGREEN “travel accessories” bag&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;For a while now, whenever I’ve traveled anywhere I’ve dumped a selection of tools
into my backpack just in case I need them. Originally this was mostly focused
around being able to open and fix my laptop if anything went wrong, but
over time has slowly expanded to include other useful tools.&lt;/p&gt;
&lt;p&gt;Repeatedly packing these tools and then returning them to where they belonged
was tedious, though. I couldn’t just leave them in the backpack as I often
needed them for non-travelling purposes, and I didn’t want to just buy duplicate
tools that spent most of their life a few meters away from each other, so I
ignored the problem and just dealt with the tedium.&lt;/p&gt;
&lt;p&gt;Eventually I acquired enough tools that — while not quite duplicates — I
wouldn’t miss often if they were kept in the backpack. Building on these I’ve
created a little travel toolkit that contains everything I might want (and
more) while away.&lt;/p&gt;
&lt;h3 id=&#34;the-base&#34;&gt;The base&lt;/h3&gt;
&lt;p&gt;The biggest challenge I had before was finding a screwdriver set. I have an
&lt;a href=&#34;https://www.ifixit.com/products/mako-driver-kit-64-precision-bits&#34;&gt;iFixit Mako&lt;/a&gt;
set that did the in-and-out-of-the-bag routine for several years. Nothing else
covered the range of drivers I wanted for generic electronic tinkering and
more chunky work. I finally found one in the form of a
&lt;a href=&#34;https://toolrebels.de/en/products/wera-tool-rebel-tool-check-plus-tr-edition&#34;&gt;Wera Tool-Check PLUS TR-Edition&lt;/a&gt;.
“TR” stands for “Tool Rebel” and is Wera’s “fan club” brand. Its signature
features over the normal Tool-Check PLUS are a fancy fabric case and a 152mm
bit extender; but it also comes with a much different set of bits, which is
why I picked it up.&lt;/p&gt;
&lt;!--more--&gt;
&lt;p&gt;Here’s a comparison&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Standard version&lt;/th&gt;
&lt;th&gt;Tool Rebel edition&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Phillips&lt;/td&gt;
&lt;td&gt;2x PH1&lt;br/&gt;3x PH2&lt;br/&gt;1x PH3&lt;/td&gt;
&lt;td&gt;1x PH00&lt;br/&gt;1x PH0&lt;br/&gt;1x PH1&lt;br/&gt;1x PH2&lt;br/&gt;1x PH3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pozidrive&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;1x PZ1&lt;br/&gt;3x PZ2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slotted&lt;/td&gt;
&lt;td&gt;1x 5.5mm&lt;/td&gt;
&lt;td&gt;1x 4mm&lt;br/&gt;1x 4.5mm&lt;br/&gt;2x 5.5mm&lt;br/&gt;1x 6.5mm&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Torx&lt;/td&gt;
&lt;td&gt;1x T10&lt;br/&gt;1x T15&lt;br/&gt;1x T20&lt;br/&gt;1x T25&lt;br/&gt;1x T30&lt;br/&gt;1x T40&lt;/td&gt;
&lt;td&gt;1x T10&lt;br/&gt;1x T15&lt;br/&gt;1x T20&lt;br/&gt;1x T25&lt;br/&gt;1x T30&lt;br/&gt;1x T40&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security Torx&lt;/td&gt;
&lt;td&gt;1x T10&lt;br/&gt;1x T15&lt;br/&gt;1x T20&lt;br/&gt;1x T25&lt;br/&gt;1x T30&lt;/td&gt;
&lt;td&gt;1x T25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hex&lt;/td&gt;
&lt;td&gt;1x H3&lt;br/&gt;1x H4&lt;br/&gt;1x H5&lt;br/&gt;1x H6&lt;br/&gt;1x H8&lt;/td&gt;
&lt;td&gt;1x H1.5&lt;br/&gt;1x H2&lt;br/&gt;1x H2.5&lt;br/&gt;1x H3&lt;br/&gt;1x H4&lt;br/&gt;1x H6&lt;br/&gt;1x H8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;There are only five bits present in the standard version that are missing in
the TR edition: 5mm hex (pretty uncommon) and four sizes of security torx (rare).
In exchange for those and the removal of a bunch of duplicates, you get two extra
phillips sizes (0 and 00, both very useful for electronics and spectacles),
some pozidrive bits (extremely common on random hardware/furniture/etc),
smaller hex bits (for electronics, 3D printers, and so on), and a few other
bits and pieces.&lt;/p&gt;
&lt;p&gt;Overall it’s a vastly superior selection for my needs. And while it doesn’t have
the full range of bits provided by the iFixit kit, it does cover almost
everything I’m ever actually likely to need while travelling, and it’s probably
around a third of the size.&lt;/p&gt;
&lt;p&gt;The other core part of the toolkit is the bag. I had a UGREEN “travel accessory”
bag hanging around unused, and noticed it was almost the exact right size for
the Tool-Check. Now, how many other tools could I stuff in there?&lt;/p&gt;
&lt;h3 id=&#34;all-the-tools&#34;&gt;All the tools&lt;/h3&gt;
&lt;figure class=&#34;image full&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/travel-toolkit/contents.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/travel-toolkit/contents.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/travel-toolkit/contents.jpg&#34; alt=&#34;The contents of my toolkit, spread out on a mat&#34; loading=&#34;lazy&#34; width=&#34;1024&#34; height=&#34;912&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;The array of tools that make up the travel toolkit&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The kit can be broken down into a few sections:&lt;/p&gt;
&lt;h4 id=&#34;screwdriving&#34;&gt;Screwdriving&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;The aforementioned Wera Tool-Check&lt;/li&gt;
&lt;li&gt;Its 152mm bit extender&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’ve talked enough about this already, I think, so I’ll spare you any additional
commentary on screwdrivers and bits.&lt;/p&gt;
&lt;h4 id=&#34;splitting-gripping-and-cutting&#34;&gt;Splitting, gripping and cutting&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Engineer tweezers&lt;/li&gt;
&lt;li&gt;Engineer mini snips&lt;/li&gt;
&lt;li&gt;Engineer mini screw removal pliers&lt;/li&gt;
&lt;li&gt;Knipex mini waterpump pliers&lt;/li&gt;
&lt;li&gt;Two iFixit spudgers (one metal, one plastic)&lt;/li&gt;
&lt;li&gt;iFixit jimmy&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I have bigger or slightly different versions of these that stay in my normal
toolkit. The tweezers and snips are useful in a variety of situations,
and the spudgers are handy for getting inside laptops and other devices. The
pliers are less useful, but they’re one of those things where when you &lt;em&gt;do&lt;/em&gt;
need them there aren’t any good alternatives.&lt;/p&gt;
&lt;h4 id=&#34;sewing&#34;&gt;Sewing&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Two needles&lt;/li&gt;
&lt;li&gt;Some black thread&lt;/li&gt;
&lt;li&gt;Set of mini clips&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You never know when you’re going to rip a seam in something. I find the clips a
lot less fiddly than using pins for keeping material in place when I’m trying to
sew.&lt;/p&gt;
&lt;h4 id=&#34;computering&#34;&gt;Computering&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Retractable ethernet cable&lt;/li&gt;
&lt;li&gt;RJ45 coupler&lt;/li&gt;
&lt;li&gt;USB-C to RJ45 adapter&lt;/li&gt;
&lt;li&gt;Dual USB-A and USB-C thumb drive, with an Arch ISO on it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sometimes Wi-Fi just doesn’t cut it, or you need to fiddle with a router that
doesn’t expose its admin UI over Wi-Fi. The USB-C adapter is for use with my
phone, as it’s often easier to move that get the laptop where it needs to be.&lt;/p&gt;
&lt;p&gt;I can boot from the thumb drive into an Arch environment, and from there
reinstall my laptop from scratch if needed. There’s enough space left over so
it can be used to transfer files as well.&lt;/p&gt;
&lt;h4 id=&#34;miscellaneousing&#34;&gt;Miscellaneousing&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Fabric tape measure&lt;/li&gt;
&lt;li&gt;Spirit level&lt;/li&gt;
&lt;li&gt;Sharpie&lt;/li&gt;
&lt;li&gt;Superglue&lt;/li&gt;
&lt;li&gt;Spare batteries: 2 CR2032s, 2 AA, 2 AAA&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I’m almost certain I won’t use the spirit level, but it’s tiny and I had a spare
so it went in. Everything else is just in the “generally handy to have”
category.&lt;/p&gt;
&lt;h3 id=&#34;putting-it-all-together&#34;&gt;Putting it all together&lt;/h3&gt;
&lt;figure class=&#34;image right&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/travel-toolkit/complete.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/travel-toolkit/complete.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/travel-toolkit/complete.png&#34; alt=&#34;The complete toolkit&#34; loading=&#34;lazy&#34; width=&#34;500&#34; height=&#34;506&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;The nicely-organised side of the toolkit&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The Tool-Check PLUS fits almost perfectly into one side of the UGREEN bag,
leaving a little wiggle room along the side for the longer parts like spudgers.
The middle pockets can’t fit much in, but keep the batteries and sewing bits
out of the way. Everything else is in a big zip-up compartment in the other
side, which is slightly messy but still easy enough to dig through to find
whatever I need.&lt;/p&gt;
&lt;p&gt;The complete kit weighs in at around 1.2KG, so it’s not exactly lightweight,
but it goes in a bag with a heavy laptop and all of its peripherals so it’s
not as noticeable as it might otherwise be.&lt;/p&gt;
&lt;p&gt;It remains to be seen how much use I’ll actually get out of any of this. Maybe
I’ll put a bit of paper in so that I can track how often I use each tool…&lt;/p&gt;
</content>
    </entry>
    <entry>
        <title>Upgrading the RAM in a Dell G15 laptop</title>
        <link href="https://chameth.com/g15-ram-upgrade/"/>
        <updated>2023-07-29T00:00:00Z</updated>
        <id>https://chameth.com/g15-ram-upgrade/</id>
        <content xml:lang="en" type="html">&lt;figure class=&#34;image left&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/g15-ram-upgrade/g15.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/g15-ram-upgrade/g15.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/g15-ram-upgrade/g15.png&#34; alt=&#34;An open Dell G15 laptop&#34; loading=&#34;lazy&#34; width=&#34;580&#34; height=&#34;402&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;The Dell G15&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;I currently use a Dell G15 laptop for work. It has served me well for a little
over a year, but recently it has been struggling a little with my day-to-day
workload. It came with 32GB of RAM — the highest possible specification at the
time&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a class=&#34;footnote-ref&#34; href=&#34;#fn:1&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; — but that is apparently no longer enough for me.&lt;/p&gt;
&lt;p&gt;For a recent project, I was working on a Rust library used in an Android app.
That meant running the usual glut of Android tools (Android Studio, an emulator
and at least one Gradle daemon) alongside a normal IDE (IntelliJ IDEA). Throw
in a web browser and a couple of electron apps, and I often managed to
use all 32GB.&lt;/p&gt;
&lt;p&gt;When you start swapping memory out to an encrypted disk — even an SSD — it
doesn’t make for great performance. At first, I tried to work around this
by enabling the Linux out-of-memory (OOM) killer, but it turns out that it’s not
too good with Electron apps: it will kill the large browser process, but then
the small Electron wrapper will just respawn it.&lt;/p&gt;
&lt;!--more--&gt;
&lt;h3 id=&#34;can-it-be-upgraded-or-not&#34;&gt;Can it be upgraded or not?&lt;/h3&gt;
&lt;p&gt;The obvious solution to not having enough RAM is to add more RAM. A quick look
in the manual showed this might not be possible, though. The manual includes
the following “Memory specifications” table:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Values&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Memory slots&lt;/td&gt;
&lt;td&gt;Two SODIMM slots&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory type&lt;/td&gt;
&lt;td&gt;DDR5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory speed&lt;/td&gt;
&lt;td&gt;4800&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maximum memory configuration&lt;/td&gt;
&lt;td&gt;32GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Minimum memory configuration&lt;/td&gt;
&lt;td&gt;8GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory size per slot&lt;/td&gt;
&lt;td&gt;8GB or 16GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory configurations supported&lt;/td&gt;
&lt;td&gt;&lt;ul&gt;&lt;li&gt;8 GB, 1 x 8 GB, DDR5, 4800 MHz&lt;/li&gt;&lt;li&gt;16 GB, 1 x 16 GB, DDR5, 4800 MHz&lt;/li&gt;&lt;li&gt;16 GB, 2 x 8 GB, DDR5, 4800 MHz, dual-channel&lt;/li&gt;&lt;li&gt;32 GB, 2 x 16 GB, DDR5, 4800 MHz, dual-channel&lt;/li&gt;&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;That unambiguously says that an upgrade from 32GB is not possible. I gave up.&lt;/p&gt;
&lt;p&gt;Later though, I was complaining about memory issues to a friend, and he pointed
out a Dell forum thread where a couple of people claim to have successfully
installed dual-channel 32GB modules. Since the alternative was getting an
entire new PC after only a year, I decided to give it a go.&lt;/p&gt;
&lt;h3 id=&#34;the-upgrade-attempt&#34;&gt;The upgrade attempt&lt;/h3&gt;
&lt;p&gt;I ordered a pair of Crucial 32GB DDR5-4800 SODIMMs, and after they turned up
dismantled the laptop. The G15 comes apart pretty normally: there are uncovered
screws on the bottom holding the lower part of the case on. With those
removed and some gentle prying, it pops off, and you get access to the battery,
GPU and motherboard.&lt;/p&gt;
&lt;p&gt;The first thing I saw was this:&lt;/p&gt;
&lt;figure class=&#34;image full&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/g15-ram-upgrade/motherboard.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/g15-ram-upgrade/motherboard.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/g15-ram-upgrade/motherboard.jpg&#34; alt=&#34;The G15 motherboard, with a large &amp;#34;DDR5 8G/16G Only&amp;#34; label, and a smaller &amp;#34;DIMM B DDR5 8G/16G&amp;#34; label next to a SODIMM slot&#34; loading=&#34;lazy&#34; width=&#34;1536&#34; height=&#34;1300&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;The G15 motherboard adamantly proclaiming that it doesn’t want 32GB SODIMMs&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Not one but two labels that indicate it will only accept 8GB or 16GB modules.
Oh well, what’s the worst that can happen?&lt;/p&gt;
&lt;h3 id=&#34;oops&#34;&gt;Oops?&lt;/h3&gt;
&lt;p&gt;I dutifully installed the new modules, reconnected the battery and put the
case back together. I pressed the power button, and… nothing. None of the
usual garish lights that immediately come on, no screen output, just a dead
laptop. After reading some more of the user manual, I found that there is a tiny
status LED on the side next to the ethernet port. Forcing the laptop to power
off and back on again, the status LED blinked a distress code at me: 2 amber
blinks, 4 white blinks. The manual says that is — unsurprisingly — a memory
fault.&lt;/p&gt;
&lt;p&gt;I figured at this point that the manual and labels on the motherboard were
probably right. I took the laptop apart again, reinstalled the original 2x16GB
modules, reassembled it, and pressed the power button. It didn’t boot. I don’t
spend a lot of time fiddling inside computers, but I’ve done it enough that
I’m reasonably confident I can’t entirely break a computer while swapping some
RAM modules. I took to Googling&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a class=&#34;footnote-ref&#34; href=&#34;#fn:2&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;, and found an interesting article that said
Dell laptops don’t like to boot after RAM changes unless you clear the CMOS by
popping out the battery for 15 minutes.&lt;/p&gt;
&lt;p&gt;I opened the laptop up, and looked around for the CMOS battery. There wasn’t
one. Turns out they don’t exist any more. I left the main battery disconnected
for a while to see if it would help, and it didn’t.&lt;/p&gt;
&lt;h3 id=&#34;unexpected-success&#34;&gt;Unexpected success&lt;/h3&gt;
&lt;p&gt;I started to get worried: if I couldn’t fix this, I wouldn’t be able to
work until I got a new PC, and that wasn’t really in my budget at the minute.
I sat reading old forum threads and help guides&lt;sup id=&#34;fnref:3&#34;&gt;&lt;a class=&#34;footnote-ref&#34; href=&#34;#fn:3&#34; role=&#34;doc-noteref&#34;&gt;3&lt;/a&gt;&lt;/sup&gt;, none of which were actually
useful. Out of nowhere, though, the laptop booted up.&lt;/p&gt;
&lt;p&gt;Naturally, I immediately shut the laptop down again, opened it up, and switched
back to the new RAM modules. Then I turned it on again and sat waiting. After
about 15 minutes of it looking totally dead, it turned on and showed a BIOS
warning about the hardware configuration being changed. It then booted perfectly
normally, and all 64GB of RAM was visible and usable.&lt;/p&gt;
&lt;p&gt;My theory is that the forum threads were right: Dell laptops are funny about
RAM upgrades. But somehow in removing the physical CMOS battery, they’ve kept
the same “you have to wait 15 minutes” behaviour just without any indication
that’s what’s happening. Regardless, I now have enough RAM even for the
greediest of IDEs and Electron apps.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr/&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Bizarrely, the maximum spec has &lt;em&gt;decreased&lt;/em&gt; to 16GB since then. &lt;a class=&#34;footnote-backref&#34; href=&#34;#fnref:1&#34; role=&#34;doc-backlink&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;In the generic sense. I use &lt;a href=&#34;https://kagi.com/&#34;&gt;Kagi&lt;/a&gt; these days. &lt;a class=&#34;footnote-backref&#34; href=&#34;#fnref:2&#34; role=&#34;doc-backlink&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:3&#34;&gt;
&lt;p&gt;On my phone because, y’know, the laptop was busted. &lt;a class=&#34;footnote-backref&#34; href=&#34;#fnref:3&#34; role=&#34;doc-backlink&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content>
    </entry>
    <entry>
        <title>Reverse engineering an Arctis Pro Wireless Headset</title>
        <link href="https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/"/>
        <updated>2021-06-12T00:00:00Z</updated>
        <id>https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/</id>
        <content xml:lang="en" type="html">&lt;figure class=&#34;image left&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/headset.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/headset.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/headset.png&#34; alt=&#34;Boxed SteelSeries Arctis Pro Wireless Headset&#34; loading=&#34;lazy&#34; width=&#34;300&#34; height=&#34;380&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;The Arctis Pro Wireless Headset.&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;For the last year and a bit, I’ve been using a &lt;a href=&#34;https://steelseries.com/gaming-headsets/arctis-pro-wireless&#34;&gt;SteelSeries Arctis Pro Wireless Headset&lt;/a&gt;
for gaming and talking to friends. It’s a fine headset, but because there’s an always-on receiver there’s no
way to detect if the headset is turned on or not from the desktop.&lt;/p&gt;
&lt;p&gt;Whenever I start using the headset, I set my desktop’s sound to go to the headset, and then when I stop using
the headset I set it to go back to speakers. It doesn’t take more than a second, but some days I might put the
headset on a dozen times as I’m on calls, or if it’s noisy outside, etc. That means it’s probably
&lt;a href=&#34;https://xkcd.com/1205/&#34;&gt;worth at least a few hours of my time&lt;/a&gt; trying to automate it.&lt;/p&gt;
&lt;p&gt;At first, I hoped I’d be able to tell from the state of the USB device whether there was a headset
connected but nothing at all changed when flipping it on and off. Then I went hunting for existing
open source tools that might work with it and found that while people have reverse engineered many
of the older Arctis headsets, no one has done the same for the Pro Wireless. I finished off with
a search to see if anyone had documented the wire protocol even if there was no nice open source
software to go with it; I came up short there, too. Looks like I’d have to do it myself.&lt;/p&gt;
&lt;!--more--&gt;
&lt;h3 id=&#34;capturing-data-with-wireshark&#34;&gt;Capturing data with WireShark&lt;/h3&gt;
&lt;p&gt;The headset exposes a Human Interface Device (HID), and the wire protocols for earlier versions
of the Arctis series looked to be very simple messages passed over the HID connection. It should
therefore be fairly easy to use &lt;a href=&#34;https://www.wireshark.org/&#34;&gt;WireShark&lt;/a&gt; to capture the data
being sent and received by the official SteelSeries application&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a class=&#34;footnote-ref&#34; href=&#34;#fn:1&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;After setting up WireShark and making it record only the headset’s HID connection, it quickly
became apparent that the software was sending three different requests each second, over and
over again:&lt;/p&gt;
&lt;figure class=&#34;image full&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/wireshark1.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/wireshark1.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/wireshark1.png&#34; alt=&#34;Wireshark, showing a packet capture of a SET_REPORT request from the host to the headset&#34; loading=&#34;lazy&#34; width=&#34;1007&#34; height=&#34;824&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;Wireshark, showing a packet capture of a SET_REPORT request from the host to the headset&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The packets we’re interested in are the &lt;code&gt;SET_REPORT Request&lt;/code&gt; frames sent from the host to the
device. Wireshark understands the HID protocol, so it nicely shows us the raw HID data; in the
screenshot this is &lt;code&gt;0x40AA&lt;/code&gt; (ignoring the trailing zero bytes). The other requests sent immediately
after have &lt;code&gt;0x41AA&lt;/code&gt; and &lt;code&gt;0x42AA&lt;/code&gt; payloads — clearly the first byte is indicating which piece
of data is being requested.&lt;/p&gt;
&lt;p&gt;The responses to these requests come back in an &lt;code&gt;URB_INTERRUPT in&lt;/code&gt; frame:&lt;/p&gt;
&lt;figure class=&#34;image full&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/wireshark2.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/wireshark2.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/wireshark2.png&#34; alt=&#34;Wireshark, showing a packet capture of the headset&amp;#39;s response to the earlier request&#34; loading=&#34;lazy&#34; width=&#34;1007&#34; height=&#34;824&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;Wireshark, showing a packet capture of the headset’s response to the earlier request&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;So the answer to our first request appears to be &lt;code&gt;0x04&lt;/code&gt;. The second response is &lt;code&gt;0x0402&lt;/code&gt; and the third is &lt;code&gt;0x04&lt;/code&gt; again.
The first thing I tried doing was popping the spare battery out of the charger. The response to the &lt;code&gt;0x42AA&lt;/code&gt; request
changed from &lt;code&gt;0x04&lt;/code&gt; to &lt;code&gt;0x00&lt;/code&gt; - that’s certainly clear enough! After a bit of waiting around, the battery in my headset
dropped from full on the display to three bars, and at that point the &lt;code&gt;0x40AA&lt;/code&gt; response dropped from &lt;code&gt;0x04&lt;/code&gt; to &lt;code&gt;0x03&lt;/code&gt;.
The display on the receiver shows battery state as four bars, and it appears the wire protocol directly corresponds to
that particular representation.&lt;/p&gt;
&lt;p&gt;That left the &lt;code&gt;0x41AA&lt;/code&gt; request as an unknown. I tried everything I could think of, but it stubbornly kept returning
&lt;code&gt;0x0402&lt;/code&gt;. I enlisted a friend who has the same headset to run some hacky Go code and report his values, and he also
got a &lt;code&gt;0x0402&lt;/code&gt; response. As I explained that I couldn’t figure out what these values are, he reported back that turning
his headset off made the response change to &lt;code&gt;0x0202&lt;/code&gt;. In all my testing, I’d forgotten to try turning the headset off!
That’s the one thing I was actually trying to detect, as well. Thanks, Simon, for helping me get past that bit of
stupidity!&lt;/p&gt;
&lt;p&gt;I still don’t know what the second byte of the response is, or whether there are other values than &lt;code&gt;0x04&lt;/code&gt; for on
and &lt;code&gt;0x02&lt;/code&gt; for off, but I’m happy enough to label it as “device status” and move on.&lt;/p&gt;
&lt;h3 id=&#34;exploring-other-features&#34;&gt;Exploring other features&lt;/h3&gt;
&lt;p&gt;The software allows you to tweak a bunch of different settings:&lt;/p&gt;
&lt;figure class=&#34;image full&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/settings2.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/settings2.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/settings2.png&#34; alt=&#34;SteelSeries Good Game software, showing the advanced headset settings&#34; loading=&#34;lazy&#34; width=&#34;1133&#34; height=&#34;836&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;SteelSeries Good Game software, showing the advanced headset settings&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;I went through each one and fiddled with all the values, recording the requests in WireShark as I did so. It turns
out the protocol is very simplistic - the wire protocol directly corresponds to the UI elements in the software (or
on the receiver, if you navigate through its menus). For example, the software allows you to set the “Headset auto
shutoff” value in increments of 10 minutes. You might usually expect this to be converted to seconds or something
similar before being passed to the device, but on the wire it’s actually sent as &lt;code&gt;0x00&lt;/code&gt; for off, &lt;code&gt;0x01&lt;/code&gt; for 10 minutes,
up through to &lt;code&gt;0x0C&lt;/code&gt; for the maximum of 120 minutes.&lt;/p&gt;
&lt;p&gt;All the dropdown options seem to function this way — if you pick the 6th option then the request payload will be
an &lt;code&gt;0x06&lt;/code&gt; byte. The sliders have fixed positions they snap to and function similarly: for the two brightness sliders
pictured they snap to 11 positions and on the wire these range from &lt;code&gt;0x00&lt;/code&gt; for off to &lt;code&gt;0x0A&lt;/code&gt; for the maximum.&lt;/p&gt;
&lt;p&gt;At this point I was well past my goal of being able to detect whether the headset was on or off, and I was now just
trying to see if I could figure out enough of the protocol that I could reimplement the control software on Linux if
I ever wanted to. Just as I was about to close the app, something caught my eye: there are integrations with games
and other software that can display information on the receiver’s OLED display!&lt;/p&gt;
&lt;p&gt;There’s an &lt;a href=&#34;https://github.com/SteelSeries/gamesense-sdk&#34;&gt;official API&lt;/a&gt; for this, but it involves sending JSON to
a webserver which runs as part of their app&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a class=&#34;footnote-ref&#34; href=&#34;#fn:2&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;. That doesn’t feel very nice, and definitely won’t work for me on Linux,
so I started a new WireShark session and took some captures while I spoke to myself on Discord.&lt;/p&gt;
&lt;h3 id=&#34;decoding-pixels&#34;&gt;Decoding pixels&lt;/h3&gt;
&lt;p&gt;The frames sent to the device whenever Discord showed a notification had a 1060 byte payload. The display on the
receiver is 140 pixels wide&lt;sup id=&#34;fnref:3&#34;&gt;&lt;a class=&#34;footnote-ref&#34; href=&#34;#fn:3&#34; role=&#34;doc-noteref&#34;&gt;3&lt;/a&gt;&lt;/sup&gt; and each pixel can only seem to be on or off, so I figured each bit in the payload
corresponded to one bit of the output. I exported the data to binary in the hope that I could visually see what was
going on - in theory if I line wrap the data at 140 characters it should look vaguely like the final output.
Unfortunately, it did not. There was roughly the right number of high bits, but no amount of fiddling with them in
a text editor could give me a coherent picture.&lt;/p&gt;
&lt;p&gt;Instead, I wrote some code to write different values to the device. Starting with a payload of all zeroes and gradually
increasing a bit at a time every second. After the first few seconds, I saw a line of pixels being drawn downwards on
the left of the screen; had I just got the axes the wrong way around? After the first eight pixels lit up, though, they
jumped over to the next column. The actual addressing scheme looks something like this:&lt;/p&gt;
&lt;figure class=&#34;image full&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/display.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/display.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/display.png&#34; alt=&#34;Diagram of how pixels are addressed on the receiver&amp;#39;s OLED display&#34; loading=&#34;lazy&#34; width=&#34;358&#34; height=&#34;647&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;Diagram of how pixels are addressed on the receiver’s OLED display&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;So the first 140 bytes given the pixels for the first 8 rows, the next 140 bytes fill in the 8 rows below that, and
so on and so forth. Armed with this information I wrote a simple program to read an image and output it to the
display:&lt;/p&gt;
&lt;figure class=&#34;image full&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/helloworld.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/helloworld.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/helloworld.png&#34; alt=&#34;Headset receiver displaying a custom Hello World message&#34; loading=&#34;lazy&#34; width=&#34;500&#34; height=&#34;259&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;Headset receiver displaying a custom Hello World message&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;At this point I was thinking about trying to get Doom rendering on the screen, but I couldn’t find anything nicely
hackable that would let me grab the output and pass it on to the receiver. Instead, I decided to try a GIF decoder
and before very long had a nice little animated display:&lt;/p&gt;
&lt;figure class=&#34;video full&#34;&gt;
  &lt;video src=&#34;https://chameth.com/reverse-engineering-arctis-pro-wireless-headset/nyan.webm&#34; alt=&#34;Video of receiver playing Nyan cat gif&#34; controls=&#34;&#34;&gt;&lt;/video&gt;
&lt;/figure&gt;
&lt;h3 id=&#34;protocol-reference&#34;&gt;Protocol reference&lt;/h3&gt;
&lt;p&gt;All the HID messages have a single byte that determines the message type, then an &lt;code&gt;0xAA&lt;/code&gt; byte, then any payload
required by the command. These are the ones I’ve figured out:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Byte&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Payload&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x09&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Save changes&lt;/td&gt;
&lt;td&gt;None.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x10&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Request firmware version(?)&lt;/td&gt;
&lt;td&gt;None.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x27&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Volume limiter&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; for off, &lt;code&gt;0x01&lt;/code&gt; for on.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x2E&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Equalizer preset&lt;/td&gt;
&lt;td&gt;ID of the equalizer preset to use.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x39&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sidetone level&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; for lowest to &lt;code&gt;0x09&lt;/code&gt; for highest.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x3C&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Set headset timeout&lt;/td&gt;
&lt;td&gt;Timeout, as a number of 10 minutes. &lt;code&gt;0x00&lt;/code&gt; for off to &lt;code&gt;0x0C&lt;/code&gt; for 120 mins.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x3E&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mic mute LED brightness&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; for lowest to &lt;code&gt;0x0A&lt;/code&gt; for highest.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x40&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Request headset battery&lt;/td&gt;
&lt;td&gt;None.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x41&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Request device status&lt;/td&gt;
&lt;td&gt;None.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x42&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Request receiver battery&lt;/td&gt;
&lt;td&gt;None.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x51&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Surround sound mode&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; for off, &lt;code&gt;0x01&lt;/code&gt; for on.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x62&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auto-start Bluetooth&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; for off, &lt;code&gt;0x01&lt;/code&gt; for on.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x63&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auto-mute game audio during calls&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; for off, &lt;code&gt;0x01&lt;/code&gt; for on.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x85&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;OLED brightness&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; for lowest to &lt;code&gt;0x0A&lt;/code&gt; for highest.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x83&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Equalizer&lt;/td&gt;
&lt;td&gt;(Not yet decoded)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0x89&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Screensaver mode&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0x00&lt;/code&gt; to dim, &lt;code&gt;0x01&lt;/code&gt; for off, &lt;code&gt;0x02&lt;/code&gt; for screensaver.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0xD2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Render image&lt;/td&gt;
&lt;td&gt;Pixel array as described above.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Some of these I’ve not dug too much into because they didn’t seem very interesting. If you have an Arctis Pro Wireless
and figure anything more out, let me know, and I’ll update the list.&lt;/p&gt;
&lt;p&gt;If you just want to check device state like I originally did, I’ve contributed support for this headset to the
excellent &lt;a href=&#34;https://github.com/Sapd/HeadsetControl&#34;&gt;HeadsetControl&lt;/a&gt; project. It should be in the next release.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr/&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;Unfortunately (as you’d expect) their application only runs on Windows, so this process
involved an annoying amount of rebooting to Windows, fleeing back to Linux, and then
realising I hadn’t actually recorded enough to figure it out and repeating. &lt;a class=&#34;footnote-backref&#34; href=&#34;#fnref:1&#34; role=&#34;doc-backlink&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;You can also send lisp to the webserver, and it will execute it. No comment. &lt;a class=&#34;footnote-backref&#34; href=&#34;#fnref:2&#34; role=&#34;doc-backlink&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id=&#34;fn:3&#34;&gt;
&lt;p&gt;I know this not because it’s mentioned in the technical specs (it’s not), but because I took a photo and counted
them out one by one. &lt;a class=&#34;footnote-backref&#34; href=&#34;#fnref:3&#34; role=&#34;doc-backlink&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content>
    </entry>
    <entry>
        <title>Reverse engineering the Sense API</title>
        <link href="https://chameth.com/sense-api/"/>
        <updated>2016-04-10T00:00:00Z</updated>
        <id>https://chameth.com/sense-api/</id>
        <content xml:lang="en" type="html">&lt;figure class=&#34;image right&#34;&gt;
  &lt;picture&gt;
      &lt;source srcset=&#34;https://chameth.com/sense-api/sense.avif&#34; type=&#34;image/avif&#34;/&gt;
      &lt;source srcset=&#34;https://chameth.com/sense-api/sense.webp&#34; type=&#34;image/webp&#34;/&gt;
      &lt;img src=&#34;https://chameth.com/sense-api/sense.jpg&#34; alt=&#34;A Sense unit and its two pillow sensors&#34; loading=&#34;lazy&#34; width=&#34;550&#34; height=&#34;400&#34;/&gt;
  &lt;/picture&gt;
  &lt;figcaption&gt;&lt;p&gt;A Sense unit and its two pillow sensors&lt;/p&gt;
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Sense is a little device that sits by your bedside and, in
conjunction with a little ‘pill’ attached to your pillow, monitors your sleeping patterns and
any environmental conditions that might hamper them. Android and iOS apps show you your sleep
history, and offer suggestions for improvements.&lt;/p&gt;
&lt;p&gt;Sense was &lt;a href=&#34;https://www.kickstarter.com/projects/hello/sense-know-more-sleep-better/description&#34;&gt;Kickstarted&lt;/a&gt;
in August 2014, raising over 2.4 million US dollars, and shipped to backers in mid 2015. The
campaign blurb included this snippet:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Building with Sense&lt;/p&gt;
&lt;p&gt;You’ll always have access to your data via our API. Take it, play with it, graph it, do whatever
you want with it. It’s yours. That’s important to us.&lt;/p&gt;
&lt;p&gt;We enjoy tinkering with and building on-top of other products we like. Sense will let you have
that experience.&lt;/p&gt;
&lt;p&gt;We’d love to hear your thoughts on what you might want to build with Sense, and how you could
directly interact with the hardware, and the data it collects.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sounds great! But a year after shipping, there’s no sign of an API, and some of us who enjoy
tinkering are getting a bit restless…&lt;/p&gt;
&lt;!--more--&gt;
&lt;aside class=&#34;update raised-box&#34;&gt;
  &lt;h5 class=&#34;plain-header&#34;&gt;Update 2019-05-28:&lt;/h5&gt;
  &lt;p&gt;Hello, the company behind Sense, shut down in 2017 and took the Sense APIs with
it. The information below is no longer relevant. I’m not personally aware of
any way to interact with the Sense hardware directly.&lt;/p&gt;
&lt;/aside&gt;
&lt;h3 id=&#34;reverse-engineering-to-the-rescue&#34;&gt;Reverse engineering to the rescue&lt;/h3&gt;
&lt;p&gt;Data from the Sense hardware is transmitted off onto the Internet somewhere, and then pulled
down by the mobile apps. If we can snoop that traffic, we can probably figure out how to grab
the data from the Sense.&lt;/p&gt;
&lt;p&gt;So the first step is to capture the raw network traffic while the Sense and the app are in use. I
crafted an extremely over-the-top setup that involves my phone and the Sense being on a new,
separate wireless network that gateways through a Linux server that can look in on all the
traffic (because you never know when a dedicated capturing network will come in handy, right?…)&lt;/p&gt;
&lt;p&gt;Running &lt;code&gt;tshark&lt;/code&gt; while the app and device are active showed they were making HTTPS requests an
Amazon Elastic Cloud instance. That’s not really much use, as we can’t see the content of the
requests. The next step is to move up the network stack and target the HTTPS traffic specifically.
Step in, &lt;a href=&#34;https://mitmproxy.org/&#34;&gt;&lt;code&gt;mitmproxy&lt;/code&gt;&lt;/a&gt;. This automates man-in-the-middle attacks
on HTTPS requests. When it receives such a request, it cooks up its own certificate and sends that
to the client, and then sits in between while the client and the server communicate.&lt;/p&gt;
&lt;p&gt;The certificates generated by &lt;code&gt;mitmproxy&lt;/code&gt; aren’t issued by a trusted source, so (well behaved)
browsers and apps will throw up lots of warnings and refuse to communicate with it for the most
part. This is the mechanism that stops anyone impersonating your banking website when you access it
over HTTPS, so is generally a very good thing. In this case, both the Sense itself and the Android
app refused to talk with the blatant attacker.&lt;/p&gt;
&lt;p&gt;We control the Android phone, though, so can just tell it that we trust the dodgy certificate
issuer. This involves grabbing the certificate generated by mitmproxy, and adding it to Android’s
key store. The process is &lt;a href=&#34;http://docs.mitmproxy.org/en/stable/certinstall.html#installing-the-mitmproxy-ca-certificate-manually&#34;&gt;documented nicely in the mitmproxy docs&lt;/a&gt;
and is pretty straightforward. With Android trusting our certificate authority, the Sense app
starts talking through the proxy and we can look at the plain HTTP requests.&lt;/p&gt;
&lt;h3 id=&#34;the-api&#34;&gt;The API&lt;/h3&gt;
&lt;p&gt;Logging in to the Android app and navigating through the various screens shows that the API is
actually pretty nice. It’s RESTful, and uses an OAuth bearer token for authorisation, as you can
see in the &lt;code&gt;mitmproxy&lt;/code&gt; output of the authentication and first few requests:&lt;/p&gt;
&lt;pre class=&#34;chroma-chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;POST https://api.hello.is/v1/oauth2/token
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 151B 1.17s
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;GET https://api.hello.is/v2/account/preferences
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 124B 109ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;GET https://api.hello.is/v1/account
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 181B 388ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;GET https://api.hello.is/v2/devices
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 235B 126ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;POST https://api.hello.is/v1/app/checkin
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 106B 119ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;GET https://api.hello.is/v2/insights
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 1.4kB 157ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;POST https://api.hello.is/v1/notifications/registration
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 204 [no content] 364ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;GET https://api.hello.is/v2/timeline/2016-04-09
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 160B 550ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;GET https://api.hello.is/v1/questions?date=2016-04-10
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 284B 132ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;PATCH https://api.hello.is/v1/app/stats
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 202 [no content] 126ms
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;GET https://api.hello.is/v1/app/stats/unread
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    ← 200 application/json 71B 171ms
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;authorisation&#34;&gt;Authorisation&lt;/h4&gt;
&lt;p&gt;To get a bearer token, you send a POST request to &lt;code&gt;/v1/oauth2/token&lt;/code&gt;, supplying the username and
password, and a client ID and secret. Presumably if the API is ever opened up you’ll be able to
register clients and get your own ID and secret, but for now reusing the ones from the Android
app works fine. [I’ve prettified and linewrapped the content to make it a bit easier to read.]&lt;/p&gt;
&lt;pre class=&#34;chroma-chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-nf&#34;&gt;POST&lt;/span&gt; &lt;span class=&#34;chroma-nn&#34;&gt;/v1/oauth2/token&lt;/span&gt; &lt;span class=&#34;chroma-kr&#34;&gt;HTTP&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;chroma-m&#34;&gt;1.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Host&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;api.hello.is&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Accept&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;*/*&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Content-Length&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;123&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Content-Type&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;application/x-www-form-urlencoded&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;grant_type=password
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt; &amp;amp;client_id=8d3c1664-05ae-47e4-bcdb-477489590aa4
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt; &amp;amp;client_secret=4f771f6f-5c10-4104-bbc6-3333f5b11bf9
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt; &amp;amp;username=USERNAME
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt; &amp;amp;password=PASSWORD
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&#34;chroma-chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-kr&#34;&gt;HTTP&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;chroma-m&#34;&gt;1.1&lt;/span&gt; &lt;span class=&#34;chroma-m&#34;&gt;200&lt;/span&gt; &lt;span class=&#34;chroma-ne&#34;&gt;OK&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Cache-Control&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;no-cache&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Content-Type&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;application/json&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Date&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;Sun, 10 Apr 2016 17:25:16 GMT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;transfer-encoding&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;chunked&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Connection&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;keep-alive&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;token_type&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;Bearer&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;expires_in&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;31536000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;account_id&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;1234&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;access_token&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;refresh_token&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;2.yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;sleep-timeline&#34;&gt;Sleep timeline&lt;/h4&gt;
&lt;p&gt;Getting the timeline for one night is just a straight up GET request. It gives a detailed log of
events, including different ‘depths’ of sleep (I’ve cut out a whole bunch here for simplicity).
It also shows metrics relating to the entire night, and their condition (‘warning’ or ‘ideal’).&lt;/p&gt;
&lt;pre class=&#34;chroma-chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-nf&#34;&gt;GET&lt;/span&gt; &lt;span class=&#34;chroma-nn&#34;&gt;/v2/timeline/2016-04-08&lt;/span&gt; &lt;span class=&#34;chroma-kr&#34;&gt;HTTP&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;chroma-m&#34;&gt;1.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Host&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;api.hello.is&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Accept&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;*/*&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Authorization&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;Bearer 2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&#34;chroma-chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-kr&#34;&gt;HTTP&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;chroma-m&#34;&gt;1.1&lt;/span&gt; &lt;span class=&#34;chroma-m&#34;&gt;200&lt;/span&gt; &lt;span class=&#34;chroma-ne&#34;&gt;OK&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Cache-Control&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;no-cache&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Content-Type&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;application/json&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Date&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;Sun, 10 Apr 2016 17:29:00 GMT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;transfer-encoding&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;chunked&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-n&#34;&gt;Connection&lt;/span&gt;&lt;span class=&#34;chroma-o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;chroma-l&#34;&gt;keep-alive&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;score&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;76&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;score_condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;WARNING&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;You were asleep for **8.2 hours**, and sleeping soundly for 3.2 hours.&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;date&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;2016-04-08&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;events&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timestamp&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;1460168700000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timezone_offset&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;3600000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;duration_millis&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;60000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;You went to bed.&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_depth&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_state&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;AWAKE&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;event_type&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;GOT_IN_BED&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;valid_actions&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:[&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;ADJUST_TIME&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;VERIFY&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;INCORRECT&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;},{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timestamp&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;1460169600000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timezone_offset&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;3600000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;duration_millis&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;60000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;You fell asleep.&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_depth&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_state&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;SOUND&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;event_type&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;FELL_ASLEEP&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;valid_actions&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:[&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;ADJUST_TIME&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;VERIFY&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;INCORRECT&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;},{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timestamp&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;1460177040000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timezone_offset&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;3600000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;duration_millis&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;60000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;You were moving around quite a bit.&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_depth&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_state&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;AWAKE&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;event_type&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;GENERIC_MOTION&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;valid_actions&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:[&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;VERIFY&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;INCORRECT&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;},{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timestamp&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;1460199000000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;timezone_offset&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;3600000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;duration_millis&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;60000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;message&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;Good morning.&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_depth&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;sleep_state&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;AWAKE&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;event_type&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;WOKE_UP&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;      &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;valid_actions&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:[&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;ADJUST_TIME&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;VERIFY&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;INCORRECT&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-p&#34;&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;metrics&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;total_sleep&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;490&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;MINUTES&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;sound_sleep&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;190&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;MINUTES&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;time_to_sleep&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;15&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;MINUTES&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;times_awake&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;QUANTITY&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;fell_asleep&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;1460169600000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;TIMESTAMP&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;woke_up&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-mi&#34;&gt;1460199000000&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;TIMESTAMP&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;temperature&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;CONDITION&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;humidity&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;CONDITION&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;particulates&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;CONDITION&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;WARNING&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;light&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;CONDITION&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt; &lt;span class=&#34;chroma-p&#34;&gt;},&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;    &lt;span class=&#34;chroma-p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;name&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;sound&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;unit&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;CONDITION&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;chroma-nt&#34;&gt;&amp;#34;condition&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;chroma-s2&#34;&gt;&amp;#34;IDEAL&amp;#34;&lt;/span&gt;&lt;span class=&#34;chroma-p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;  &lt;span class=&#34;chroma-p&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;chroma-line&#34;&gt;&lt;span class=&#34;chroma-cl&#34;&gt;&lt;span class=&#34;chroma-p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;other-interesting-resources&#34;&gt;Other interesting resources&lt;/h4&gt;
&lt;p&gt;Pretty much everything displayed in the app is available as a REST resource. They clearly
put some thought into API design, which makes it even more of a shame that they haven’t made it
public yet. Some of the other interesting resources are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/v1/alarms&lt;/code&gt;: the alarms set on the Sense.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/v1/room/current?temp_unit=c&lt;/code&gt;: gives the latest environmental readouts from the Sense.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/v1/room/all_sensors/hours?quantity=2&amp;amp;from_utc=&amp;lt;timestamp&amp;gt;&lt;/code&gt;: sensor history.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/v2/devices&lt;/code&gt;: the paired devices, including battery status of pills.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/v2/insights&lt;/code&gt;: JSON representation of the cards displayed on the main screen (recommendations,
analysis, etc).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/v2/trends/LAST_WEEK&lt;/code&gt; (or &lt;code&gt;MONTH&lt;/code&gt; or &lt;code&gt;3_MONTHS&lt;/code&gt;): gives graph data for sleep scores, duration
and depths.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now the API is figured out, all that’s left is to build something that uses it…&lt;/p&gt;
</content>
    </entry>
</feed>
