Home Automation Project


For as long as I can remember, I’ve always thought the idea of having automated controls was pretty cool. This became especially pronounced after watching the Iron Man movies. The idea of have something like Jarvis in control things was really cool and I really wanted to create something like it.

In 2011, I started watching a guy on YouTube who had taken a MacMini and wrote a bunch of AppleScripts to create what he was calling Jarvis. He was sharing his ideas and features and for the first time I thought it might be possible to create such a thing without needing to spend a ton of money to buy it.

I originally borrowed his Library.scpt file and used many of it’s pre-defined functions in my code. This worked well until many of things it used were disconnected by their vendor, like Google Latitude, and Yahoo Weather’s API. I spent a long time writing AppleScript to do stuff like, answer questions using Wolfram Alpha and check my Calendar for events, which was cool. But it wasn’t “useful” to me as much as I wanted it to be. I stopped writing AppleScript somewhere around 2015 and the project sat idle for the next 5 years, occasionally I would poke at it.

Fast forward to 2019, when I started learning Python. I had known about Python for a long time but was hesitant to learn it because of the learning curve. My learning style is very different than other peoples, I learn by doing. My first foray into Python was a project for work, a utility that would read over files from one of our products and build a database of objects and cross-reference several data points (both dynamically and statically). After a year of working on that project, it had received many positive reviews and was adopted into a new product. Not bad for a first go, eh?

With this new found Python knowledge, it reignited the idea of “Jarvis”. Could I create such a thing with Python? There are so many videos on YouTube where people have created really simple single function “bots” and have called them “Jarvis”, stuff like, “Call me Dan” and the bot responds, “Hi, Dan”. Don’t get me wrong, if you’ve never written code before, that’s a big accomplishment. I wanted something much more advanced.

I started writing a bunch of different functions to do stuff like collect weather data and send tweets, which again were somewhat useful in the grand scheme of things. After sometime I decided I’d use those as parts of a bigger picture, and started focusing on what I needed/wanted this thing to do when done.

I knew it needed to:

  • Be aware of external temperature data
  • Be able to detect temperature data from multiple rooms in the house
  • Be able to adjust both the thermostat and the various dampers in the house to better balance temperature
  • Notify me of things like unusually high humidity in a room, or room temperature that will not adjust.
  • Automatically control lights (both internal and external), either by voice command or time of day.

Now, much of this is already possible with Google Assistant, Amazon Alexa or Siri, but I don’t want to be bound by what the limitations are for those. I want to be able to build in fail-overs for things. Like, if a room temperature won’t adjust, close all other dampers by some small percentage for a set time and turn the fan on, forcing more air into that room, and thus more air out of that room. I don’t know that I could have that kind of custom workflow with the others.

With all that being said, how will this work?
I’ve built a docker container that will run Python + Flask for the front-end. This way, I can have a TV with system data displayed, room temperatures, damper percentage, outdoor temperature, thermostat schedule and some other bits of data. Within this docker container will be several pieces, the first being a scheduler. The scheduler will automatically trigger several operations, like collecting all temperature data once an hour, or doing a systems check and sending me a push notification if somethings wrong.

Second, will be the vocal side, I haven’t yet decided how I want to go about communicating by voice, but there is code to handle that. I’ve thought about having a bluetooth that I wear, but that seems tedious. I’ll revisit that a bit more in the future.

Third, a Rest API. Why have a Rest API on this? Integrations. One of the things I thought about was the ability to have “outside” things integrate into my system. Things like purpose built Raspberry Pi’s that can either be collecting data or pulling data from the system and doing something. The primary purpose here is HVAC damper control. There will be a couple of Raspberry Pi’s around the house with equipment wired to dampers in our HVAC ducting, when the main system I’ve written needs to check temperatures in a room and adjust the damper, it will send a POST command to the appropriate Pi to adjust the damper, and the damper will make the change and return data points about damper position among other things. The main system can then note the change and it will now have in a database, the damper value.
Another piece to this is having this entire system on its own private network that is on battery backup.

Thanks for reading.. More to come.

-Dan

Farewell 2020…


2020 has gotten a pretty bad reputation. It’s the year the pandemic ruled the world and lockdowns occurred. However, something I think a lot of people don’t see is that, 2020 gave us the ability to grow closer to our family and learn to adapt and overcome. But many people won’t see it that way, they’ll see the negative side before they see the benefits. They’ll see that their ‘right’ to go into a restaurant and eat was taken away, or the their ‘right’ to be in a large group of people was taken away.

What’s interesting to me is everybody seems concerned with their ‘rights’ but not so much about ensuring the people around them are healthy and don’t die. They’d rather enjoy themselves than be safe.

I’m hopeful as we move into a new year, people become more open minded and see benefits before negativity.

Hello 2021. Let’s rock this thing!

Code Junkie


In the last year, I’ve spent a bit of time learning and building with Python. So much so, that I’ve actually written a fully fleshed out application for work that makes short work of what used to take a long time manually. I’ve been finding every excuse to write Python code. Video download/processing? Sure. Rewriting my Jarvis to use both Applescript and Python, why not? I’m getting there though. (more details here: https://drwalker.wordpress.com/2012/09/07/jarvis/)

Python is really a fun language to write with. I’ll post some more project information as time goes by.

Adding on to backup bash scripts


So, ages ago, I wrote up a couple of bash scripts that automated the backup process on a server. It’s all text based, so you’d have to be logged into a terminal or be ssh’d into the box.

Today, I got to thinking, I should give it a pretty web gui that makes the process easier and functions through a web gui.

It’s still really early in the through process, but I’m intrigued by the project and will start working on it soon.

Original Post: http://www.merval.org/2012/03/bash-scripts/

Github: https://github.com/merval/BackupScripts

Apple Wireless Keyboard [Review]


I bought this keyboard on Christmas Day 2013, off Amazon. It was delivered on January 2nd. Considering the Holidays, that’s pretty good. So, first thing I noticed with this keyboard is the size. It’s literally the same keyboard you get with a Macbook or Macbook Pro. I actually lined it up with my Macbook keyboard and it’s exactly the same.

The keyboard doesn’t weigh much either, Apple says it weighs in at 8 ounces. All of the weight is from the batteries (two AA batteries). But it very, very light. It also has these skid guards on the bottom of it, I’m not sure if they are suppose to prevent you from pushing it around when typing, but it doesn’t really do much other than keep the bottom of the keyboard from rubbing the desk.

Usability

With the keyboard only coming in at 12.8 x 1.4 x 7.3 inches in size, it’s pretty compact, and I have giant hands. I first came across this keyboard while working on a computer for a family friend. At first, I was taken back by how small the keyboard really is and how big my hands were compared to it. I had a bit of a hard time trying to figure out how to make my fingers work on such a small keyboard. But once I got the hang of it, it actually felt pretty nice.

The idea of taking a keyboard from a Macbook and making it into a bluetooth keyboard is pretty ingenious. The only thing I miss from the old Windows keyboard I used prior to this, is the 10 key.

This keyboard has all the buttons the Macbooks have, including controls for iTunes and screen brightness (need to have a compatible monitor).

The best part about this keyboard is that when I got it, I put batteries in and started using it. That was on January 2nd. Today is May 28th, and I just switched out the batteries. I use the computer, A LOT. So for the batteries to last nearly five months, is staggering. Well done Apple.

Cons

I’ve been ranting and raving about this keyboard for long enough… Now for the things that bug me.

I don’t use Caps Lock very often so, I didn’t catch this right away, but the button doesn’t seem to notice it’s being pressed, I sometimes have to press it two or three times before the light kicks on showing Caps Lock is one.

When I type, I don’t think of myself as one of those people who is smacking the keyboard as hard as they can. But with this keyboard, for some reason, as I type it makes this vibration sound, as if the alignment is off, just a hair. The area below the spacebar tends to have a little room that bounces off my desk as I type and makes this terrible sound. But, I usually have headphones on and don’t hear it.

I would love to be able to sync the keyboard with multiple devices, and have the power button act as switch between devices, but instead, I have to either completely disconnect the bluetooth on one device or have the device forget the keyboard to switch to another one.

 

All in all, I have really enjoyed this keyboard. The nice part is, where I work, we use Windows 7 and going from this keyboard to a Windows keyboard, isn’t as difficult as I thought it was going to be. Seeing as with OS X you have several keyboard shortcuts that don’t mesh up with Windows keyboards. But on a subconscious level, because the keyboards are so different, when I sit down at my desk at work, I don’t even miss a beat.

So, with the few cons I have, I’m giving this keyboard a 9.6 out of 10 stars.