here the debug log.
Jun 27, 2014, 6:03:45 PM
RFXCOM Debug getConfiguration start
RFXCOM initializing communication on port /dev/cu.usbserial-08WCLA8J at speed 38400
RFXCOM Debug serial port opened
RFXCOM Debug send reset cmd: 13 0 0 0 0 0 0 0 0 0 0 0 0 0 (0D 00 00 00 00 00 00 00 00 00 00 00 00 00)
RFXCOM Debug PIC INIT IS: none
RFXCOM Debug send init cmd: 13 0 0 1 2 0 0 0 0 0 0 0 0 0 (0D 00 00 01 02 00 00 00 00 00 00 00 00 00)
RFXCOM Debug rcvd init reply: 13 1 0 0 2 82 66 0 0 32 1 1 0 0 (0D 01 00 00 02 52 42 00 00 20 01 01 00 00)
RFXCOM connected to RFXrec 433.92 MHz, firmware version 66
RFXCOM currently enabled receiver protocols: Oregon Scientific
RFXCOM enabling undecoded packet displaying
RFXCOM Debug send set mode cmd: 13 0 0 2 3 82 0 128 0 32 0 0 0 0 (0D 00 00 02 03 52 00 80 00 20 00 00 00 00)
RFXCOM Debug rcvd set mode reply: 13 1 0 1 3 82 66 128 0 32 1 1 0 0 (0D 01 00 01 03 52 42 80 00 20 01 01 00 00)
RFXCOM Debug processing: 16 86 2 2 63 0 0 0 0 20 0 18 0 0 0 0 89 (10 56 02 02 3F 00 00 00 00 14 00 12 00 00 00 00 59)
RFXCOM Debug Wind sensor 63 direction 0 avgSpeed 2.00 gust 1.80.
RFXCOM Debug Wind sensor 63 direction 0 avgSpeed 4.50 gust 4.00.
RFXCOM Debug Wind sensor 63 in list
RFXCOM Debug ++++++++++++++
RFXCOM Debug processing: 16 86 2 3 63 0 0 0 0 15 0 18 0 0 0 0 89 (10 56 02 03 3F 00 00 00 00 0F 00 12 00 00 00 00 59)
RFXCOM Debug Wind sensor 63 direction 0 avgSpeed 1.50 gust 1.80.
RFXCOM Debug Wind sensor 63 direction 0 avgSpeed 3.40 gust 4.00.
RFXCOM Debug Wind sensor 63 in list
RFXCOM Debug ++++++++++++++
RFXCOM Debug processing: 10 82 1 4 196 4 0 238 55 1 73 (0A 52 01 04 C4 04 00 EE 37 01 49)
RFXCOM Debug Temp sensor 1220 now 74.84 degrees and 55 humidity.
RFXCOM Debug Temp sensor 1220 in list
RFXCOM Debug UpdateMinMax state temperature value 74.8
RFXCOM Debug check if new day: last date 2014/06/27, new date 2014/06/27
is this a hardware or software problem?
it looks as if the data used are position 6 and 7 (starting at 0) : direction = (ord(data[6]) << + ord(data[7]) (bolded in the log file.
position 6 and 7 are always 0.
any advice appreciated
Karl
ps. it was an adventure to put this on top of the roof... and it is difficult to change..
the python code looks like:
- Code: Select all
def handleWind(self, data):
devicetype = ord(data[1])
subtype = ord(data[2])
sensor = (ord(data[5]) << 8) + ord(data[4])
direction = (ord(data[6]) << 8) + ord(data[7]) ####################<<<<<<< this where it gets calculated..
avgSpeed = float(((ord(data[8]) << 8) + ord(data[9]))) / 10
gust = float(((ord(data[10]) << 8) + ord(data[11]))) / 10
batteryAndSignalData = data[16]
batteryLevel = self.getBatteryLevel(batteryAndSignalData)
signalStrength = self.getSignalStrength(batteryAndSignalData)
temp = 0
chill = 0
#WIND 1-3 Temperature & wind chill not supported
#WIND 4 Temperature & wind chill are supported
if (subtype == 4):
temp = ord(data[13])
vFactor = 1
temp2 = ord(data[12])
if ord(data[12])>127:
temp2 = ord(data[12])-128
vFactor = -1
temp+=(temp2*256)
temp = temp*vFactor*0.1
chill = ord(data[15])
vFactor = 1
chill2 = ord(data[14])
if ord(data[14])>127:
chill2 = ord(data[14])-128
vFactor = -1
chill+=(chill2*256)
chill = chill*vFactor*0.1
self.plugin.debugLog(u"Wind sensor %d direction %d avgSpeed %.2f gust %.2f." % (sensor, direction, avgSpeed, gust))
avgSpeed = self.convertWindspeedToUnits(avgSpeed)
gust = self.convertWindspeedToUnits(gust)
self.plugin.debugLog(u"Wind sensor %d direction %d avgSpeed %.2f gust %.2f." % (sensor, direction, avgSpeed, gust))
if sensor in self.tempList.keys():
self.plugin.debugLog(u"Wind sensor %d in list" % sensor)
self.tempList[sensor].updateStateOnServer(key=u"avgSpeed", value=avgSpeed)
self.tempList[sensor].updateStateOnServer(key=u"gust", value=gust)
self.tempList[sensor].updateStateOnServer(key=u"directionDegrees", value=direction)
self.tempList[sensor].updateStateOnServer(key=u"directionText", value=self.convertDirectionDegreesToText(direction))
if (subtype == 4):
self.tempList[sensor].updateStateOnServer(key=u"temperature", value=self.convertTemperatureToUnit(temp))
self.tempList[sensor].updateStateOnServer(key=u"windChill", value=self.convertTemperatureToUnit(chill))
self.tempList[sensor].updateStateOnServer(key=u"type", value=subtype)
self.tempList[sensor].updateStateOnServer(key=u"lastUpdated", value=time.strftime('%Y/%m/%d %H:%M:%S'))
self.tempList[sensor].updateStateOnServer(key=u"batteryLevel", value=batteryLevel)
self.tempList[sensor].updateStateOnServer(key=u"signalStrength", value=signalStrength)
display = "--"
displayMode = self.tempList[sensor].pluginProps["displayField"]
if displayMode == "Speed":
display = "%d %s" % (avgSpeed, self.plugin.unitsWind)
elif displayMode == "SpeedDirection":
display = "%s at %d %s" % (self.convertDirectionDegreesToText(direction), avgSpeed, self.plugin.unitsWind)
elif displayMode == "SpeedCompass":
display = "%d %s %s" % (avgSpeed, self.plugin.unitsWind, direction)
elif displayMode == "SpeedGust":
display = "%d %s (%d %s)" % (avgSpeed, self.plugin.unitsWind, gust, self.plugin.unitsWind)
self.tempList[sensor].updateStateOnServer(key=u"display", value=display)
else:
self.handleUnknownDevice(devicetype,sensor)