Automatically Clear/Sync Hangouts Notifications Between Android and GChat

I have been plagued by this problems for months.  I frequently searched for a solution but found nothing until today.

The Problem

I am signed into hangouts on my Android phone and use Gchat (the chat client inside the web version of Gmail).  Throughout the day I use Gchat.  At the end of the day, when I look at my phone, there is a hangouts notification for the first message of each separate Gchat communication.  I have to manually clear the hangouts notifications on my phone, even though I have both seen and responded to the messages in Gchat.

The Solution

I can’t claim credit, but buried on this Google Groups page, I found the answer.  I have no idea why such an important solution is buried so deeply inside a groups post.

The solution in that post is hard to follow, what you want to do is “enable hangouts in gmail.”  Google does provide a nice instruction set for enabling hangouts in gmail.

The Results

It works!  When I get a new hangouts message, I get a notification on my phone and in Gmail.  If I click on or respond to that message in Gmail, the notification is cleared from my phone.

The only downside, is that the new interface for hangouts in Gmail is significantly different than the old Gchat interface.  It is too soon to say whether I think this is a good or bad thing.

Posted in Miscellaneous | Leave a comment

Surprise! CA Bar Doesn’t Takes Moral Character Applications Very Seriously

To be clear, I am being entirely sarcastic when I say “Surprise.”

I just received the Moral Character Questionnaire for a friend who is applying to take the California Bar Exam this summer.  By way of background, the Bar is required by statute to assess the moral fitness of Bar applicants.  They of course don’t want to admit any applicants that may further impugn the reputation of lawyers in California.

To that end, each applicant must submit an Application for Determination of Moral Character which costs a whopping $500.  The application asks the standard “have you ever been convicted of a felony” questions.  In addition each applicant is required to submit a handful of names of people who can attest to the applicant’s moral fitness.

Here comes the part where it becomes obvious that the Bar doesn’t put a whole lot of effort into this.  Below is a photo of the questionnaire I received along with the return envelope that was provided.

ca_bar_stamp

Note that the envelope requires postage.  Seriously?  Who has postage for snail mail anymore?  Beyond that, how many of these things does the Bar send out per applicant?  I can’t imagine that it exceeds ten.  Ten pre-paid envelopes would cost a whopping $5.00 or 1% of the application fee.  Given the lack of postage, I bet at least half of the people who receive these don’t even respond.

If that were not silly enough.  When I went to put the questionnaire into the provided envelope, I discovered another nugget of joy.  The damn questionnaire is too big for the provided envelope.

ca_bar_env

How many years have they been doing this?  Has the Bar not noticed the problem when they receive these envelopes returned back to them?  Maybe no questionnaires are ever returned, or maybe the Bar doesn’t read them.

The level of intellectual sophistication demonstrated by the Bar is mind blowing.  I sure hope they put more effort into their other endeavors.

Leave a comment

World Sunlight Map with Real Cloud Data and Accurate Seasons

earth For a long time I have used an image similar to this one as the background on my phone.  The image accurately represents the current cloud formations and sunlight regions on the planet.  I came up with the idea from the following page: http://www.die.net/earth/.  There is a good explanation on how to do this at http://www.die.net/earth/how.html, so I won’t repeat it here.

For a few years, I have used a Tasker profile on my Android phone to download a copy of this image once an hour.  Tasker then updated the background on my phone.  I find the image to be both beautiful and at least marginally functional.  Plus I enjoy the nerdiness of it.

A few months back I switched to a Nexus 4 and discovered that the image available from die.net was lower resolution that my phone.  This gave my the impetus to “roll my own” customized version.

I doing so I discovered the beautiful series of Blue Marble images that NASA has made available.  The The Blue Marble: Land Surface, Ocean Color and Sea Ice image was by far my favorite, but I noticed that NASA has since added monthly images that more accurately represent the snow pack and foliage for each month of the year.  Unfortunately, these images seem darker, and less vibrant than my favorite image.  Specifically, the greens and browns of the land masses looked very dull.  Additionally, the ocean was much more black and devoid of any character.

Luckily NASA aligns the images very precisely.  I first downloaded each monthly image and tweaked it in darktable.  I increased the exposure value to make them brighter, and increased the color saturation of the greens, browns and oranges.  The resulting images were much more vibrant.  Then to fix the ocean, I simply placed my favorite image into Gimp and overlayed the new images with a mask for the ocean over them.  The results were spectacular.

Then I simply added 12 different config files for xplanet and made 12 different cron jobs depending on the month.  Now I have my own custom World Sunlight Map with more accurate seasonal representation of the land mass.

Posted in Programming | Leave a comment

A Temperature Controlled Whole House Fan with MisterHouse

MisterHouse Web Interface for a Temperature Controlled Whole House FanThe main feature of MisterHouse that sets it apart from other home automation systems is the ability to customize practically every aspect of the system.  The following example is a perfect demonstration of this.

I recently purchased a whole house fan, basically a giant fan that sucks hot air out from the highest point in my house. They are great if you live in a climate with cool nights.

The controls for my fan were very basic, an on/off switch and a two-speed setting.

With Misterhouse, I created an “auto” mode which will only turn on the fan if both the indoor temperature is above a defined threshold and the outdoor temperature is 5 degrees below the indoor temperature.

This is how I did it.

Starting Materials
- A Fan
- 2 IOLincs, (1 for on/off, 1 for fan speed)
- A MisterHouse enabled indoor temperature sensor (I used my Insteon Thermostat)
- A MisterHouse enabled outdoor temperature sensor (I used data from a neighbor’s weather station through weatherunderground)

I created the following items in my mht file:

GENERIC, house_fan, HVAC|WHF_Group
GENERIC, house_fan_temp, HVAC|WHF_Group
GENERIC, house_fan_setpoint, HVAC|WHF_Group
GENERIC, house_fan_ambient, HVAC|WHF_Group
INSTEON_IOLINC, DE.AD.BE:01, whf_main, HVAC
INSTEON_IOLINC, DE.AD.BE:01, whf_speed, HVAC

I also had the following items already setup:

$upstairs_thermo_temp #the temperature upstairs
$w_temp #the outside temperature

First, I set the available states for my generic objects:

$house_fan->set_states('on', 'off', 'auto');
$house_fan_speed->set_states('high', 'low');
$house_fan_temp->set_states('cooler', 'warmer');

Then I tied my generic items to my Insteon Devices:

$house_fan->tie_event('$whf_main->set("on")', "on");
$house_fan->tie_event('$whf_main->set("off")', "off");
$house_fan_speed->tie_event('$whf_speed->set("on")', "high");
$house_fan_speed->tie_event('$whf_speed->set("off")', "low");

Then I tied my Generic temp item to my Generic setpoint item, and inserted some custom code:

$house_fan_temp->tie_event('house_fan_temp_change($state)');
sub house_fan_temp_change {
	my ($state) = @_;
	if ($state eq "warmer"){
		$house_fan_setpoint->set(int($house_fan_setpoint->state) + 1);
	} elsif ($state eq "cooler") {
		$house_fan_setpoint->set(int($house_fan_setpoint->state) - 1);
	}
}

By doing this, I can have a nice cooler and warmer button in the web panel.

Finally, every minute I check to see if the device is in “auto” mode and whether or not it should turn on:

if ($New_Minute){ 
	if($house_fan->state eq 'auto') {
		if (int($upstairs_thermo_temp->state) > int($house_fan_setpoint->state) &&
		(int($upstairs_thermo_temp->state) - 5) > int($w_temp->state)) {
			if ($whf_main->state eq 'off') {
				::print_log("[a1housefan.pl] Auto: Turning on fan");
				$whf_main->set("on");
			}
		} else {
			if ($whf_main->state eq 'on'){
				::print_log("[a1housefan.pl] Auto: Turning off fan");
				$whf_main->set("off");
			}
		}
	}
}

The result, is a temperature controlled whole house fan.  The image above is a screen shot from my web interface.

Posted in Home Automation, Programming | Leave a comment

Insteon RemoteLinc 2 Lacks the Heartbeat Feature?

A heartbeat is a simple broadcast packet sent at a predetermined interval.  The purpose of the packet is to announce to everyone that the device “is still alive.”

The Insteon RemoteLinc 2 is a battery powered insteon remote, that remains in a sleep state when it is not sending messages.  In this state the remote does not listen or respond to any packets sent to it.

As a battery operated device, the remotelinc will eventually need to be recharged, and it would be nice to know when a recharge is needed rather than finding out when the device doesn’t work.  The remotelinc has a command to query the battery level, but this query won’t work if the device is asleep.

This is where a heartbeat message would be nice.  It would automatically wake up the device at a periodic interval, allowing a battery level request to be sent to the device.

Best I can tell, the Remotelinc heartbeat function has been disabled or not included.  The following settings are supposed to control the hearbeat function:

Awake Interval Sets the amount of time the Remotelinc remains awake with no activity. This is editable
Sleep Interval Sets the amount of time the Remotelinc remains asleep, before waking up to send a heartbeat message. The device ACKs my changes, but the settings on the device don’t change.
Broadcast Number Sets the number of heartbeat messages that should be sent every time the sleep interval expires. The device ACKs my changes, but the settings on the device don’t change.
NoIAmAwake Bit A single bit to disable sending heart beat messages, presumably overrides all of the other settings. The device ACKs my changes, but the settings on the device don’t change.

Other users have reported similar problems over at the Indigo support forum.

As a work around, Misterhouse will send a battery level request immediately after receiving a message from the RemoteLinc.  The RemoteLinc will stay awake after sending a message for the amount of time specified in Awake Interval, I set mine to 10 seconds. Battery level requests will only be sent if the amount of time since the last battery level response has exceeded a defined threshold.

All of this works well, except for rarely used devices.  It is possible that such a remotelinc could die without there being a chance to query its battery level.

Posted in Home Automation | Leave a comment

Insteon All-Link Control Flags

For whatever reason it is difficult to locate the breakdown of the Insteon All-Link Control Flags.

Link Control Flags:
Bit 7: 1 = Record is in use, 0 = Record is available
Bit 6: 1 = Controller (Master) of Device ID, 0 = Responder to (Slave of) Device ID
Bit 5: 1 = ACK Required, 0 = No ACK Required (currently always set to 1)
Bit 4: Reserved
Bit 3: Reserved
Bit 2: Reserved
Bit 1: 1 = Record has been used before (‘high-water’ mark)
Bit 0: Unused

Posted in Home Automation | Leave a comment

Insteon All-Link Cleanup Failure Report Documentation Error

Insteon All Link Cleanup Failure ReportThe documentation for the Insteon PLM defines an All-Link Cleanup Failure Report as being 7 bytes long with the 3rd byte being a useless 0×01.

In fact, command 0×56 is actually only 6 bytes in length.  The 3rd byte listed in the documentation does not exist.

Posted in Home Automation | Leave a comment

PHP: Get date for nth occurrence of weekday

I looked quickly and did not see any code out there to determine the nth occurrence of a specific day of the week in a month.  For example Thanksgiving is the 4th Thursday in November.  So I designed the following

<?php
$year = 2012; 
//Pick your year
$interval = 4; 
//Week number, in this case the 4th week
$dayofweek = 4; 
//Day of week 0=Sun, 1=Mon. . .
$month = 11; 
//Month 1=Jan, 2=Feb

$firstday = jddayofweek(gregoriantojd($month, 1, $year), 0);
if($firstday <= $dayofweek){
  $date = (($interval * 7)-6) + ($dayofweek - $firstday);
}else{
  $date = (($interval * 7)-1) + (6 - $firstday);
}
echo date("n/j/Y", mktime(0, 0, 0, $month, $date, $year));
?>

It looks a little messy, but it works perfectly.

 

UPDATE:

So apparently as bad as this looks it works too:

Continue reading

Posted in Programming | Leave a comment

Integrating Google Talk with Roundcube

Sorry I don’t have much time at the moment to write up a whole entry about this, but I am very excited about this.

I am a big fan of roundcube but I have always wanted the ability to integrate some instant messaging into it.  Well google finally released a gtalk gadget that allows you to integrate gtalk/gchat into any page you want.  Although, google has done a very poor job of announcing this and I don’t think most people know about it.

Anyways, it is a very simple single line <iframe> code.  I just quickly added it to the roundcube template and made a few changes to the CSS code and it works perfectly.

Click the image above to see a larger screen shot.  I will write up the code for this later when I have some free time.

Posted in Programming | 1 Comment

How to Resurrect Procmail and Spamassassin on Dreamhost

Admittedly I have been very annoyed with Dreamhost since they announced that users would no longer be able to use procmail.

How to get procmail Back

After reading the most recent entry I realized that it is possible to still use both procmail and spamassassin.  However, this solution is not elegant.

Currently Dreamhost has a rudimentary Mail Filter system that is accessible by all mail users.  This system is due to be upgraded soon.  Dreamhost also allows regular shell users to access and run procmail as well as spamassassin.  In fact, shell users can install their own custom install of spamassassin.  Lastly, shell users can also receive email, although there is no imap or pop service for this mail.

Continue reading

Posted in Programming | 3 Comments