4 ms·
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 b
by mike-cardwell 8y ago
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.
- snaky 8y agoCoupling it with the smart alarm, instead of defining wake time strict would be nice next step.
- mike-cardwell 8y agoThat 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.
- snaky 8y agoAnd 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.
- mike-cardwell 8y agoI'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 ;)
- snaky 8y agoI was talking about coupling it with the smart alarm - that requires getting the realtime data from the smartwatch.
- mike-cardwell 8y agoOh 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.
- michaelmior 8y ago1000x 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-assistant-alarms-get 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.
- edent 8y agoThat'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?
- mike-cardwell 8y agoIf 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.
- michaelmior 8y agoOne 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.
- pcdoodle 8y agoZ-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.