I wrote an API client for my water-cooled bed · Tinkering
I wrote an API client for my water-cooled bed
Posted on July 18, 2026
Table of Contents:
Sleep
Chilipad
Why this device
Construction
API
A note about the Postman examples
Endpoints
Device control
API Client
Sleeping on it
Now that I have your attention, let's break that down a little bit.
I recently purchased a Sleep.me Chilipad 2.0, which is a system that allows you to control the temperature of your bed using a thin, water-filled mattress topper that's connected to a device that contains a pump, reservoir, and thermostat.<br>It was $17001.<br>Yes it's ridiculous. I know.<br>I make software engineer money, I'm single, I live alone, and I don't have kids. Sue me. I'll provide a serious, grown-up justification in just a second, but for now "la la la can't hear you."
The idea is that it helps regulate your body temperature while you sleep if you have trouble doing it yourself, don't have AC in your bedroom, etc.<br>The device allows you to set desired temperatures throughout the night, put this on schedules that apply on certain days of the week, etc.<br>The manufacturer also provides a developer API, so immediately there was no world in which I didn't do some bullshittery with this.
The result is a tool called bedctl2. I named it that way for two reasons:
There's a long history of "control" programs having names that end with -ctl.
In my head bedctl is pronounced "bed cuttle"3, which sounds like "bed cuddle", which is cute.
Sleep
Our understanding of how the human body works is constantly evolving.<br>This is good.<br>However, between grifters on social media, biased research funded by industry, and the evolving understanding provided by science I mentioned earlier, you could sometimes reasonably convince yourself that there's evidence to support the claim that juggling live salmon cures male pattern baldness.4
I have a PhD in physics.<br>I built lasers that spit out 80 femtosecond pulses, and I did quantum mechanics simulations.<br>I am so scarred by that experience that my default stance on science-related (which includes health) headlines and social media posts is "bullshit until proven otherwise", where "proven" includes but is not limited to "corroborated by my doctor or a consensus of medical professionals."<br>And to be clear, that distrust is not distrust of science, it's distrust that nuance has been stripped away to fit into a headline, essentially.<br>I am not a doctor, and I'm very aware of that.
One piece of knowledge I feel safe clinging to and saying out loud to the internet is that sleep is probably good for you.<br>Everything seems to get better with sleep: your immune system, your cognitive function, recovery from physical activity, etc.
Unfortunately, I've always had a complicated relationship with sleep.<br>Namely because my neuro is divergent.
Neurodivergent people tend to be night owls as a survival/recovery mechanism.<br>Having some time to ourselves where no one is placing demands on our attention, behavior, etc, gives us some space to exist as our actual selves, not our "capitalism demands that I perform on this schedule, in this manner, to these people, otherwise I can't feed myself" selves.<br>This means that our sleep routines can be either misaligned with our work schedules, or just irregular in general.
If it's not clear yet, I have ADHD.<br>This means that my brain never shuts up. Like, ever.<br>This is not conducive to "winding down for bed."<br>I developed a reading in bed routine from a pretty early age, which cuts down on distractions and acts as a signpost my nervous system can recognize as "ah, we typically fall asleep after doing this for a while, let's start that process."
Luckily I was diagnosed with ADHD pretty young, and I've been medicated since childhood.<br>For people that are diagnosed as adults, I see one of two reactions to starting ADHD medication:
Holy shit, is this how normal people feel all the time? It's so much quieter!
Ah fuck, I'm autistic too.
If it's not clear yet, I'm autistic.<br>The overlap between autism and ADHD is pretty significant, and in many cases the ADHD is just masking the autism.<br>That's why some people go undiagnosed until they start medication.<br>Not me though, I happen to be exceptionally good at burning mental energy in exchange for social skills.<br>I was only diagnosed about two years ago, but there were signs.5
Many people with autism have sensory issues, as in certain textures or sensations are abnormally bothersome.<br>Imagine the reaction that some people have to nails on a chalkboard, or the sound of someone chewing, etc, but getting that reaction to a texture, certain kinds of touch, etc.<br>Similarly, many people with autism have trouble regulating their body temperature to the same degree as neurotypical people.<br>When it comes to sleep, this means that I have trouble feeling comfortable unless the temperature is just right, the weight of the comforter/duvet is high enough, etc.
I also just moved to...