Saturday, May 28, 2016

So Much To Learn

As they say, so much to learn and not much time. This is just a short list of things I want to learn: - Better JavaScript. I'm reading Learning JavaScript Design Patterns. Our HA GUI is a homebrew AJAX app and I'm trying to clean up the JavaScript portion that started almost 9 years ago!
- Node.js - Our HA GUI uses PHP and I've thought about migrating that portion to Node. It would be nice to code in the same language for server side as client side.
- Natural Language Parsing (NLP) - I have done some work with Python & NLTK but didn't make much progress. Google has released their NLP, SyntaxNet that looks interesting.
- Android development - Hard to believe I haven't written a single Android app. Java isn't my thing. Some day.

I've also been optimizing my usage of MySQL. I noticed my queries from various apps and web GUIs caused a lot of disk I/O. I've actually been able to cut it down about 10x by restructuring queries and also restructuring tables. My server is considerably quieter with less disk activity.

Sunday, May 8, 2016

Jawbone Up Move vs Misfit Flash Activity Trackers

A few months ago, I picked up a Jawbone Up Move activity tracker, mainly to see how much I run during my weekly basketball games. I'm not a fan of the wrist trackers and I figure they'd get in the way when I'm playing basketball.

What good is a tracker if all the data is trapped in the app? Jawbone has an API and I found this Python wrapper to facilitate access to the API. I was able to extract the hourly activity data, load it into my MySQL database and generate my own graphs:

This chart compares my current day's cumulative step count to the average for Sundays. Since I usually do the same activities on certain days, I'm able to see how I'm doing step-wise for today (and potentially adjust my activity level if I'm watching too much basketball or writing too much Python).

After about 2.5 months of use, my Jawbone was dislodged from my waistband during a game of basketball, fell off somewhere and is unfortunately gone forever. I wasn't completely thrilled with it, so I opted for a different tracker as a replacement - the Misfit Flash. I found a Python wrapper for the Misfit got it up & running. It's been about 5 days, but that's enough time for me to decide it's time to switch back to Jawbone.

What are the key differences between the Up Move and the Flash?
- The Up Move clasp is rubber coated and feels durable. The Flash clasp is hard plastic with hard edges and feels like it could snap in half.
- Jawbone data is hourly when downloaded through the API. The Misfit API only gives daily data.
- Up Move activity tracking is much more accurate than the Flash. When we play basketball, we may play a game for 15 minutes then take a few minutes break before the next game and this goes on for a couple hours. Up Move accurately calls the 2 hour duration one activity. The Flash thinks it's 6 or 7 short activities, unless I manually tag the activity start and end with a double press.
- Up Move doesn't automatically detect sleep and waking up (requires a press & hold to change mode). Flash supposedly does, but so far it's not so hot on sleep detection. The lazy hours of watching TV on the sofa before bed are included as part of my sleep even though I do get up and about for about 30 minutes before I actually climb into bed. It does detect waking up OK.
- Up Move is bulkier and ugly. I tucked the nicer looking Flash into my sock when I played basketball to avoid losing it. The Up Move probably won't be as comfortable in my sock.
- Flash is waterproof but the Up Move is only splash resistant.
- Jawbone syncs in the background whenever my phone wakes up (usually. had occasional issues with it not syncing). Misfit annoyingly requires you to push the sync button in their app. Misfit has background syncing for iPhone but not for their 2nd class Android users.
- Misfit offers a sleep SDK to enable automation when sleeping or waking but it lamely only works on iOS. There is also a notification API that allows you to get real time notifications based on your activity...I think...but I haven't seen a single notification and it's useless to me since there's no background sync on Android. So these potential pluses are of no value to me.
- The Flash can be used as a trusted device to unlock your Android phone. The Up Move can't.
- The Flash, through the Misfit Link app, can perform operations on double or triple presses, like being a selfie shutter or doing some IFTTT action. Not so for the Up Move.

Overall, the Up Move's more accurate activity tracking and better syncing are the most important features to me. The automation feature of the Misfit Link app is nice as is the Flash's bluetooth trusted device feature, but less important. Looks like the Misfit Flash is getting returned and I'm going to have to buy another Jawbone Up Move.

Thursday, May 5, 2016

Free SSL Certificate

I've been running my own public webserver since about 2000, but I've never gave much thought to setting up SSL and getting a proper certificate to encrypt the content from my site. Earlier this week, I did do just that thanks to Let's Encrypt. They offer free certificates and provides some command line tools that help generate them for you & register them with their certificate authority. It was really easy and the steps are clearly documented here. Now I'll just have to remember to renew in 90 days, although it looks like they have scripts that can automate this process.

Wednesday, May 4, 2016

Updating to Windows 10

I've always been slow to update to a new OS, mainly because stuff inevitably becomes broken especially since I write my own programs. Moving my HA server from XP to Windows 7 was painful for my .NET apps, so migrating from 7 to 10 wasn't high on my priority list. I haven't written many things in .NET lately due to problems I encountered migrating 7 or various Windows updates. Instead, I've been writing a bunch of Python scripts and running them on Raspberry Pis.

I started upgrading my kids' laptops to Windows 10. This was easy. I make them use Linux and they barely use Windows so I did clean installs for them. However, for my servers, I wanted to just do an upgrade and pray everything works. I started with the media server. I cloned the boot drive to a new SSD, stashed the original & then installed Windows 10. Surprisingly, everything worked. The big project will be doing the same for the HA server, but I'm not ready for that yet. Maybe as we get closer to the end date for the free Windows 10 upgrade, I'll feel more urgency. Until then, I'm happily surprised by how smoothly the media server upgrade went.

Tuesday, May 3, 2016

I'm back

Yes, it's been a while since I've updated here. We sold our house last year and it took a good month to strip out all vestiges of home automation. Nothing was left except dual Cat-5 to every room homerun back to a patch panel in the office closet. In the meantime, we're in a rental in one of the most overheated markets in Silicon Valley, waiting for things to cool off a bit (so far it's not!) This limits what automation I can do, but when you're used to living in an automated house, anything less seems like the stone age. We're relying a lot more on wifi than before when everything at our old house was hardwired. I did drag Cat-5 along the baseboards to link the living room, office and master with GigE, and I also got a few things up and running pretty quickly: - HA and media server were brought back up. - Installed a couple outdoor IP cameras and recording is handled by Blue Iris (Avermedia NV3000 has been retired). - Squeezeboxes are back online - A couple Infocasts were brought back up helping with zoned TTS announcements - Only ZWave is being used - only modules, no switches - and no UPB or X10 as I don't want to deal with powerline signal issues - 1Wire serial adapter for with a couple sensors attached - Humidity, pressure and light level sensing is online via Arduinos - Bluetooth presence and RFID are online - X10 wireless motion and DS10A's are online via the W800 - Installed a temporary outdoor antenna and SageTV is running - Some current sensing is running on most AV equipment - the usual xPL apps for GMail, GCal, noise sensing, gamepad contact closure - Voice and IM interfaces I've added a few new things: - the obvious one is Blue Iris (BI) because the Avermedia software I had couldn't handle more than 1 IP cam - xPL interface to BI JSON interface - added MQTT to my automation engine - converted BI interface to MQTT instead of xPL - converted Arduino script from xPL to MQTT - HDMI-CEC control via Raspberry Pi & Python A few things I miss: - IR control - VOIP intercom - Power monitoring I've been playing around with some cloud API devices and doing other random things I'll hopefully get around to mentioning in later posts.