Harmony integration

From my other attempt here

Status Code 0 means hub is off
Status Code 1 means activity is starting
Status Code 2 means activity is started
Status Code 3 means hub is turning off

	harmonyClient.on('stateDigest', function(digest) {
		var statusCode = digest.activityStatus
		var currentlyOn = digest.runningActivityList
		var targetActivity = digest.activityId
		
		switch(String(statusCode)) {
			case '0': //Hub is off
				if(currentlyOn == '' && targetActivity == '-1') {
					console.log('- Hub is off')
				} else {
					console.log('- Activity ' + currentlyOn + ' is off')
					changeSwitch(currentlyOn, 'off')
				}
				break;
			case '1': //Activity is starting
				console.log('')
				console.log('Received state digest (' + new Date() + ')')
				console.log('- Activity is starting...')
				break;
			case '2': //Activity is started
				if(currentlyOn == targetActivity) {
					console.log('- Activity is started')
				} else {
					if(currentlyOn == '') {
						console.log('- Activity ' + targetActivity + ' is on')
						changeSwitch(targetActivity, 'on')
					}
					else {
						console.log('- Activity ' + targetActivity + ' is on')
						console.log('- Activity ' + currentlyOn + ' is off')	
						changeSwitch(targetActivity,'on')
					}
				}
				break;
			case '3': //Hub is turning off
				console.log('')
				console.log('Received state digest (' + new Date() + ')')
				console.log('- Hub is turning off...')
				break;
		}
	})