Cujo

I don’t like vacuuming, there I said it. The “swoosh swoosh” from a machine being pushed while it tries to suck dirt and whatever important object you drop on the floor, is not really my cup of tea. I can’t lift a sofa or bed to offer all the sacrificial “dirt” to ye vacuum cleaner. I hate including my poor back. as an added burnt offering. Also, I have to schedule this ritual. – that’s my rant.

I did a Carpe Diem.

My story starts, with a thing called a robotic vacuum cleaner. The most famous one out there is from iRobot – the Roomba. It’s that small round puck that vacuums and chases your cat. I read and watch a couple of you tube videos and  decided that I needed something like the Roomba.

  • I wanted a vacuum cleaner that cleans on a schedule I can set.
  • I needed it to tell me when it started its cleaning cycle and when it ended.
  • I want to control it from my phone.
  • It has to go where no man has ever gone before – underneath the Sofa and Bed.
  • Added bonus, if I can get stats from it and control it externally – An Application Program Interface I can use.

I did my research and chose the “Neato Botvac”.

Here are my reasons:

  • The “Neato Botvac” is not a round puck. It is shape like a wedge. So, cleaning a corner is not a problem. I have heard a lot of arguments saying that the round shape of the Roomba is not an issue when dealing with corners. I have yet to be convinced that you can fit a round peg on a square hole. The Roomba would be great in the Apple campus at Cupertino – no corners.
  • Next, the “Neato Botvac” follows a more intelligent cleaning algorithm. It goes around the edges, uses the edges as a boundary and then starts working inward. The Roomba on the other hand bounces back and forth from wall to wall, like an uncontrolled billiard ball. This bouncing back and forth would annoy my mother, God rest her soul.

Here’s a snippet of source code I wrote to extract info from the “Neato Botvac”, which I call using a CURL script that runs every hour.


<?php
/*
	neato botvac
	this is a php module that dumps 
	the status of a neato
*/

include_once("botvac/NeatoBotvacApi.php");
include_once("botvac/NeatoBotvacClient.php");
include_once("botvac/NeatoBotvacRobot.php");
define("EOL",  "\n");

function DumpArray($heading, $array)
{
	$i = 0;
	echo $heading . ': ' . EOL;
	foreach ($array as $key => $value)
	{
		echo ' ' . $key . ' [' . $value . '] ';
		if ($i % 3 == 2)
			echo EOL;
		$i++;
	}
	echo EOL;
}

function Dump($name, $_robot)
{
	$state = $_robot->getState();

	echo $name;
	echo EOL;
	echo ' state [' . $state['state'] . ']' . EOL;
	echo EOL;
	DumpArray("details", $state['details']);
	echo EOL;
	DumpArray("commands", $state['availableCommands']);
	echo EOL;
	echo "schedule:" . EOL;
	$schedule = $_robot->getSchedule();
		echo   '  mode    day     start' . EOL;
	foreach ($schedule['data']['events'] as $line)
	{
		printf('   %d           %d       %s', $line['mode'], $line['day'], 
			$line['startTime']);
		echo EOL;
	}
}

// Main()
$email = "you@me.com";
$password = "doremi";
$token = false; 

$client = new NeatoBotvacClient($token);
$robots = array();
$auth = $client->authorize($email, $password);
if ($auth)
{
	$result = $client->getRobots();
	if ($result = $client->getRobots())
	{
		foreach ($result["robots"] as $robot) 
		{
			$_robot = new NeatoBotvacRobot($robot["serial"], 
				$robot["secret_key"]);
			Dump($robot['name'], $_robot);	
			
			//print_r($_robot->getState());
			//print_r($_robot->getSchedule());
		}
	}
	
}

?>

A video of the Neato in action.

Btw, I named him Cujo – The Dog from Stephen King”

IMG_0133

My story ends with, If you hear a “swoosh swoosh” from my home and you know that I am not there. That’s Cujo making his rounds.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s