Skip to content

Commit

Permalink
Merge pull request #11 from kw123/master
Browse files Browse the repository at this point in the history
fixed "global name 'tUnits' is not defined" bug
  • Loading branch information
mbendiksen authored Sep 10, 2018
2 parents db36529 + 2a01f8e commit af6f5b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion RFXCOM.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>2.1.13</string>
<string>2.1.14</string>
<key>ServerApiVersion</key>
<string>2.0.0</string>
<key>IwsApiVersion</key>
Expand Down
16 changes: 11 additions & 5 deletions RFXCOM.indigoPlugin/Contents/Server Plugin/RFXTRX.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,7 @@ def handleRFXSensor(self,data):
subtype = ord(data[2])
sensor = ord(data[4])
svalue = (ord(data[5])*256)+ord(data[6])
tUnits = self.plugin.unitsTemperature
self.plugin.debugLog(u"RFXSensor %d with subtype %d and value %d" % (sensor,subtype,svalue))
self.plugin.debugLog(u"Data1: %s %s %s %s %s %s %s %s"% (ord(data[0]),ord(data[1]),ord(data[2]),ord(data[3]),ord(data[4]),ord(data[5]),ord(data[6]),ord(data[7 ])))
if sensor in self.devicesCopy.keys():
Expand Down Expand Up @@ -1517,16 +1518,18 @@ def showTemp(self, data):
batteryLevel = 100

self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"temperature", value = temp, decimalPlaces= self.plugin.digitsTemperature)
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"humidity", value=humid, decimalPlaces= 0)
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"humidityStatus", value=humidityStatus)
if "humidity" in self.devicesCopy[sensor].states:
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"humidity", value=humid, decimalPlaces= 0)
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"humidityStatus", value=humidityStatus)

self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"type", value=subtype)
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"batteryLevel", value=batteryLevel)
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"signalStrength", value=signalStrength)
#self._finalizeStatesChanges()

self.calcMinMax(sensor,"temperature", decimalPlaces=self.plugin.digitsTemperature)
self.calcMinMax(sensor,"humidity", decimalPlaces=0)
if "humidity" in self.devicesCopy[sensor].states:
self.calcMinMax(sensor,"humidity", decimalPlaces=0)

#self._finalizeStatesChanges()

Expand All @@ -1543,8 +1546,11 @@ def showTemp(self, data):
elif displayMode == "TempMinMax":
display = u"%s °%s (%s-%s)" % ( self.temperatureToString(temp), tUnits, self.temperatureToString(self._getCurrentSensorValue(self.devicesCopy[sensor],"mintemperature")), self.temperatureToString(self._getCurrentSensorValue(self.devicesCopy[sensor],"maxtemperature")))

if self.devicesCopy[sensor].pluginProps["sensorValueType"] == "Humid":
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"display", value=humid, decimalPlaces= 0, uiValue=display)
if "sensorValueType" in self.devicesCopy[sensor].pluginProps["sensorValueType"]:
if self.devicesCopy[sensor].pluginProps["sensorValueType"] == "Humid":
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"display", value=humid, decimalPlaces= 0, uiValue=display)
else: #Temperature
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"display", value=temp, decimalPlaces= tDigits, uiValue=display)
else: #Temperature
self._addToBatchStatesChange(self.devicesCopy[sensor], key=u"display", value=temp, decimalPlaces= tDigits, uiValue=display)

Expand Down
Binary file not shown.

0 comments on commit af6f5b4

Please sign in to comment.