Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
Fixed CCI naming and addresses
Moved CCO devices to Switches
Added menu checkbox for local file fetch (temp)
  • Loading branch information
FlyingDiver committed Mar 19, 2018
1 parent 8b4f909 commit 785644d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<Field id="create_unused_note" type="label" fontSize="small" fontColor="darkgray">
<Label>Checking this box will create buttons for all keypads/repeaters, even those not programmed.</Label>
</Field>
<Field id="separator1" type="separator" />
<Field id="use_local" type="checkbox" defaultValue="false">
<Label>Use local file (developer only):</Label>
</Field>
</ConfigUI>
</MenuItem>
</MenuItems>
29 changes: 16 additions & 13 deletions Lutron RadioRA 2.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,21 +1231,24 @@ def createAllDevices(self, valuesDict):
self.group_by = valuesDict["group_by"]
self.simulated = bool(valuesDict["simulated"])
self.create_unused = bool(valuesDict["create_unused"])
self.use_local = bool(valuesDict["use_local"])

self.logger.info(u"Creating Devices from repeater at %s, Grouping = %s, Simulated = %s, Create Unprogrammed = %s" % (self.pluginPrefs["ip_address"], self.group_by, self.simulated, self.create_unused))

login = 'http://' + self.pluginPrefs["ip_address"] + '/login?login=lutron&password=lutron'
fetch = 'http://' + self.pluginPrefs["ip_address"] + '/DbXmlInfo.xml'
if use_local:
tree = ET.parse('/Users/jkeenan/Projects/Indigo PlugIns/Lutron/DbXmlInfo.xml')
root = tree.getroot()
else:

self.logger.info(u"Creating Devices - starting data fetch...")

# s = requests.Session()
# r = s.get(login)
# r = s.get(fetch)
# root = ET.fromstring(r.text)
login = 'http://' + self.pluginPrefs["ip_address"] + '/login?login=lutron&password=lutron'
fetch = 'http://' + self.pluginPrefs["ip_address"] + '/DbXmlInfo.xml'

tree = ET.parse('/Users/jkeenan/Projects/Indigo PlugIns/Lutron/DbXmlInfo.xml')
root = tree.getroot()
self.logger.info(u"Creating Devices - starting data fetch...")

s = requests.Session()
r = s.get(login)
r = s.get(fetch)
root = ET.fromstring(r.text)

self.logger.info(u"Creating Devices fetch completed, parsing data...")

Expand Down Expand Up @@ -1362,8 +1365,8 @@ def createAllDevices(self, valuesDict):
self.createLutronDevice(RA_KEYPAD, name, address, props, room.attrib['Name'])

elif component.attrib['ComponentType'] == "CCI":
name = room.attrib['Name'] + " - CCI " + device.attrib['Name']
address = device.attrib['IntegrationID']
name = room.attrib['Name'] + " - CCI " + device.attrib['Name'] + " - Input " + component.attrib['ComponentNumber']
address = device.attrib['IntegrationID'] + "." + component.attrib['ComponentNumber']
props = { 'cciIntegrationID': device.attrib['IntegrationID'], 'component': component.attrib['ComponentNumber'], 'notes': "", "SupportsStatusRequest": "False" }
self.createLutronDevice(RA_CCI, name, address, props, room.attrib['Name'])

Expand Down Expand Up @@ -1419,7 +1422,7 @@ def createLutronDevice(self, devType, name, address, props, room, notes = None):
RA_FAN : "Lutron Fans",
RA_THERMO : "Lutron Thermostats",
RA_SENSOR : "Lutron Sensors",
RA_CCO : "Lutron Sensors",
RA_CCO : "Lutron Switches",
RA_CCI : "Lutron Sensors",
RA_SHADE : "Lutron Shades",
RA_PICO : "Lutron Keypad Buttons"
Expand Down

0 comments on commit 785644d

Please sign in to comment.