I live in an older house with poor insulation, and I turn my thermostat down to 62 at night. My fiancée hates me when she firsts dives into the cold bed – hell hath no fury, after all. So to make amends, I purchased a heated blanket which I use to warm up the bed before we jump in. Except, now I’m the one frustrated as I’m poked awake in the middle of the night, her complaining she’s too hot and myself sweating bullets.

I also have a curious little toddler running around the house, and a few times I’ve walked into my room to find that the blanket had been turned on at some some point – so of course, Home Assistant is the solution.

Most heated blankets (if not all) here in the US do NOT begin to warm upon receiving power, but rather enter a “Standby” – so plugging this into a smart plug does not do all that much other than allow me to remotely shut OFF the blanket. And I’m fine with that – I understand the dangers of unattended heating devices.

At the same time, I don’t want to have to request “Alexa, turn on the heated blanket.” every night – I already ask her to turn on a sound machine in our room, and it’s 2018 for christ’s sake, Alexa should get the hint already!

The Automation

Here’s the idea: We’re going to plug the blanket into a Wemo Insight switch and have it turn on and off alongside the sound machine, as that should prevent my daughter from having it start heating during the day AND allow me to continue my quest to be as lazy as possible by only requesting the sound machine be turned on at night.

Since the Wemo Insight (as do many other smart switches) allows me to monitor energy usage, I can also use this to monitor the current state of the blanket (standby vs heating) and have an automation turn off the switch after x amount of time – 1 hour in my case.

But, since the blanket does not resume heating upon being reconnected, we can take it one step further and just have it turn the power back on after a quick delay, having the blanket return to “standby” should we wake up and want to turn it on.

Essentially, the blanket will always be in “standby” mode as long as our sound machine is on, and it will only remain in “heating” mode for 1 hour before reverting back to”standby” mode via a quick off & on of the Wemo switch. This also safeguards us against by daughter being smart enough to enable the Wemo and turning on the heat during the day – worst case scenario, it’s only running for an hour.

So what does this all look like? Pretty simple, actually:

- alias: '[Heated Blanket] Turn Off After 1 Hour Of Use'
  - platform: numeric_state
    entity_id: switch.heated_blanket
    value_template: >
      {% if state.attributes.current_power_w %}
        {{ state.attributes.current_power_w | int }}
      {% else %}
        {{ 0 | int }}
      {% endif %}
    above: 1
      hours: 1
  - platform: state
    entity_id: switch.sound_machine
    to: 'off'
  - service: homeassistant.turn_off
      entity_id: switch.heated_blanket
  - condition: and
    - condition: state
      entity_id: switch.sound_machine
      state: 'on'
  - delay: '00:00:05'
  - service: homeassistant.turn_on
      entity_id: switch.heated_blanket

- alias: '[Heated Blanket] Turn On With Sleep Mode'
  - platform: state
    entity_id: switch.sound_machine
    to: 'on'
  - service: homeassistant.turn_on
      entity_id: switch.heated_blanket

The second automation is self explanatory, it just turns on the heated blanket when the sound machine is.

The first automation is also pretty simple, it’s triggered when the sound machine is turned on, but also when the heated blanket’s power usage is above 1 watt for 1 hour. The template adds some complexity but as there is no current_power_w attribute when the switch is off, we first check to see if the attribute even exists and we consider it to be 0 if not – otherwise we just watch its actual value.

When triggered, it turns off the heated blanket. If the sound machine is currently on, it waits 5 seconds and then turns the heated_blanket back on – now in a standby state. Otherwise, if the sound machine is off (because the automation was triggered by it turning off), the heated blanket just stays off.

Future Plans and Opportunities

Now I have the best of both worlds as happy wife is happy life, and also the knowledge that my daughter can’t burn down the house!

Thanks for reading.


Leave a Reply


1 2
December 21st, 2018

Home Assistant: Heated Blanket Usage Limiter

Introduction I live in an older house with poor insulation, and I turn my thermostat down to 62 at night. [...]
December 19th, 2018

Home Assistant: Tracking Recent Arrivals + Having Alexa Welcome Them

Introduction I remember walking out of a movie theater in 2008 having just watched Iron Man, and thinking "Damn, I [...]
December 19th, 2018

Home Assistant: Automating Alexa Volume As A Media Player

Latest Version This guide is an update to my previous post, Automating Alexa Volume With Home Assistant and Spotify. At the [...]
January 9th, 2018

Home Assistant: Automating Alexa Volume With Home Assistant and Spotify

Updated Version Available! Automating volume control was simplified with the release of a custom component allowing for Alexa devices to [...]
October 6th, 2016

Subreddit Backup and Restore (Python Script)

Summary I'm an avid reddit user, constantly searching for new subreddits to subscribe to in my areas of my interests. Having [...]
October 7th, 2015

Saved Lead Hider – LinkedIn Sales Navigator Userscript

Introduction LinkedIn Sales Navigator is a useful tool that combines LinkedIn's network data, relevant news sources, and your accounts, leads, and [...]
June 20th, 2015

Boombox Airplay Conversion

Introduction Years ago, I purchased a Sony RDH-GTK1i boombox that has a 30-pin Apple connector, USB, RCA and radio functionality. At [...]
June 19th, 2015

HTPC – The Back-End

Introduction As explained on the Project Page, two of the most important components to an HTPC are the "invisible" background [...]
June 19th, 2015

Introduction to HTPCs

Introduction As mentioned on the Project Page, this, is an ongoing project for improving my HTPC solution. Its combination of [...]
June 19th, 2015

R1FLE Project (vgInteractive MK II)

Introduction This project is the slow growing progression of a project I started for the original Xbox, specifically for Halo 2. [...]