Insteon RemoteLinc 2 Lacks the Heartbeat Feature?

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.

Insteon All-Link Control Flags

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

PHP: Get date for nth occurrence of weekday

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:

Read More Read More

Bug in BlackBerry Repeat Rule, MONTH_OF_YEAR Deincrements 1 Month

Bug in BlackBerry Repeat Rule, MONTH_OF_YEAR Deincrements 1 Month

I have noticed a bug in javax.microedition.pim.RepeatRule, when I tried to set a an event to repeat every second sunday of may I would get an event that repeated every second sunday of april. I determined that this was being caused by MONTH_OF_YEAR being deincremented by 1 month after the event was committed.

I worked around the problem by setting the value one month forward. However obviously, this does not work for december. I tried increasing the value of the MONTH_OF_YEAR setting, however java balks at any unknown value. Currently I am unable to set an event to occur on the second sunday in december. If anyone figures out a work around I would be greatful.

RIM has recognized that this is a bug, but who knows when the bug will be fixed. I attached a copy of the email I received from RIM:

Read More Read More