I am modifying the following code and I can not figure out how to get the template id for the child I am sending the command to. I added childtype, but I fear it is incorrect. I need the template id because the command to send it a little different from the default command.
#### 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
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 '193' #OFF
when childtype == 4 #used when Device is Thermostat
param = {'Command' => 'SndIns',
'Parameter1' => @insteonID[0],
'Parameter2' => @insteonID[1],
'Parameter3' => @insteonID[2],
'Parameter4' => '0F',
'Parameter5' => '6B',
'Parameter6' => '09'} #OFF
when childtype != 4 #used when Device not Thermostat
param = {'Command' => 'SndIns',
'Parameter1' => @insteonID[0],
'Parameter2' => @insteonID[1],
'Parameter3' => @insteonID[2],
'Parameter4' => '0F',
'Parameter5' => '13', #OFF
'Parameter6' => '00'}
$cmdqueue << param
SndIns()
Thanks.
-Gregg