The Learning Curve: Apple iPhone

I like to challenge myself when I can, and go a different direction with software or hardware than I’m used to. So this week, I broke from my decade-long Android trance and picked up an iPhone 7 Plus instead. Even Tina decided to make the switch. So we’re purely an iPhone family now.

As a former Android app developer, I felt just a bit more comfortable with an Android in my pocket, since I always had the option to code up anything that I need. However, it’s been years since I needed to write any code for Android, so I was inclined to try something new. It’s never good for an engineer to get complacent with their environment, so the switch sets the stage for another era of personal innovation for me.

So far, there have been a few trying moments while learning the differences, but it hasn’t been nearly as bad as I expected.

Pain Points

The biggest aggravation so far has been integrating the phones with Home Assistant‘s presence detection. I’ve been using the Nmap presence detection that’s built into HA, so I didn’t have install a third-party app on my phone. However, the iPhone’s visibility to HA is intermittent, at best. Of course, it’s possible that the iPhone is dropping from the WIFI network also. But that seems unlikely, given that I have multiple access points and a strong WIFI signal throughout my home. It’s a bit irritating for all the lights to go out while you’re cooking dinner, when both phones drop off of HA. I’ve had to temporarily disable some of HA’s automations until I can figure this out.

The fingerprint authentication method is a nice attempt at biometric security, but I have two issues. First, it doesn’t work many times for me. I inputted both of my thumbprints, and it fails to recognize either at times. Other times it works great, and it’s super convenient. My second issue – is it actually secure? I’ve been afraid to Google the answer, but one of these days I will.

Big Plusses

Wow, the camera. The multi-rear-facing-camera setup on the 7 Plus is impressive. The “live photos” are really rad also. But is it really the camera hardware that’s better, or is it the integration of software that works some post-processing magic on the images? I’m not convinced that software isn’t the culprit behind the remarkable images.

My previous Android, the Droid Turbo, was also an impressive machine. It never really glitched on me, the GPS worked perfect every time (contrary to my experiences with prior Samsung phones), and it was quite fast after fully booted. The iPhone, however, seems just a tad bit tighter in all those respects – just slightly, but I would definitely give it the edge.

I was initially concerned that there would be some software gaps, but every app I need has been ready and waiting for me on the app store. In fact, it seems like there is actually better app support on the iPhone, which surprised me.

AirPlay and AirDrop have proven much nicer, since I have all Apple hardware everywhere else. It casts nicely to my AppleTV and syncs quickly with my MacBook.

The Verdict

I can’t make assumptions about anyone else’s comfort levels or loyalties, and it’s too soon to tell what my long term opinion will be. However, at first glance, I say try it out if you’re thinking about switching. If you hate it, you’ll always have the opportunity to switch back in two years. And for the interim, it’s a totally usable phone.

Alexa + AWS Lambda Hello World in Javascript

Here is the Javascript version of my earlier tutorial Hello World in AWS Lambda + Amazon Alexa:

'use strict';

function buildResponsePayload( title, output, repromptText, shouldEndSession ) {
	return {
		outputSpeech: {
			type: 'PlainText',
			text: output
		},
		card: {
			type: 'Simple',
			title: 'alexaHelloWorld - ' + title,
			content: 'alexaHelloWorld - ' + output
		},
		reprompt: {
			outputSpeech: {
				type: 'PlainText',
				text: repromptText,
			},
		},
		shouldEndSession,
	};
}

function buildResponse( sessionAtts, speechResponse ) {
	return {
		version: '1.0',
		sessionAtts,
		response: speechResponse,
	};
}

function sayHelloWorld( callback ) {
	const sessionAtts = {};
	const cardTitle = 'alexaHelloWorld';
	const textOutput = 'Hello Javascript World';
	const shouldEndSession = false;

	callback( sessionAtts, buildResponsePayload( cardTitle, textOutput, textOutput, shouldEndSession ) );
}

exports.handler = ( event, context, callback ) => {
	try {
		sayHelloWorld( ( sessionAtts, speechResponse ) => {
			callback( null, buildResponse( sessionAtts, speechResponse ) );
		} );
	} catch( e ) {
		callback( e );
	}
};

Enjoy!

Alexa + AWS Lambda Hello World in Python

I recently began to fool around with integrating Amazon Alexa with my Home Assistant install in a custom manner. By default, you can set up an emulated Hue in the HA configuration which allows you to toggle lights, but I wanted to do more – which means I had to build my own custom Alexa skills.

It’s amazing to me, that after hours and hours of research, I was unable to find a single solid “Hello World” tutorial online. Sure, there are plenty of tutorials, but they’re all fairly complex, or contain loads of code or information that I didn’t need. When developing in unfamiliar territory, I usually like to start with a simple “Hello World”. Below is an AWS Lambda function that you can use to echo “Hello World” through your Alexa or Echo Dot.

from __future__ import print_function

def build_response_payload( title, output, reprompt_text, should_end_session ):
	return {
		'outputSpeech': {
			'type': 'PlainText',
			'text': output
		},
		'card': {
			'type': 'Simple',
			'title': "alexaHelloWorld - " + title,
			'content': "alexaHelloWorld - " + output
		},
		'reprompt': {
			'outputSpeech': {
				'type': 'PlainText',
				'text': reprompt_text
			}
		},
		'shouldEndSession': should_end_session
	}

def build_response( session_attributes, speechlet_response ):
	return {
		'version': '1.0',
		'sessionAttributes': session_attributes,
		'response': speechlet_response
	}

def say_hello_world():
	session_attributes = {}
	card_title = "Hello World"
	speech_output = "Hello World"
	should_end_session = True
	return build_response( session_attributes, build_response_payload( card_title, speech_output, speech_output, should_end_session ) )

def lambda_handler( event, context ):
	return say_hello_world()

Here are a few pointers to get you started on your journey:
– Paste this into the inline editor in new AWS Lambda function
– Select “Python 2.7” and set the handler to lambda_function.lambda_handler
– Create a custom role and use the default options
– Set up the Lambda function and the Alexa skill pretty much how every other tutorial on the web tells you to
– The “Test” button in AWS Lambda will report errors. You should instead test directly from Alexa Skills in the AWS Developer Console. This is a little bit unintuitive and I’m not sure why it is this way. But test attempts from Lambda DO fail every time for me. I’ll update if I figure out why.

Since I typically prefer JS over Python, I’m going to do up another Hello World tutorial in Lambda Node.js shortly, this is just what I happened to get working first. I hope you can make some use of it. Enjoy!

Cannon t3i

I had this vision of my upcoming trip to the Grand Canyon. In my vision, I was taking a photograph of Tina with my cell phone. Immediately after this thought crossed my mind, I went and bought a nice camera.

Sure, it’s not the professional platform that many of my friends work with, but it’s a step in the right direction. I figured this will give me something to learn with that doesn’t break the bank.

Here are a few shots from the past couple days.

On and Around [another] Island

Here are some photos and videos of my latest adventure in Kaua’i, HI, with the VaultPress/Jetpack team. Along with authoring some pretty rad software, we did some exploring, some eating, and some swimming.

Random photos from around the island:

Po’ipu Beach time lapse:

Snorkeling Po’ipu Beach:

Jeep’n’ on some of the hunting trails around the island:

Food photos:

Some 360 pics

Going Vegan-ish

Those that know me personally know that I have been fighting IBD for the better part of a decade. Inflammatory Bowel Disease, not to be confused with Irritable Bowel Syndrome, is defined as chronic inflammation of part (or all) of the digestive tract. It is primarily diagnosed as Crohn’s Disease or Ulcerative Colitis. It’s a nasty disease where the body’s immune system attacks the gastrointestinal tract, possibly targeting microbial antigens. It runs in families and seems to be triggered by something environmental.

Along with chronic abdominal pain that is, at times, completely debilitating, I’ve experienced a wide range of symptoms: anemia, extreme fatigue, rashes, arthritis, gall stones, lactose intolerance, and a few others that will remain unmentioned due to their graphic nature.

After multiple trips to the emergency room, primary care doctors, and gastroenterologists that have yielded an alarming lack of information, I have decided to treat myself to a dietary makeover.

In 2017, I’m going Vegan(-ish).

I know, I know – eating animals and animal products really are some of the finer things about living, I agree. I truly, truly hate to give them up. But after years of fighting a losing battle, and having tried most every other thing, I’m crossing my fingers that this helps provide a natural holistic solution to my medical problems.

So what do I mean by “Vegan-ish”? Well, I travel a lot. Sometimes to places without choices. And I’m okay with that – I will bite the bullet at times and eat what is served to me. I don’t have any political or conscience-related issues with eating animals. But when I’m at home, or when I do have a choice, I’m going to forego the meat, butter, and processed stuff as much as possible.

Today is day one. The only immediate difference I noticed is, well, I’m hungry. Fruits, vegetables, and grains don’t go very far in the calorie department, so feeling hungry is just something I’ll have to get used to. That’s probably a positive aspect anyways – I could afford to lose a few more pounds.

I’ll let you know how it goes as my journey progresses. Cheers!