Jump to content

Insteon PLM Ruby Code 756: Difference between revisions

From LinuxMCE
Ddamron (talk | contribs)
No edit summary
 
RayBe (talk | contribs)
Added category: GSD
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<pre>
{{Versioninfo}}
#### Written by Dan Damron
[[category: Insteon]]
[[Category: GSD]]
<pre>#### Written by Dan Damron
#### #756 Report Child Devices ####
#### #756 Report Child Devices ####


Line 10: Line 12:
#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 31: Line 33:
#log(cmd.params_[13])
#log(cmd.params_[13])
#SendCommand(cmd)
#SendCommand(cmd)
@work = ""
@work = ""
$childdatabases.each_key{|insteonID|
$childdatabases.each_key{|insteonID|
  @work += insteonID + "\t"
@work += insteonID + "\t"
  # figure out what type of device to add here..
# figure out what type of device to add here..
  log('Child:' + insteonID)
log('Child:' + insteonID)
  log('Config:' + $childdatabases[insteonID].inspect)
log('Config:' + $childdatabases[insteonID].inspect)
  case $childdatabases[insteonID][0][0..1].hex # Device Category
case $childdatabases[insteonID][0][0..1].hex # Device Category
  when 0x00 # Generalized Controllers
when 0x00 # Generalized Controllers
    case $childdatabases[insteonID][0][2..3].hex
case $childdatabases[insteonID][0][2..3].hex
    when 0x00
when 0x00
    when 0x01
when 0x01
    when 0x02
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
end
  when 0x03 # Network Bridges
when 0x01 # Dimmable Lighting Control
  when 0x04 # Irrigation Control
case $childdatabases[insteonID][0][2..3].hex
    @work += 'Simplehomenet EZRain1 Sprinkler Controller'
when 0x00; @work += 'LampLinc V2 [2456D3]'
    @work += "\t\t1780" # Set Template 1780
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


  when 0x05 # Climate Control
@work += "\t\t37" # Set Template 37
    case $childdatabases[insteonID][0][2..3].hex
when 0x03 # Network Bridges
    when 0x00; @work += 'Broan SMSC080 Exhaust Fan'
case $childdatabases[insteonID][0][2..3].hex
    when 0x01; @work += 'Simplehomenet EZTherm'
when 0x10; @work += 'SmartLinc [2412N]'
    when 0x02; @work += 'Broan SMSC110 Exhaust Fan'
end
    when 0x03; @work += 'Venstar RF Thermostat Module'
when 0x04 # Irrigation Control
    when 0x04; @work += 'Simplehomenet EZStat Thermostat'
@work += 'Simplehomenet EZRain1 Sprinkler Controller'
    end
@work += "\t\t1780" # Set Template 1780
    @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


when 0x05 # Climate Control
case $childdatabases[insteonID][0][2..3].hex
when 0x00; @work += 'Broan SMSC080 Exhaust Fan'
when 0x01; @work += 'Simplehomenet EZTherm'
when 0x02; @work += 'Broan SMSC110 Exhaust Fan'
when 0x03
@work += 'Venstar RF Thermostat Module'
@work += "\t\t2198" # Set Template 2198
when 0x04; @work += 'Simplehomenet EZStat Thermostat'
end


  end
when 0x06 # Pool and Spa Control
  @work += "\t\n"
@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
 
 
end
@work += "\t\n"


}
}
Line 133: Line 139:
cmd.params_[13] = @work
cmd.params_[13] = @work
SendCommand(cmd)
SendCommand(cmd)
</pre>
</pre>

Latest revision as of 09:29, 3 July 2016

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
#### #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)


##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 = ""
$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
case $childdatabases[insteonID][0][2..3].hex
when 0x10; @work += 'SmartLinc [2412N]'
end
when 0x04 # Irrigation Control
@work += 'Simplehomenet EZRain1 Sprinkler Controller'
@work += "\t\t1780" # Set Template 1780

when 0x05 # Climate Control
case $childdatabases[insteonID][0][2..3].hex
when 0x00; @work += 'Broan SMSC080 Exhaust Fan'
when 0x01; @work += 'Simplehomenet EZTherm'
when 0x02; @work += 'Broan SMSC110 Exhaust Fan'
when 0x03
@work += 'Venstar RF Thermostat Module'
@work += "\t\t2198" # Set Template 2198
when 0x04; @work += 'Simplehomenet EZStat Thermostat'
end

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


end
@work += "\t\n"

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