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
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 origDev.pluginId == self.pluginId: self.debugLog(u"Plugin device %s was updated" % origDev.name) if eps.isNewDevice(origDev, newDev): self.debugLog("New device '%s' detected, restarting device communication" % newDev.name) self.deviceStartComm (newDev) return # Re-cache the device and it's subdevices and states if eps.propsChanged (origDev, newDev): # Assume that the properties now allow the alarm to be a different day, including today, so set the alarm to today and validate it startTime = datetime.datetime.strptime (newDev.states["startTime"], "%Y-%m-%d %H:%M:%S") d = indigo.server.getTime() newStartTime = datetime.datetime.strptime(d.strftime("%Y-%m-%d") + startTime.strftime(" %H:%M:%S"), "%Y-%m-%d %H:%M:%S") # Write the new start time to the device, when startComm runs again it will re-validate it so this should be fine newDev.updateStateOnServer("startTime", newStartTime.strftime ("%Y-%m-%d %H:%M:%S")) 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 #indigo.server.log(unicode(changedStates)) X = 1 # placeholder return