Hacker News new | past | comments | ask | show | jobs | submit login
Building an Alexa-Powered Electric Blanket (shkspr.mobi)
45 points by edent on Nov 28, 2018 | hide | past | favorite | 52 comments



My electric blanket is plugged into a z-wave mains adapter and I have a usb stick (z-stick) in my home server which controls my z-wave devices. I have a small bash script to turn it on/off. It's a bit cold this time of year so I like to have my blanket come on a few times as I wake up to give me a bit of a boost. Here are my cron jobs on my home server:

  # Weekday morning blanket schedule
  # 4 min boost before lighting schedule begins
  46      7 * * 1-5 blanket on for 4 minutes &>/dev/null
  # 2 min boost before first smart-watch alarm
  58      7 * * 1-5 blanket on for 2 minutes &>/dev/null
  # 2 min boosts before each subsequent smart-watch alarm
  8-38/10 8 * * 1-5 blanket on for 2 minutes &>/dev/null
My main bedroom light bulb is z-wave also. I have a similar system to make the light slowly come on in the morning as I wake up. The cron:

50 7 * * 1-5 for n in $(seq 1 99); do light $n; sleep 30; done; sleep 270; for n in $(seq 98 -1 0); do light $n; sleep 2; done

I also have OpenHab on my server so I can manually control the blanket and lights from both my Android phone and also my Pebble Watch.


Z-Wave or Insteon is the way to go for smarthome. Insteon is really old but very good, the switches can build relationships with one another without a central server. Word of warning, do not buy insteon bulbs, they fail regardless of power grid quality. All their other stuff kicks ass.


That's pretty nifty. I did look at a cron - but I'm often out of the house and don't want the energy being wasted.

I'm curious how you cope in that situation? Just SSH in a temporarily stop it?


If I'm going on holiday or away for a few days or whatever, I disable the cron jobs. If we're just talking the odd day here and there where I'm not at home for random reasons or not following my typical schedule, I don't worry about the waste. The amount of electricity involved is so low, we're talking about pennies.


One approach for those who have Nest thermostats would be to use the Away API to turn things off if you haven't been detected all day (or maybe some other heuristic). That was the only device that I thought of off the top of my head with a presence sensor, but there may well be others.


Coupling it with the smart alarm, instead of defining wake time strict would be nice next step.


That would be better, but this system works for me pretty well as I try to follow a strict schedule for getting up in the morning on week days.

I could however do with hooking it into my calendar so it doesn't run if I have an "Annual Leave" event on that day, or if it's a bank holiday. Just haven't got round to that yet.


And it would require a 1000x of the work to couple it, yes.

It always amaze me how a couple of shell scripts is almost always is the very sweet spot of any real life automation.


I'm not sure it would be 1000x the work. Just need a command line tool to parse ics which I can point at my nextcloud calendar, and then wrap it in another bash script called "atworktoday" or something, so I can do something like:

  50 7 * * 1-5 atworktoday && blanket on for 5 minutes
Would be nice if there was a tool which would allow me to do something like:

  curl -s https://link-to-my-ics | \
    ics --start $(date +%Y%m%dT000000Z) \
        --end   $(date +%Y%m%dT235959Z) \
        --filter-summary 'annual leave'
There must be loads of use cases for a tool which allows you to parse and filter ics. Even a tool which just converts ics to json would be pretty useful as we could then filter results with the excellent "jq" application:

  ANNUAL_LEAVE=$(curl -s https://link-to-my-ics \
    | ics2json --start $(date +%Y%m%dT000000Z) \
               --end   $(date +%Y%m%dT235959Z) \
    | jq 'map(select(.summary|ascii_downcase|contains("annual leave")))|length')
  if [[ "$ANNUAL_LEAVE" == "0" ]]; then
    echo "At work today"
  else
    echo "On holiday, wahoo!"
  fi
Somebody write this ;)


I was talking about coupling it with the smart alarm - that requires getting the realtime data from the smartwatch.


Oh right, yeah. I don't use the Pebble Smart Alarm. I tried to, but I don't believe it's any smarter than just picking a random time in a specified period. I mean, I know it claims to work based on when you're coming out of a deep sleep, but I saw no evidence that it actually did work that way when using it.


1000x is a real stretch depending on what data you have available. Not sure if this still works, but Google Home devices have a public API that gets you the alarms which have been set: https://rithvikvibhu.github.io/GHLocalApi/#assistant-assista.... True that this would require a fair bit more work, but personally I also find adding features to these sorts of systems a lot of fun.


It's 1000x considering the realtime data from smartwatch, which have no any API for that. So it includes decompiling smartwatches vendor's mobile app, or reverse engineering particular Bluetooth format the smartwatches use for sending the data to vendor's app.


Hi! This is a really cool project! If you care about your privacy in the bedroom, you should take a look at what we are building at https://snips.ai (disclaimer: I'm a co-founder)

We do the first 100% on-device and private-by-design Voice AI platform which you can use for free and run on a Raspberry Pi, to make it possible to use your blanket without sharing your bedtime secrets with Amazon ;)


Thanks - glad you enjoyed it. If you have any review units, I'd be happy to have a play and blog my experiences. My contact details are in my profile


The platform itself is freely downloadable, and if you want a Raspberry Pi with a microphone to test it easily, you can get one from

https://makers.snips.ai


I do care about privacy in all rooms, so is it 100% open source? Couldn't tell from the website.


Yes, we are open-sourcing the components over time! We started with open-sourcing the NLU that you can look at on this post:

https://medium.com/snips-ai/an-introduction-to-snips-nlu-the...


It also works offline, so you can heat your bed even when Amazon servers are not available :)


Controlling a heated blanket without an internet connection? The future really is amazing.


I’m more surprised that people still use electric blankets. Utterly dangerous things. Now you can connect your state of the art 1950s tech to the cloud.


Yeah, I would treat them like a candle. Fine if you're there watching it, but not something to leave alone. Although it's not too hard to build safe electric blankets that shut themselves off when they get too hot, as a consumer you don't really know what's inside.


Can you explain the main risks you see?

https://www.electricblanketfires.com/electric-blanket-fire-s... suggests that the primary issue is user error.

Are hot water bottles better? What other affordable means are there to easily warm a cold bed?


Yes the heating elements are flexible and are easy to damage and they carry current at mains potential. Neither of those outcomes favour failing safe. Even the best quality unheated wires carrying current don't last that long mechanically speaking. Add heat and the decay happens quicker.

Humans are pretty good at warming a cold bed. Sucks for the first ten minutes though.


Kinda click bait title. The project actually integrates the smart power plug to Alexa, which the electric blanket is powered from. The electric blanket is used without any changes to it.


That's a lot of work to avoid buying an electric blanket with a timer. I mean, it's cool and all, but I would hope the lessons learned were worth the effort.


yes, it’s quite unreasonable.

“The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.”


Electric blankets don't have timers to turn on. My understanding is that UL won't certify them as it's a perceived fire hazard.


"perceived"? It is a fire hazard.


But how? To me it sounds like a safety feature.


Funny, I owned one. Would still use it if our dog hadn't eaten the coils.

Most electric blankets have overheat protections built into them these days, reducing the risk of fire hazards.

Aaand after some research I don't see it available anymore on Amazon or elsewhere. Interesting.


> That's a lot of work to avoid buying an electric blanket with a timer. I mean, it's cool and all, but I would hope the lessons learned were worth the effort.

Totally agree with you. I guess it is rewarding to make this kind of work with success, moreover if, at the end, it costs less than the original one. I hope the skils u've learnt will be reused in another project, maybe more "elaborated".


Why buy when you can build? :-)

But, more seriously, I don't go to bed at the same time every night. I'd be surprised if most people do. I want to pre-heat the bed while I'm on the bus home from a night out.


The really useful blanket would know exactly when you going to go to the bed every time (analyzing the data from your smartwatch and other gadgets) and prepare accordingly. That's what 'smart things' are about, but that requires slightly more work than coupling the off-the-shelf voice recognition engine with thermostat.


That's impossible. Look at the Nest thermostat - trying to learn when people will be home. It doesn't work beccause most people live messy, noisy lives.

Even I don't know when I'm going to bed until just before I do so. I might go upstairs to brush my teeth, but then go back down to play more video games.

I might go into the bedroom to pick up a book - doesn't mean I'm going to sleep.

The idea of predictive analysis of human behaviour is almost nonsense. Even if it weren't, a quick shout to a robot, or a tap on a button, is quicker and cheaper.


The fact Amazon cannot be more stupid with its' recommended goods than it is doesn't set the fact you just cannot predict someone would want to buy laser printer cartridge in a month or so after he bought the printer.

You will be surprised how repetitive your patterns (like pulse, for example) are and how well they predict will you decide to play the game or to go to the bed. Maybe you just don't analyze these patterns thoroughly enough, so you have an illusion of unpredictability of your decisions.

And by the way, smart things aren't there to only predict. If your blanket, and all other devices - including your todo list app - would vote for the bed, especially if they formulate it with carefully crafted suggestive words in sweet voice, you better agree.


Not OP but ... If you turn off the downstairs lights && go upstairs && it's after $time ... ?

That would work mostly for me, perhaps including the TV and computer being off. That's going to cover 99% accuracy, probably as much as I'd get with a button.


The smart blanket would predict it much earlier, to have the time to warm it up.


I am not sure I understand the benefit of predicting it that early. My electric blanket needs only a few seconds to heat up


I haven't set the temperature on my nest thermostats in over a year.


i don't understand why anybody, especially a person with technical knowledge, would purchase and install a device that constantly listens to its surroundings and uploads conversations to the internet

it's scary what a third party can do through your smartphone, let alone all the IoT garbage connected to an Echo


Funny idea, but I still didn't see any reasonable use-case for Alexa.


I didn't either until I tried a few things; got a cube for streaming and it was obviously built-in. With a couple of power controllers ($10) it turned into a few practical things. First, I immediately changed that "Alexa" command into "computer."

"Computer, lights" - turns on lamps behind the couch. Better than craning my neck and struggling to find that cheap push-pin switch on a scary fragile glass lamp x 2.

"Computer, pause" - when my hands are coated in layers of an escaped burrito and I need few more ice cream scoops of congealed vegetables and cheese in my maw.

"Computer, set timer for 20 minutes" - for the bread baking, because I already used both microwave and oven timers for rice and vegetables.

"Computer, convert 1 liter to cups" - because imperial units and surprise recipe.

"Computer, switch inputs" - when I want to watch cable. Of course, I have to say it four times rapidly because of an awkward Sharp TV.

This one is a bonus feature, but I can say "computer" with a fake British accent and it still works.


You can also set multiple timers on the Echo by giving them names.

"Computer, set a 20 minute timer for rice"

"Computer, set a 10 minute timer for vegetables"

Then you can query it:

"Computer, how much time is left on my rice timer?"


That's better than my hamfisted example, or use. Though I did forget couple of other really useful features.

"Computer, add nitrile gloves to shopping list."

(Shopping list goes to a phone app, just a simple list with checkmarks, not to be confused with purchasing something from Amazon.)


Seems like many small things that can make life easier.

I was always searching for the major killer feature, hehe.


I think that's a fair characterization. There's no single thing that I would be a huge problem if the Echo stopped working, but all of the little things together would add up to a major bummer.

For my family, one of the best features is the shopping list via the AnyList skill. We say "echo, add butter to my shopping list" and it gets added to the AnyList app in the correct category. Next time we are at the store, I pull up AnyList and can see my entire shopping list. For a single person, it might not be a big deal, but it's works very well for a family.


I'm looking for something similar where I can control the temp. (so it heats or cools) a blanket or pad


There's chili pad, although it's somewhat expensive.


What is it called?


It's not bad enough Alexa is in your home listening to everything you say? You need to be wrapped in an Alexa-powered blanket? Jesus, how much fucking closer to 1984 can we get? The only difference is we WELCOME these devices into our home, there's not even some totalitarian regime forcing it on us. All so we can get the weather with a voice command (as if looking out the god damn window or flicking on a light switch is some horrible ordeal).

What's next, Alexa-powered ASMR...get lulled to sleep as an AI-generated voice whispers to you all the holiday deals you'll have waiting for you when you wake up? I wonder what else it will whisper once you're fast asleep.

If you must have the convenience, at least ditch the cloud and run your smart home entirely on your LAN.


Please don't post predictable/indignant rants about someone's whimsical side project. That's against the spirit of this site, despite how you and I dare say most people here feel about IoT and privacy.

https://news.ycombinator.com/newsguidelines.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: