def deviceUpdated(self, origDev, newDev): if self.cache is None: return if newDev.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.propsChanged (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) #indigo.server.log(unicode(changedStates)) plug.updateChangedLCD (newDev, changedStates) changedStates = self.cache.watchedPropertyChanged (origDev, newDev) if changedStates: self.debugLog(u"The monitored device %s had a watched property change" % origDev.name) for devId, devProps in changedStates.iteritems(): dev = indigo.devices[devId] if dev.deviceTypeId == "epslcddt": self.dateTimeDeviceUpdate (dev, dev.lastChanged) return
def updateDeviceStates (self, parentDev, childDev = None): stateChanges = self.cache.deviceUpdate (parentDev) children = self.cache.getSubDevices (parentDev) for devId in children: childDev = indigo.devices[int(devId)] plug.updateChangedLCD (childDev, stateChanges) return