Jump to content

Insteon PLM Ruby Code 756: Difference between revisions

From LinuxMCE
Ddamron (talk | contribs)
No edit summary
 
Ddamron (talk | contribs)
No edit summary
Line 1: Line 1:
<pre>
<pre>#### Written by Dan Damron
#### Written by Dan Damron
#### #756 Report Child Devices ####
#### #756 Report Child Devices ####


Line 10: Line 9:
#with params_:
#with params_:
#12 Error Message (string)
#12 Error Message (string)
# if this is not empty, that means an error occurred.
# if this is not empty, that means an error occurred.
#
#
#13 Text (string)
#13 Text (string)
# a list like this:
# a list like this:
# [internal id] \t
# [internal id] \t
# [description] \t
# [description] \t
# [room name] \t
# [room name] \t
# [device template] \t
# [device template] \t
# [floorplan id] \n
# [floorplan id] \n




Line 25: Line 24:




##lets try sending an event..
#cmd = Command.new(37,-1000,1, 2, 54)
#cmd.params_[13] = "0A.97.0B\tTestLamp\t\t38\t\n"
#log(cmd.params_[13])
#SendCommand(cmd)


@work = ""
@work = ""
$childdatabases.each_key{|insteonID|
$childdatabases.each_key{|insteonID|
  @work += insteonID + "\t"
  # figure out what type of device to add here..
  log('Child:' + insteonID)
  log('Config:' + $childdatabases[insteonID].inspect)
  case $childdatabases[insteonID][0][0..1].hex # Device Category
  when 0x00 # Generalized Controllers
    case $childdatabases[insteonID][0][2..3].hex
    when 0x00
    when 0x01
    when 0x02
    end
  when 0x01 # Dimmable Lighting Control
    case $childdatabases[insteonID][0][2..3].hex
    when 0x00; @work += 'LampLinc V2 [2456D3]'
    when 0x01; @work += 'SwitchLinc V2 Dimmer 600W [2476D]'
    when 0x02; @work += 'In-LineLinc Dimmer [2475D]'
    when 0x03; @work += 'Icon Switch Dimmer [2876D]'
    when 0x04; @work += 'SwitchLinc V2 Dimmer 1000W [2476DH]'
    when 0x06; @work += 'LampLinc 2-pin [2456D2]'
    when 0x07; @work += 'Icon LampLinc V2 2-pin [2456D2]'
    when 0x09; @work += 'KeypadLinc Dimmer [2486D]'
    when 0x0A; @work += 'Icon In-Wall Controller [2886D]'
    when 0x0D; @work += 'SocketLinc [2454D]'
    when 0x13; @work += 'Icon SwitchLinc Dimmer for Lixar/Bell Canada [2676D-B]'
    when 0x17; @work += 'ToggleLinc Dimmer [2466D]'
    end
    @work += "\t\t38" # set Template 38
  when 0x02 # Switched Lighting Control
    case $childdatabases[insteonID][0][2..3].hex
    when 0x09;  @work += 'ApplianceLinc [2456S3]'
    when 0x0A;  @work += 'SwitchLinc Relay [2476S]'
    when 0x0B;  @work += 'Icon On Off Switch [2876S]'
    when 0x0C;  @work += 'Icon Appliance Adapter [2856S3]'
    when 0x0D;  @work += 'ToggleLinc Relay [2466S]'
    when 0x0E;  @work += 'Switchlinc Relay Countdown Timer [2476ST]'
    when 0x10;  @work += 'In-LineLinc Relay [2475D]'
    when 0x13;  @work += 'Icon SwitchLinc Relay for Lixar/Bell Canada [2676R-B]'
    end
    @work += "\t\t37" # Set Template 37
  when 0x03 # Network Bridges
  when 0x04 # Irrigation Control
    @work += 'Simplehomenet EZRain1 Sprinkler Controller'
    @work += "\t\t1780" # Set Template 1780


  when 0x05 # Climate Control
# figure out what type of device to add here..
    case $childdatabases[insteonID][0][2..3].hex
log('Child:' + insteonID)
    when 0x00; @work += 'Broan SMSC080 Exhaust Fan'
log('Config:' + $childdatabases[insteonID].inspect)
    when 0x01; @work += 'Simplehomenet EZTherm'
@template = $devicetemplate[insteonID]
    when 0x02; @work += 'Broan SMSC110 Exhaust Fan'
    when 0x03; @work += 'Venstar RF Thermostat Module'
    when 0x04; @work += 'Simplehomenet EZStat Thermostat'
    end
    @work += "\t\t4" # Set Template 4
  when 0x06 # Pool and Spa Control
    @work += "\t\t" # Set Template Unknown
  when 0x07 # Sensors and Actuators
    @work += "\t\t" # Set Template Unknown
  when 0x08
    @work += "\t\t" # Set Template Unknown
  when 0x09
    @work += "\t\t" # Set Template Unknown
  when 0x0A
    @work += "\t\t" # Set Template Unknown
  when 0x0B
    @work += "\t\t" # Set Template Unknown
  when 0x0C
    @work += "\t\t" # Set Template Unknown
  when 0x0D
    @work += "\t\t" # Set Template Unknown
  when 0x0E
    @work += "\t\t" # Set Template Unknown
  when 0x0F
    @work += "\t\t" # Set Template Unknown
  when 0x10 # Security, Health, and Safety
    @work += "\t\t" # Set Template Unknown
  when 0x11 # Surveillance
    @work += "\t\t" # Set Template Unknown
  when 0x12 # Automotive
    @work += "\t\t" # Set Template Unknown
  when 0x13 # Pet care
    @work += "\t\t" # Set Template Unknown
  when 0x14 # Toys
    @work += "\t\t" # Set Template Unknown
  when 0x15 # Timekeeping
    @work += "\t\t" # Set Template Unknown
  when 0x16 # Holiday
    @work += "\t\t" # Set Template Unknown


@work += insteonID + "\t\t\t" + @template.to_s + "\t\n"


  end
  @work += "\t\n"


}
}

Revision as of 23:13, 11 March 2008

#### Written by Dan Damron
#### #756 Report Child Devices ####


#here is where I send all my newly discovered children..


#I need to fire an event [54]
#with params_:
#12 Error Message (string)
# if this is not empty, that means an error occurred.
#
#13 Text (string)
# a list like this:
# [internal id] \t
# [description] \t
# [room name] \t
# [device template] \t
# [floorplan id] \n


#First, Lets see if we actually 'get this command'
log($yellow+ '*#*#*#*#*#*#*#*# GOT #756 Report Child Devices! *#*#*#*#*#*#*#*#*'+ $grey)



@work = ""
$childdatabases.each_key{|insteonID|

# figure out what type of device to add here..
log('Child:' + insteonID)
log('Config:' + $childdatabases[insteonID].inspect)
@template = $devicetemplate[insteonID]

@work += insteonID + "\t\t\t" + @template.to_s + "\t\n"


}
log(@work)
cmd = Command.new(device_.devid_, -1000, 1, 2, 54)
cmd.params_[13] = @work
SendCommand(cmd)