diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..c62e51b --- /dev/null +++ b/LICENSE.txt @@ -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. diff --git a/Lutron RadioRA 2.indigoPlugin/Contents/Server Plugin/plugin.py b/Lutron RadioRA 2.indigoPlugin/Contents/Server Plugin/plugin.py index f263a26..7660a07 100644 --- a/Lutron RadioRA 2.indigoPlugin/Contents/Server Plugin/plugin.py +++ b/Lutron RadioRA 2.indigoPlugin/Contents/Server Plugin/plugin.py @@ -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") @@ -686,44 +687,60 @@ 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) @@ -731,52 +748,64 @@ def deviceStartComm(self, dev): 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") @@ -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: @@ -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") @@ -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] @@ -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") @@ -873,10 +919,14 @@ 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: @@ -884,7 +934,7 @@ def deviceStartComm(self, dev): 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") @@ -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") diff --git a/README.md b/README.md index a77c5b4..e940f34 100644 --- a/README.md +++ b/README.md @@ -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