it looks as if the plugin does:
1. loads the device at startup, stores the dev in self.tempList[sensor]
- Code: Select all
def deviceStart(self, dev):
if dev.deviceTypeId == u'Temperature':
sensor = int(dev.pluginProps['sensorNumber'])
self.plugin.debugLog(u"Adding sensor %s." % sensor)
if sensor not in self.tempList.keys():
self.tempList[sensor] = dev
, and does not refresh the states ..
2. then compares the new value to old dev.states["xx"] value with is not refreshed.
- Code: Select all
lastValue = self.tempList[sensor].states[stateName] ### this uses the not refreshed data dev.states["temperature"]
...
if (float(lastValue) > float(self.tempList[sensor].states[maxstateName])): # comparing to the to the not refreshed temp value in dev.states["minTempperature"]
self._addToBatchStatesChange(self.tempList[sensor], key=maxstateName, value=lastValue)
I believe this should fix it: refresh dev after write to states.
- Code: Select all
########################################
def _finalizeStatesChanges(self):
if len(self.batchStatesUpdate) == 0:
return
for devId in self.batchStatesUpdate:
dev = indigo.devices[devId]
dev.updateStatesOnServer(self.batchStatesUpdate[devId])
self.deviceStart(dev, force=True) ###added
self.batchStatesUpdate = {}
return
def deviceStart(self, dev, force=False):
if not force: self.plugin.debugLog(u"deviceStart called. Adding device %s, type: %s" % (dev.name,dev.deviceTypeId))
if dev.deviceTypeId == u'Doorbell':
sensor = int(dev.pluginProps['sensorNumber'])
if not force: self.plugin.debugLog(u"Adding sensor %s." % sensor)
if force:
del self.tempList[sensor]
dev = indigo.devices[dev.id]
if sensor not in self.tempList.keys():
self.tempList[sensor] = dev
....
thats my understanding..
Karl
here a patched version 2.0.8 --> 2.010
https://www.dropbox.com/s/aahtbkkai02eiiu/RFXCOM.indigoPlugin.zip?dl=1[EDIT] this is not a perfect solution.. the min/max will only be changed one cycle after the temp update . But it works.
fixing that would require to look up the current TEMP as dev.states["temperature"] has the previous value. But the next time temp gets updated and the min/ max condition hits it will update min/max. As this is only for the whole day, It should not be a big deal if it is updated 10 secs later.
also added min/max for yesterday temp and hum.