Insteon PLM Ruby Code 760

From LinuxMCE
Revision as of 01:25, 6 January 2008 by Ddamron (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
#### Written by Dan Damron
#### #760 Send Command to Child ####


@insteonID = id.chomp.split('.')
@parameters = parameters
@command = pk_command
@cmd = cmd

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
  param = {'Command' => 'SndIns',
    'Parameter1' => @insteonID[0],
    'Parameter2' => @insteonID[1],
    'Parameter3' => @insteonID[2],
    'Parameter4' => 'OF', # Flags
    'Parameter5' => '11', # Insteon SetLevel
    'Parameter6' => 'FF'} # FULL ON
  $cmdqueue << param
  SndIns()

when '193' #OFF
  param = {'Command' => 'SndIns',
    'Parameter1' => @insteonID[0], 
    'Parameter2' => @insteonID[1],
    'Parameter3' => @insteonID[2],
    'Parameter4' => '0F', 
    'Parameter5' => '13', #OFF
    'Parameter6' => '00'}
  $cmdqueue << param
  SndIns()


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