Bug: RFX Temperature Sensors min and max are the same?

Posted on
Thu Mar 01, 2018 8:40 am
McJohn offline
User avatar
Posts: 339
Joined: Dec 18, 2012
Location: The Netherlands

Bug: RFX Temperature Sensors min and max are the same?

We think there is a bug in the min / max reporting of the RFX plugin (anyway for the Oregon and Cresta modules):
For example the current temperature is at this moment - 0.5 degrees C.
The min temperature in the RFX plugin says 7.4 degrees..
(beside this, we think it's not looking at a new day because today the temperature wasn't higher than -0.5 degrees....
Attachments
Screen Shot 2018-03-01 at 15.27.12.png
Screen Shot 2018-03-01 at 15.27.12.png (34.08 KiB) Viewed 239 times

Posted on
Fri Mar 02, 2018 2:53 pm
kw123 offline
User avatar
Posts: 5920
Joined: May 12, 2013
Location: Dallas, TX

Re: Bug: RFX Temperature Sensors min and max are the same?

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.

Posted on
Thu Mar 08, 2018 9:44 pm
matt (support) offline
Site Admin
User avatar
Posts: 18672
Joined: Jan 27, 2003
Location: Texas

Re: Bug: RFX Temperature Sensors min and max are the same?

A new version of the plugin is now available that includes the above mentioned improvements. Thanks Karl!

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests