Skip to content

Commit

Permalink
Fixes for missing Room property
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingDiver committed Jun 22, 2022
1 parent a7da844 commit 962312a
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 36 deletions.
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
108 changes: 79 additions & 29 deletions Lutron RadioRA 2.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@ def deviceStartComm(self, dev):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_REPEATER])
self.remove_plugin_property(dev, PROP_REPEATER)
self.logger.info(f"{dev.name}: Updated repeater property to IntegrationID")
elif dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:

elif not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, "1")
self.logger.info(f"{dev.name}: Added IntegrationID property")

Expand All @@ -686,97 +687,125 @@ def deviceStartComm(self, dev):
self.remove_plugin_property(dev, PROP_BUTTON)
self.logger.info(f"{dev.name}: Updated button property to componentID")

if dev.pluginProps.get(PROP_ISBUTTON, None) == None:
if not dev.pluginProps.get(PROP_ISBUTTON, None):
self.update_plugin_property(dev, PROP_ISBUTTON, "True")
self.logger.info(f"{dev.name}: Added isButton property")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}.{dev.pluginProps[PROP_COMPONENT_ID]}"
self.phantomButtons[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_DIMMER:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_ZONE])
self.remove_plugin_property(dev, PROP_ZONE)
self.logger.info(f"{dev.name}: Updated zone property to IntegrationID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}"
self.dimmers[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_SHADE:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_SHADE])
self.remove_plugin_property(dev, PROP_SHADE)
self.logger.info(f"{dev.name}: Updated zone property to IntegrationID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}"
self.shades[address] = dev
dev.updateStateImageOnServer(indigo.kStateImageSel.NoImage)
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_SWITCH:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_SWITCH])
self.remove_plugin_property(dev, PROP_SWITCH)
self.logger.info(f"{dev.name}: Updated switch property to IntegrationID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}"
self.switches[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_FAN:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_FAN])
self.remove_plugin_property(dev, PROP_FAN)
self.logger.info(f"{dev.name}: Updated fan property to IntegrationID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}"
self.fans[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_THERMO:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_THERMO])
self.remove_plugin_property(dev, PROP_THERMO)
self.logger.info(f"{dev.name}: Updated thermo property to IntegrationID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}"
self.thermos[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_KEYPAD:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_KEYPAD])
self.remove_plugin_property(dev, PROP_KEYPAD)
self.logger.info(f"{dev.name}: Updated keypad property to IntegrationID")
Expand All @@ -786,14 +815,19 @@ def deviceStartComm(self, dev):
self.remove_plugin_property(dev, PROP_KEYPADBUT)
self.logger.info(f"{dev.name}: Updated keypadButton property to componentID")

if (dev.pluginProps.get(PROP_ISBUTTON, None) == None) and (int(dev.pluginProps[PROP_COMPONENT_ID]) < 80):
self.update_plugin_property(dev, PROP_ISBUTTON, new_value="True")
self.logger.info(f"{dev.name}: Added isButton property")
if not dev.pluginProps.get(PROP_ISBUTTON, None):
if (int(dev.pluginProps[PROP_COMPONENT_ID]) < 80):
self.update_plugin_property(dev, PROP_ISBUTTON, new_value="True")
self.logger.info(f"{dev.name}: Added isButton property")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}.{dev.pluginProps[PROP_COMPONENT_ID]}"
self.keypads[address] = dev.id
if int(dev.pluginProps[PROP_COMPONENT_ID]) > 80:
Expand All @@ -804,22 +838,26 @@ def deviceStartComm(self, dev):
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_SENSOR:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_SENSOR])
self.remove_plugin_property(dev, PROP_SENSOR)
self.logger.info(f"{dev.name}: Updated sensor property to IntegrationID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}"
self.sensors[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_CCI:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_CCI_INTEGRATION_ID])
self.remove_plugin_property(dev, PROP_CCI_INTEGRATION_ID)
self.logger.info(f"{dev.name}: Updated cciIntegrationID property to IntegrationID")
Expand All @@ -829,25 +867,33 @@ def deviceStartComm(self, dev):
self.remove_plugin_property(dev, PROP_COMPONENT)
self.logger.info(f"{dev.name}: Updated cciCompoment property to componentID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}.{dev.pluginProps[PROP_COMPONENT_ID]}"
self.ccis[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_CCO:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_CCO_INTEGRATION_ID])
self.remove_plugin_property(dev, PROP_CCO_INTEGRATION_ID)
self.logger.info(f"{dev.name}: Updated ccoIntegrationID property to IntegrationID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}"
self.ccos[address] = dev
ccoType = dev.pluginProps[PROP_CCO_TYPE]
Expand All @@ -859,12 +905,12 @@ def deviceStartComm(self, dev):
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_PICO:
if dev.pluginProps.get(PROP_INTEGRATION_ID, None) == None:
if not dev.pluginProps.get(PROP_INTEGRATION_ID, None):
self.update_plugin_property(dev, PROP_INTEGRATION_ID, dev.pluginProps[PROP_PICO_INTEGRATION_ID])
self.remove_plugin_property(dev, PROP_PICO_INTEGRATION_ID)
self.logger.info(f"{dev.name}: Updated picoIntegrationID property to IntegrationID")

if dev.pluginProps.get(PROP_ISBUTTON, None) == None:
if not dev.pluginProps.get(PROP_ISBUTTON, None):
self.update_plugin_property(dev, PROP_ISBUTTON, new_value="True")
self.logger.info(f"{dev.name}: Added isButton property")

Expand All @@ -873,18 +919,22 @@ def deviceStartComm(self, dev):
self.remove_plugin_property(dev, PROP_PICOBUTTON)
self.logger.info(f"{dev.name}: Updated keypadButton property to componentID")

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

if not dev.pluginProps.get(PROP_ROOM, None):
self.update_plugin_property(dev, PROP_ROOM, new_value="Unknown")
self.logger.info(f"{dev.name}: Added Room = 'Unknown' property")

address = f"{dev.pluginProps[PROP_GATEWAY]}:{dev.pluginProps[PROP_INTEGRATION_ID]}.{dev.pluginProps[PROP_COMPONENT_ID]}"
self.picos[address] = dev
if dev.address != address:
self.update_plugin_property(dev, "address", address)

elif dev.deviceTypeId == DEV_TIMECLOCKEVENT:

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

Expand All @@ -895,7 +945,7 @@ def deviceStartComm(self, dev):

elif dev.deviceTypeId == DEV_GROUP:

if dev.pluginProps.get(PROP_GATEWAY, None) == None:
if not dev.pluginProps.get(PROP_GATEWAY, None):
self.update_plugin_property(dev, PROP_GATEWAY, self.defaultGateway)
self.logger.info(f"{dev.name}: Added Gateway property")

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Lutron RadioRA 2 / Homeworks QS / Caséta Plugin
Indigo plugin for Lutron systems, including RadioRa 2 , RRa2 Select, Homeworks QS, and Caséta

| Requirement | | |
|------------------------|---------------------|---|
| Minimum Indigo Version | 2022.1 | |
| Python Library (API) | Official | |
| Requires Local Network | Optional | |
| Requires Internet | No | |
| Hardware Interface | Optional Serial | |
| Requirement | |
|------------------------|---------------------|
| Minimum Indigo Version | 2022.1 |
| Python Library (API) | Official |
| Requires Local Network | Optional |
| Requires Internet | No |
| Hardware Interface | Optional Serial |

## Requirements

Expand Down

0 comments on commit 962312a

Please sign in to comment.