MessageDecoder.pm |
Insteon::MessageDecoder - Static class for decoding Insteon PLM messages
use Insteon::MessageDecoder; my $decodedMessage = Insteon::MessageDecoder::plm_decode($plm_string);
Insteon::MessageDecoder will decode Insteon PLM messages. Functions are provided to decode the PLM envelope, X10 commands, Insteon flags, and Insteon Cmd1/Cmd2 bytes. User data (D1-D14) of extended messages is not decoded but will be displayed.
use Insteon::MessageDecoder; my $plm_string; $plm_string = '02621f058c1f2e000100000000000000000000000000'; print( "PLM Message: $plm_string\n"); print( Insteon::MessageDecoder::plm_decode($plm_string)."\n"); $plm_string = '02511f058c1edc30112e000101000020201cfe3f0001000000'; print( "PLM Message: $plm_string\n"); print( Insteon::MessageDecoder::plm_decode($plm_string)."\n");
The message decoder is not perfect. It does not keep message state and several of the Insteon ACK message formats can "only" be decoded relative to the most recent command sent to the ACKing device. Some ACK messages will be incorrectly decoded as part of another Insteon message. For example in the ACK for a "Light Status Request", cmd1 is the ALDB serial number. This serial number will be interpreted as another Insteon message where the serial number matches the cmd1 value. Be aware of this and you should still be able to intrepret the decided messages.
Extended messages are not decoded and only display the D1-D14 hex data. You will need to manually decode the extended data. Patches for decoding one or more extended messages are welcome.
There are probably many bugs. The decoder was designed by transcribing Insteon documentation, Jonathan Dale's excellent command reference, and reviewing many message board discussions. The decoder has not been tested with all devices (of all firmware revs) or all PLM combinations (of all firmware revs). There are bugs; please report them in the misterhouse GitHub issues list.
Returns a string containing a decoded PLM data packet
Returns a string containing a decoded PLM X10 data packet
Returns a string containing decoded Insteon message flags
Returns a string containing a decoded Insteon message. Input string should be the Insteon message starting with the message flag byte.
You can find documentation for this module with the perldoc command.
perldoc Insteon::MessageDecoder
http://www.insteon.net/pdf/INSTEON_Command_Tables_20070925a.pdf
PLM command details can be found in the 2412S Developers Guide. This document is not supplied by SmartHome but may be available through an internet search.
Michael Stovenour
Copyright 2012 Michael Stovenour
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
MessageDecoder.pm |