def deviceUpdated(self, origDev, newDev): if self.cache is None: return if eps.isNewDevice(origDev, newDev): self.debugLog("New device '%s' detected, restarting device communication" % newDev.name) self.deviceStartComm (newDev) return if origDev.pluginId == self.pluginId: self.debugLog(u"Plugin device %s was updated" % origDev.name) # Re-cache the device and it's subdevices and states if eps.dictChanged (origDev, newDev): self.debugLog(u"Plugin device %s settings changed, rebuilding watched states" % origDev.name) self.cache.removeDevice (origDev.id) self.deviceStartComm (newDev) else: changedStates = self.cache.watchedStateChanged (origDev, newDev) if changedStates: self.debugLog(u"The monitored device %s had a watched state change" % origDev.name) for devId, stateChange in changedStates.iteritems(): dev = indigo.devices[devId] if dev.deviceTypeId == "sprinklerKeypad": if dev.pluginProps["device"] == str(newDev.id): dev.updateStateOnServer ("device1ZoneOn", indigo.server.getTime().strftime("%Y-%m-%d %H:%M:%S")) if dev.pluginProps["device2"] == str(newDev.id): dev.updateStateOnServer ("device2ZoneOn", indigo.server.getTime().strftime("%Y-%m-%d %H:%M:%S")) if dev.pluginProps["device3"] == str(newDev.id): dev.updateStateOnServer ("device3ZoneOn", indigo.server.getTime().strftime("%Y-%m-%d %H:%M:%S")) return
def deviceUpdated(self, origDev, newDev): if self.cache is None: return if eps.isNewDevice(origDev, newDev): self.debugLog("New device '%s' detected, restarting device communication" % newDev.name) self.deviceStartComm (newDev) return if origDev.pluginId == self.pluginId: self.debugLog(u"Plugin device %s was updated" % origDev.name) # Re-cache the device and it's subdevices and states if eps.dictChanged (origDev, newDev): self.debugLog(u"Plugin device %s settings changed, rebuilding watched states" % origDev.name) self.cache.removeDevice (origDev.id) self.deviceStartComm (newDev) else: changedStates = self.cache.watchedStateChanged (origDev, newDev) if changedStates: self.debugLog(u"The monitored device %s had a watched state change" % origDev.name) # Send parent device array and changed states array to function to disseminate for devId, stateAry in changedStates.iteritems(): if indigo.devices[devId].deviceTypeId == "epsdecon": epsdecon.updateDevice (devId, stateAry) return
def deviceUpdated(self, origDev, newDev): if self.cache is None: return try: if eps.isNewDevice(origDev, newDev): self.logger.debug("New device '%s' detected, restarting device communication" % newDev.name) self.deviceStartComm (newDev) return if origDev.pluginId == self.pluginId: self.logger.debug(u"Plugin device %s was updated" % origDev.name) # Re-cache the device and it's subdevices and states if eps.dictChanged (origDev, newDev): self.logger.debug(u"Plugin device %s settings changed, rebuilding watched states" % origDev.name) self.cache.removeDevice (origDev.id) self.deviceStartComm (newDev) # Collapse conditions if they got expanded self.cond.collapseAllConditions (newDev) else: changedStates = self.cache.watchedStateChanged (origDev, newDev) if changedStates: self.logger.debug(u"The monitored device %s had a watched state change" % origDev.name) # Send parent device array and changed states array to function to disseminate #self.logger.info(unicode(changedStates)) X = 1 # placeholder except Exception as e: eps.printException(e) return