Insteon PLM Ruby Code 760

From LinuxMCE
Revision as of 23:34, 24 February 2012 by Trippleg (Talk | contribs)

Jump to: navigation, search
Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information
#### Written by Dan Damron
#### #760 Send Command to Child ####


@insteonID = id.chomp.split('.')
@parameters = parameters
@command = pk_command
@cmd = cmd
childType =device_.childdevices_[cmdTo].devtemplid_ # find out device type
$cmdParams = cmd.params_

log('#760:id=' + id.inspect)
log('#760:parameters=' + parameters.inspect)
log('#760:pk_command=' + pk_command.inspect)
log('#760:cmd=' + cmd.inspect)
### ok, I get the insteonID in @insteonID
# pk_command has one of THREE values, 192, 193, or NOTHING
# when I click 50%, I get in parameters: 76
# but NOTHING in pk_command.

case pk_command
when '192' #ON
if chiltType ==2209 then #used when Device is Thermostat
param = {'Command' => 'SndIns',
'Parameter1' => @insteonID[0],
'Parameter2' => @insteonID[1],
'Parameter3' => @insteonID[2],
'Parameter4' => 'OF', # Flags
'Parameter5' => '6B', # Insteon Thermostat Control
'Parameter6' => '06'} # ON
else
param = {'Command' => 'SndIns',
'Parameter1' => @insteonID[0],
'Parameter2' => @insteonID[1],
'Parameter3' => @insteonID[2],
'Parameter4' => 'OF', # Flags
'Parameter5' => '11', # Insteon SetLevel
'Parameter6' => 'FF'} # FULL ON
end
$cmdqueue << param
SndIns()

when '193' #OFF
log("childtype:" +childtype.to_s)
if childtype == 2209 then #used when Device is Thermostat
param = {'Command' => 'SndIns',
'Parameter1' => @insteonID[0],
'Parameter2' => @insteonID[1],
'Parameter3' => @insteonID[2],
'Parameter4' => '0F',
'Parameter5' => '6B',
'Parameter6' => '09'} #OFF
else #used when Device not Thermostat
param = {'Command' => 'SndIns',
'Parameter1' => @insteonID[0],
'Parameter2' => @insteonID[1],
'Parameter3' => @insteonID[2],
'Parameter4' => '0F',
'Parameter5' => '13', #OFF
'Parameter6' => '00'}
end
$cmdqueue << param
SndIns()

#when '280' # Heat/Cool/Auto
#log('Test Param:' +$cmdParams.to_s)
#case $cmdParams.to_s
#when '8H' # Heat Command
#param = {'Command' => 'SndIns',
#'Parameter1' => insteonID[0],
#'Parameter2' => insteonID[1],
#'Parameter3' => insteonID[2],
#'Parameter4' => '0F',
#'Parameter5' => '6B', # Indicates device is a Thermostat
#'Parameter6' => '04'} # sets to Heat Mode
#$cmdqueue << param
# SndIns()

#when '8C' # Cool Command
#param = {'Command' => 'SndIns',
#'Parameter1' => insteonID[0],
#'Parameter2' => insteonID[1],
#'Parameter3' => insteonID[2],
#'Parameter4' => '0F',
#'Parameter5' => '6B',
#'Parameter6' => '05'} # Sets to Cool
#$cmdqueue << param
# SndIns()
#when '8A' # Auto Command
#param = {'Command' => 'SndIns',
#'Parameter1' => insteonID[0],
#'Parameter2' => insteonID[1],
#'Parameter3' => insteonID[2],
#'Parameter4' => '0F',
#'Parameter5' => '6B',
#'Parameter6' => '06'} # Sets to Auto
#$cmdqueue << param
#SndIns()


#end

when ''
if parameters=='76'
#SetLevel 50%
param = {'Command' => 'SndIns',
'Parameter1' => @insteonID[0],
'Parameter2' => @insteonID[1],
'Parameter3' => @insteonID[2],
'Parameter4' => 'OF', # Flags
'Parameter5' => '11', # Insteon SetLevel
'Parameter6' => '76'} # 50%
$cmdqueue << param
SndIns()
end
end