Difference between revisions of "Insteon PLM Ruby Code 760"

From LinuxMCE
Jump to: navigation, search
m
Line 9: Line 9:
 
@command = pk_command
 
@command = pk_command
 
@cmd = cmd
 
@cmd = cmd
 +
childType =device_.childdevices_[cmdTo].devtemplid_ # find out device type
 +
$cmdParams = cmd.params_
  
 
log('#760:id=' + id.inspect)
 
log('#760:id=' + id.inspect)
Line 21: Line 23:
 
case pk_command
 
case pk_command
 
when '192' #ON
 
when '192' #ON
  param = {'Command' => 'SndIns',
+
if chiltType ==2209 then #used when Device is Thermostat
    'Parameter1' => @insteonID[0],
+
param = {'Command' => 'SndIns',
    'Parameter2' => @insteonID[1],
+
'Parameter1' => @insteonID[0],
    'Parameter3' => @insteonID[2],
+
'Parameter2' => @insteonID[1],
    'Parameter4' => 'OF', # Flags
+
'Parameter3' => @insteonID[2],
    'Parameter5' => '11', # Insteon SetLevel
+
'Parameter4' => 'OF', # Flags
    'Parameter6' => 'FF'} # FULL ON
+
'Parameter5' => '6B', # Insteon Thermostat Control
  $cmdqueue << param
+
'Parameter6' => '06'} # ON
  SndIns()
+
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
 
when '193' #OFF
  param = {'Command' => 'SndIns',
+
log("childtype:" +childtype.to_s)
    'Parameter1' => @insteonID[0],  
+
if childtype == 2209 then #used when Device is Thermostat
    'Parameter2' => @insteonID[1],
+
param = {'Command' => 'SndIns',
    'Parameter3' => @insteonID[2],
+
'Parameter1' => @insteonID[0],
    'Parameter4' => '0F',  
+
'Parameter2' => @insteonID[1],
    'Parameter5' => '13', #OFF
+
'Parameter3' => @insteonID[2],
    'Parameter6' => '00'}
+
'Parameter4' => '0F',
  $cmdqueue << param
+
'Parameter5' => '6B',
  SndIns()
+
'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 ''
 
when ''
  if parameters=='76'
+
if parameters=='76'
    #SetLevel 50%
+
#SetLevel 50%
    param = {'Command' => 'SndIns',
+
param = {'Command' => 'SndIns',
      'Parameter1' => @insteonID[0],
+
'Parameter1' => @insteonID[0],
      'Parameter2' => @insteonID[1],
+
'Parameter2' => @insteonID[1],
      'Parameter3' => @insteonID[2],
+
'Parameter3' => @insteonID[2],
      'Parameter4' => 'OF', # Flags
+
'Parameter4' => 'OF', # Flags
      'Parameter5' => '11', # Insteon SetLevel
+
'Parameter5' => '11', # Insteon SetLevel
      'Parameter6' => '76'} # 50%
+
'Parameter6' => '76'} # 50%
    $cmdqueue << param
+
$cmdqueue << param
    SndIns()
+
SndIns()
  end
+
 
end
 
end
 +
end
 +
 +
 
</pre>
 
</pre>

Revision as of 23:34, 24 February 2012

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