Hi Topher,

At this moment in time I am not using weewx-wd.

What I have done is to add this function to my weewx driver.

Which creates a clientraw_wx.txt to tme ramdisk I have on my pi3.

The # 
--------0--------1-----2-----3--------4--------5------------6----7-----8-----9-----10----11----12------13
  
is just so I can keep track of the variables I have used so far.

There order and I took from WD's clientrawdescription.txt in WD for windows 
folder,   I also search the internet for more details,
its far from perfect, but seem to work(ish).

Sadly my programming skills are very limited and the py code could well be 
improved by some one with more skills than mine

The code is called by using self.clientraw().

My driver uses a GrovePi Board and Grove sensors and a Switchdocs Labs 
GroveWeatherPi, and Maplin Wind and Rain sensors, which are called by using 
a modified version of the weather rack code.

    def clientraw(self):
        ID_code = 12345
        null = "--"
        d_m = time.strftime("%d %m")
        wd_time = time.strftime("%H:%M:%S")
        st_name = "Whimick Met"
        # eor = "!!EOR!!"
        eor = "!!C10.37S28!!"
        # 
--------0--------1-----2-----3--------4--------5------------6----7-----8-----9-----10----11----12------13
        wxdat = [ID_code, knot, knot, degrees, outTemp, outHumidity, hPa, 
rain, null, null, null, null, inTemp, null,
                null, null, null, null, null, null, system_temp, null, 
null, null, null, null, null, null, null,
                wd_time, st_name, null, radiation, d_m, eor]
        # 
---------14----15----16----17----18----19---20-----------21----22----23----24----25----26----27----28----29
        # -31----32
        
        cl_raw = open('/home/weewx/wxram/clientraw_wx.txt', 'w')
        for wxdat in wxdat:
            # print "%s" % wxdat,
            client = "%s " % wxdat
            cl_raw.write(client)
        
        else:
            cl_raw.close()
        return

I hope this helps
regards Michael


-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/python
#
#   $Revision: 1.2$
#   $Author: WhimickRH $
#   $Date: 2016-11-09 $
#   $Whimick_Met
#   $Weewx, OLED & CSV

# --------------------------IMPORT DEPENDENCIES---------------------------

import RPi.GPIO as GPIO
from grovepi import *
import grovepi
import Adafruit_BMP.BMP280 as BMP280
import grove_oled
import weewx.drivers
import weewx.wxformulas
import smbus
import time
from datetime import datetime
from time import sleep
import random
import sys

sys.path.append('/home/pi/WxDrivers')

# import Adafruit_BMP.BMP280 as BMP280
from grove_i2c_temp_hum_hdc1000 import HDC1000
import SDL_DS3231
import Wind_Rain as Wind_Rain

# --------------------------SETTINGS---------------------------

rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
	bus = smbus.SMBus(1)
else:
	bus = smbus.SMBus(0)

# GPIO Numbering Mode GPIO.BCM
anenometerPin = 18
rainPin = 17

# constants
SDL_MODE_INTERNAL_AD = 0
SDL_MODE_I2C_ADS1015 = 1

# sample mode means return immediately.  THe wind speed is averaged at sampleTime or when you ask, whichever is longer
SDL_MODE_SAMPLE = 0
# Delay mode means to wait for sampleTime and the average after that time.
SDL_MODE_DELAY = 1

weathervane = Wind_Rain.Wind_Rain(anenometerPin, rainPin, 0, 0, SDL_MODE_I2C_ADS1015)

weathervane.setWindMode(SDL_MODE_SAMPLE, 5.0)
# weathervane.setWindMode(SDL_MODE_DELAY, 5.0)

# -------------------------Initialize the OLED ------------------------

grove_oled.oled_init()
grove_oled.oled_clearDisplay()
grove_oled.oled_setNormalDisplay()
grove_oled.oled_setVerticalMode()
time.sleep(.1)

# -------------------------VAIRIABLES---------------------------------

outTemp = 0
outHumidity = 0

degrees = 0
volts = 0

rain = 0

inTemp = 0
hPa = 0
sealevel = 0
altitude = 0

radiation = 0
leafWet1 = 0

system_temp = 0

# -------------------------UPDATE DS3231------------------------------

current_time = time.time()

# DS3231/AT24C32 Setup
filename = time.strftime("%Y-%m-%d%H:%M:%SRTCTest") + ".txt"
starttime = datetime.utcnow()
ds3231 = SDL_DS3231.SDL_DS3231(1, 0x68)

try:
	# comment out the next line after the clock has been initialized
	# ds3231.write_now()
	print "DS3231=\t\t%s" % ds3231.read_datetime()
	for x in range(0, 4):
		value = random.randint(0, 255)
		print "address = %i writing value=%i" % (x, value)
		ds3231.write_AT24C32_byte(x, value)
		print "reading first 4 addresses"
	for x in range(0, 4):
		print "address = %i value = %i" % (x, ds3231.read_AT24C32_byte(x))
	print "----------------- "
except IOError as e:
	# print "I/O error({0}): {1}".format(e.errno, e.strerror)
	pass
# do the AT24C32 eeprom

# -------------------------SETUP SENSORS-----------------------

blue_led = 4
bmp280 = BMP280.BMP280()
BMP280_Altitude_Meters = 51
hdc = HDC1000()
hdc.Config()
light_sensor = 0
grovepi.pinMode(light_sensor, 'INPUT')
water_sensor = 1
grovepi.pinMode(water_sensor, 'INPUT')

# ------------------------CSV SETUP-----------------------------------

wx = "Date,Time,Windspeed,Wind Gust,Wind Direction,,Humidity,,Temperature,Barometer,Rain\n"
log2 = open('/home/weewx/wxram/data2.csv', 'w')
log2.write(wx)
log2.close()

# --------------------------DRIVER NAME-------------------------

DRIVER_NAME = 'Whimick_Met'
DRIVER_VERSION = '1.2'

def loader(config_dict, _):
	return Whimick_MetDriver(**config_dict[DRIVER_NAME])

class Whimick_MetDriver(weewx.drivers.AbstractDevice):
	def __init__(self, poll_interval=5, **stn_dict):
		self.poll_interval = int(poll_interval)  # seconds
		
	def hardware_name(self):
		return DRIVER_NAME

# -------------------------12C SENSORS-------------------------------

	def bmp(self):  # this function gets temp values from the bmp
		global inTemp, hPa, pressure, altitude
		inTemp = round(bmp280.read_temperature(), 1)
		hPa = round(bmp280.read_pressure() / 100, 1)
		pressure = round(bmp280.read_sealevel_pressure(BMP280_Altitude_Meters) / 100, 1)
		altitude = round(bmp280.read_altitude(), 1)
		return [inTemp, hPa, pressure, altitude]

	def hdc(self):  # this function gets temp values from the bmp
		global outTemp, outHumidity
		outTemp = round(hdc.Temperature(), 1)
		outHumidity = round(hdc.Humidity(), 1)
		return [outTemp, outHumidity]

	def vane(self):
		global degrees, volts, rain, currentWindSpeed, currentWindGust
		while True:
			rain = 0
			degrees = round(weathervane.current_wind_direction(), 1)
			volts = round(weathervane.current_wind_direction_voltage(), 1)
			rain = float(weathervane.get_current_rain_total() / 25.4)
			currentWindSpeed = round(weathervane.current_wind_speed() / 1.6, 2)
			currentWindGust = round(weathervane.get_wind_gust() / 1.6, 2)
			if currentWindGust <= currentWindSpeed * 4:
				break
		return [degrees, volts, rain, currentWindSpeed, currentWindGust]
	
# -------------------------ANALOG SENSORS----------------------------
	
	def analog(self):
		global radiation, leafWet2
		radiation = round(grovepi.analogRead(light_sensor) / 10, 1)
		leafWet2 = round(grovepi.analogRead(water_sensor) / 10, 1)
		#time.sleep(.5)
		return [radiation, leafWet2]

# ----------------------RASPI TEMPERATURE SENSORS--------------------

	def pi_temp(self):
		global system_temp
		f = open('/sys/class/thermal/thermal_zone0/temp', 'r')
		input = f.readline()
		if input:
			s_temp = float(input) / 1000
			system_temp = round(s_temp, 1)
		else:
			system_temp = None
		return system_temp

# --------------------------CONVERTIONS-------------------------------

	def convertion(self):
		global outTemp_F, mbar, inHg, inTemp_F, system_temp_F, radiation, volts, knot, kts_gust
		outTemp_F = round(9.0 / 5.0 * outTemp + 32, 1)
		inHg = round(hPa * 0.02953, 2)
		mbar = hPa
		inTemp_F = round(inTemp * 9 / 5 + 32, 1)
		system_temp_F = 9.0 / 5.0 * system_temp + 32
		radiation = round(radiation, 0)
		volts = round(volts, 1)
		knot = round(currentWindSpeed * 0.869, 2)
		kts_gust = round(currentWindGust * 0.869, 2)
		return [outTemp_F, system_temp_F, inTemp_F, mbar, inHg, radiation, volts, knot, kts_gust]
	
#--------------------------CALCULTATIONS--------------------------------
	
	def calculations(self):
		global windchill,windchill_F
		T = float(outTemp)
		V = float(currentWindSpeed)
		windchill = 35.74 + (0.6215 * T) - 35.75 * (V ** 0.16) + 0.4275 * T * (V ** 0.16)
		windchill_F = round(inTemp * 9 / 5 + 32, 2)
		return [windchill, windchill_F]

# -------------------------OLED WRITE ----------------------------------
	
	def outputOLED(self):
		grove_oled.oled_setTextXY(0, 0)
		grove_oled.oled_putString("Weewx Data")
		grove_oled.oled_setTextXY(2, 0)
		grove_oled.oled_putString("Temp " + str(outTemp))
		grove_oled.oled_setTextXY(4, 0)
		grove_oled.oled_putString("Humid " + str(outHumidity))
		grove_oled.oled_setTextXY(6, 0)
		grove_oled.oled_putString("Windmph " + str(currentWindSpeed))
		grove_oled.oled_setTextXY(8, 0)
		grove_oled.oled_putString("Volts " + str(volts))
		grove_oled.oled_setTextXY(10, 0)
		grove_oled.oled_putString("Degree " + str(degrees))
		
# -------------------------WRITE CSV------------------------------------

	def csvwrite(self):
		Dat_time = time.strftime("%Y/%m/%d,%H:%M:%S")
		wx = "Date,Time,Windspeed,Wind Gust,Wind Direction,00,Humidity,00,Temperature,Barometer,Rain\n"
		wxdat1 = "%s,%s,%s,%s,00,%s,00,%s,%s,%s\n" % \
		(Dat_time, currentWindSpeed, currentWindGust, degrees, outHumidity, outTemp, hPa, rain)
			
		log1 = open('/home/weewx/wxram/data1.csv', 'w')
		log2 = open('/home/weewx/wxram/data2.csv', 'a')
		log1.write(wx)
		log1.write(wxdat1)
		log2.write(wxdat1)
		log1.close()
		log2.close()
		return

# -------------------------WRITE CLIENTRAW TXT--------------------------
	
	def clientraw(self):
		ID_code = 12345
		null = "--"
		d_m = time.strftime("%d %m")
		wd_time = time.strftime("%H:%M:%S")
		st_name = "Whimick Met"
		# eor = "!!EOR!!"
		eor = "!!C10.37S28!!"
		# --------0--------1-----2-----3--------4--------5------------6----7-----8-----9-----10----11----12------13
		wxdat = [ID_code, knot, knot, degrees, outTemp, outHumidity, hPa, rain, null, null, null, null, inTemp, null,
				null, null, null, null, null, null, system_temp, null, null, null, null, null, null, null, null,
				wd_time, st_name, null, radiation, d_m, eor]
		# ---------14----15----16----17----18----19---20-----------21----22----23----24----25----26----27----28----29
		# -31----32
		
		cl_raw = open('/home/weewx/wxram/clientraw_wx.txt', 'w')
		for wxdat in wxdat:
			# print "%s" % wxdat,
			client = "%s " % wxdat
			cl_raw.write(client)
		
		else:
			cl_raw.close()
		return

# -------------------------LOOP PACKETS & READ SENSORS------------------
	def genLoopPackets(self):
		digitalWrite(blue_led, 1)
		while True:
			try:
				packet = {'dateTime': int(time.time() + 0.5), 'usUnits': weewx.US}
				start_time = time.time()
				# [outTemp_C, hPa, outHumidity] = self.bme28_0()
				# [inTemp] = self.bmp28_0()
				
				[outTemp, outHumidity] = self.hdc()
				
				[inTemp, hPa, pressure, altitude] = self.bmp()
				
				# ANALOG
				[radiation, leafWet2] = self.analog()
				
				# Get System temperature
				system_temp = self.pi_temp()
				
				[degrees, volts, rain, currentWindSpeed, currentWindGust] = self.vane()
				
				# Conversions
				[outTemp_F, system_temp_F, inTemp_F, mbar, inHg, radiation, volts, knot, kts_gust] = self.convertion()
				
				# CALCULTATIONS
				[windchill, windchill_F] = self.calculations()
								
				packet['outTemp'] = outTemp_F
				packet['windchill'] = windchill
				packet['barometer'] = inHg
				packet['altitude'] = altitude
				# packet['pressure'] = pressure
				packet['outHumidity'] = outHumidity
				packet['inTemp'] = inTemp_F
				packet['radiation'] = radiation
				packet['leafWet2'] = leafWet2
				packet['extraTemp1'] = system_temp_F
				packet['windDir'] = degrees
				packet['windSpeed'] = currentWindSpeed
				packet['windGust'] = currentWindGust
				packet['rain'] = rain
				packet['referenceVoltage'] = volts
			
			except IOError as e:
				digitalWrite(blue_led, 0)
				sleep(0.25)
				continue
			else:
				yield packet
				self.outputOLED()
				self.csvwrite()
				self.clientraw()
				time.sleep(self.poll_interval)
				
		def hardware_name(self):
			return "Whimick_Met"
		
	# To test this driver, run it directly as follows:
	#   PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/SwitchdocGrove.py
	if __name__ == "__main__":
		import weeutil.weeutil
		driver = Whimick_MetDriver()
		for packet in driver.genLoopPackets():
			print weeutil.weeutil.timestamp_to_string(packet['dateTime']), packet
#!/usr/bin/python
#
#   $Revision: 1.01$
#   $Author: WhimickRH $
#   $Date: 2016-10-20 $
#   $Wind_Rain
#   $

# --------------------------IMPORT DEPENDENCIES---------------------------

from grovepi import *
import grovepi
import smbus
import time as time_
import sys

# sys.path.append('/home/pi/Adafruit_ADS1x15/')
sys.path.append('/home/pi/WxDrivers')

from Adafruit_ADS1x15 import ADS1x15
import RPi.GPIO as GPIO

GPIO.setwarnings(False)

# --------------------------constants---------------------------

rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
	bus = smbus.SMBus(1)
else:
	bus = smbus.SMBus(0)

SDL_MODE_INTERNAL_AD = 0
SDL_MODE_I2C_ADS1015 = 1

#sample mode means return immediately.  THe wind speed is averaged at sampleTime or when you ask, whichever is longer
SDL_MODE_SAMPLE = 0
#Delay mode means to wait for sampleTime and the average after that time.
SDL_MODE_DELAY = 1
WIND_FACTOR = 2.400 

# --------------------------Helper Functions--------------------------

def fuzzyCompare(compareValue, value):
	VARYVALUE = 0.05
	if value > (compareValue * (1.0 - VARYVALUE) and (value < (compareValue * (1.0 + VARYVALUE)))):
		return True
	return False

def voltageToDegrees(value, defaultWindDirection):
	# Note:  The original documentation for the wind vane says 16 positions.
	# Typically only recieve 8 positions.  And 315 degrees was wrong.
	# For 5V, use 1.0.  For 3.3V use 0.66
	ADJUST3OR5 = 1.0
	PowerVoltage = 5.0

	if fuzzyCompare(3.84 * ADJUST3OR5, value):
		return 0.0
	if fuzzyCompare(1.98 * ADJUST3OR5, value):
		return 22.5
	if fuzzyCompare(2.25 * ADJUST3OR5, value):
		return 45
	if fuzzyCompare(0.41 * ADJUST3OR5, value):
		return 67.5
	if fuzzyCompare(0.45 * ADJUST3OR5, value):
		return 90.0
	if fuzzyCompare(0.32 * ADJUST3OR5, value):
		return 112.5
	if fuzzyCompare(0.90 * ADJUST3OR5, value):
		return 135.0
	if fuzzyCompare(0.62 * ADJUST3OR5, value):
		return 157.5
	if fuzzyCompare(1.40 * ADJUST3OR5, value):
		return 180
	if fuzzyCompare(1.19 * ADJUST3OR5, value):
		return 202.5
	if fuzzyCompare(3.08 * ADJUST3OR5, value):
		return 225
	if fuzzyCompare(2.93 * ADJUST3OR5, value):
		return 247.5
	if fuzzyCompare(4.62 * ADJUST3OR5, value):
		return 270.0
	if fuzzyCompare(4.04 * ADJUST3OR5, value):
		return 292.5
	if fuzzyCompare(4.34 * ADJUST3OR5, value):  # chart in manufacturers documentation wrong
		return 315.0
	if fuzzyCompare(3.43 * ADJUST3OR5, value):
		return 337.5
	return defaultWindDirection  # return previous value if not found

# --------------------------return current microseconds--------------------------

def micros():
	microseconds = int(round(time_.time() * 1000000))
	return microseconds

class Wind_Rain:

	GPIO.setmode(GPIO.BCM)
	GPIO.setwarnings(False)

	# instance variables
	_currentWindCount = 0
	_currentRainCount = 0
	_shortestWindTime = 0

	_pinAnem = 0
	_pinRain = 0
	_intAnem = 0
	_intRain = 0
	_ADChannel = 0
	_ADMode = 0

	#_currentRainCount = 0
	#_currentWindCount = 0
	_currentWindSpeed = 0.0
	_currentWindDirection = 0.0

	_lastWindTime = 0
	#_shortestWindTime = 0

	_sampleTime = 5.0
	_selectedMode = SDL_MODE_SAMPLE
	_startSampleTime = 0

	_currentRainMin = 0
	_lastRainTime = 0

	_ads1015 = 0

	def __init__(self, pinAnem, pinRain, intAnem, intRain, ADMode):
		GPIO.setup(pinAnem, GPIO.IN)
		GPIO.setup(pinRain, GPIO.IN)
		
		# when a falling edge is detected on port pinAnem, regardless of whatever   
		# else is happening in the program, the function callback will be run  
	
		GPIO.add_event_detect(pinAnem, GPIO.RISING, callback=self.serviceInterruptAnem)
		GPIO.add_event_detect(pinRain, GPIO.RISING, callback=self.serviceInterruptRain)

		ADS1115 = 0x01  # 16-bit ADC
		# Select the gain
		self.gain = 6144  # +/- 6.144V
		#self.gain = 4096  # +/- 4.096V

		# Select the sample rate
		self.sps = 250  # 250 samples per second

		# Initialise the ADC using the default mode (use default I2C address)
		# Set this to ADS1015 or ADS1115 depending on the ADC you are using!
		#self.ads1015 = ADS1x15(ic=ADS1015, address=0x48)
		self.ads1015 = ADS1x15(ic=ADS1115, address=0x48)
		#self.ads1015 = ADS1x15(ic=ADS1115, address=0x49)
		Wind_Rain._ADMode = ADMode


# --------------------------Wind Direction Routines--------------------------

	def current_wind_direction(self):
		if Wind_Rain._ADMode == SDL_MODE_I2C_ADS1015:
			value = self.ads1015.readADCSingleEnded(1, self.gain, self.sps)
			# AIN1 wired to wind vane on WeatherPiArduino
			voltageValue = value / 1000
		else:
			# user internal A/D converter
			voltageValue = 0.0
		direction = voltageToDegrees(voltageValue, Wind_Rain._currentWindDirection)
		return direction

	def current_wind_direction_voltage(self):
		if Wind_Rain._ADMode == SDL_MODE_I2C_ADS1015:
			value = self.ads1015.readADCSingleEnded(1, self.gain, self.sps)
			# AIN1 wired to wind vane on WeatherPiArduino
			voltageValue = value / 1000
		else:
			# user internal A/D converter
			voltageValue = 0.0
		return voltageValue

# --------------------------Utility methods--------------------------

	def reset_rain_total(self):
		Wind_Rain._currentRainCount = 0

	def accessInternalCurrentWindDirection(self):
		return Wind_Rain._currentWindDirection

	def reset_wind_gust(self):
		Wind_Rain._shortestWindTime = 0xffffffff

	def startWindSample(self, sampleTime):
		Wind_Rain._startSampleTime = micros()
		Wind_Rain._sampleTime = sampleTime

# --------------------------get current wind--------------------------
	
	def get_current_wind_speed_when_sampling(self):
		compareValue = Wind_Rain._sampleTime * 1000000
		if micros() - Wind_Rain._startSampleTime >= compareValue:
			# sample time exceeded, calculate currentWindSpeed
			timeSpan = (micros() - Wind_Rain._startSampleTime)
			Wind_Rain._currentWindSpeed = (float(Wind_Rain._currentWindCount)/float(timeSpan)) * WIND_FACTOR * 1000000.0
			# print "SDL_CWS = %f, Wind_Rain._shortestWindTime = %i, CWCount=%i TPS=%f" % (
			# Wind_Rain._currentWindSpeed,Wind_Rain._shortestWindTime, Wind_Rain.
			# _currentWindCount, float(Wind_Rain._currentWindCount)/float(Wind_Rain._sampleTime))
			Wind_Rain._currentWindCount = 0
			Wind_Rain._startSampleTime = micros()
		# print "Wind_Rain._currentWindSpeed=", Wind_Rain._currentWindSpeed
		return Wind_Rain._currentWindSpeed

	def setWindMode(self, selectedMode, sampleTime):  # time in seconds
		Wind_Rain._sampleTime = sampleTime
		Wind_Rain._selectedMode = selectedMode
		if Wind_Rain._selectedMode == SDL_MODE_SAMPLE:
			self.startWindSample(Wind_Rain._sampleTime)
			
# --------------------------def get current values--------------------------

	def get_current_rain_total(self):
		rain_amount = 0.2794 * float(Wind_Rain._currentRainCount)
		Wind_Rain._currentRainCount = 0
		return rain_amount

	def current_wind_speed(self):  # in milliseconds
		if Wind_Rain._selectedMode == SDL_MODE_SAMPLE:
			Wind_Rain._currentWindSpeed = self.get_current_wind_speed_when_sampling()
		else:
			# km/h * 1000 msec
			Wind_Rain._currentWindCount = 0
			delay(Wind_Rain._sampleTime * 1000)
			Wind_Rain._currentWindSpeed = (float(Wind_Rain._currentWindCount)/float(Wind_Rain._sampleTime)) * WIND_FACTOR
		return Wind_Rain._currentWindSpeed

	def get_wind_gust(self):
		latestTime = Wind_Rain._shortestWindTime
		Wind_Rain._shortestWindTime = 0xffffffff
		time = latestTime / 1000000.0  # in microseconds
		if time == 0:
			return 0
		else:
			return (1.0 / float(time)) * WIND_FACTOR

# --------------------------Interrupt Routines-------------------------

	def serviceInterruptAnem(self,channel):
		# print "Anem Interrupt Service Routine"
		currentTime = (micros()-Wind_Rain._lastWindTime)
		Wind_Rain._lastWindTime = micros()
		if currentTime > 1500:   # debounce
			Wind_Rain._currentWindCount = Wind_Rain._currentWindCount + 1
			if currentTime < Wind_Rain._shortestWindTime:
				Wind_Rain._shortestWindTime = currentTime

	def serviceInterruptRain(self,channel):
		# print "Rain Interrupt Service Routine"
		currentTime = (micros() - Wind_Rain._lastRainTime)
		Wind_Rain._lastRainTime=micros()
		if currentTime > 1500:   # debounce
			Wind_Rain._currentRainCount = Wind_Rain._currentRainCount + 1
			if currentTime < Wind_Rain._currentRainMin:
				Wind_Rain._currentRainMin = currentTime
#!/usr/bin/env python
#
# Wind_Rain Example Test File 
# Version 1.0 February 12, 2015
#
# SwitchDoc Labs
# www.switchdoc.com
#
#


#imports

import time
import sys
import math

sys.path.append('/home/pi/WxDrivers')

import Wind_Rain as Wind_Rain

#
# GPIO Numbering Mode GPIO.BCM#

anenometerPin = 18
rainPin = 17

# constants

SDL_MODE_INTERNAL_AD = 0
SDL_MODE_I2C_ADS1015 = 1

#sample mode means return immediately.  THe wind speed is averaged at sampleTime or when you ask, whichever is longer
SDL_MODE_SAMPLE = 0
#Delay mode means to wait for sampleTime and the average after that time.
SDL_MODE_DELAY = 1

weatherStation = Wind_Rain.Wind_Rain(anenometerPin, rainPin, 0,0, SDL_MODE_I2C_ADS1015)

weatherStation.setWindMode(SDL_MODE_SAMPLE, 5.0)
#weatherStation.setWindMode(SDL_MODE_DELAY, 5.0)

totalRain = 0
while True:

	print "---------------------------------------- "
	print "----------------- "
	print " Wind_Rain Library"
	print " WeatherRack Weather Sensors"
	print "----------------- "
	
	currentWindSpeed = round(weatherStation.current_wind_speed()/1.6, 2)
	print currentWindSpeed
	currentWindGust = round(weatherStation.get_wind_gust()/1.6, 2)
	print currentWindGust
	totalRain = totalRain + weatherStation.get_current_rain_total()/25.4
	print("Rain Total=\t%0.2f in")%(totalRain)
	print("Wind Speed=\t%0.2f MPH")%(currentWindSpeed)
	print("MPH wind_gust=\t%0.2f MPH")%(currentWindGust)

	print "Wind Direction=\t\t\t %0.2f Degrees" % weatherStation.current_wind_direction()
	print "Wind Direction Voltage=\t\t %0.3f V" % weatherStation.current_wind_direction_voltage()

	print "----------------- "
	print "----------------- "

	time.sleep(5.0)
Description of the clientraw.txt file - DRAFT 9/23/2014
example:
          
12345 18.0 18.0 239 13.2 98 1018.6 0.0 156.9 835.2 0.000 0.000 16.6 41 17.8 2 
0.0 0 0 0.0 -100.0 255.0 -100.0 16.6 -100.0 -100.0 -100 -100 -100 00 15 58 
West_Coast_Road-0:15:58_AM 0 0 24 9 100 100 100 100 100 100 100 13.2 15.9 13.2 
13.1 1 Night_time/Dry/A_few_clouds_ -0.3 18 18 18 18 18 18 18 18 18 18 18 18 18 
18 18 18 18 18 18 18 28.7 12.9 407.2 24/9/2014 16.0 15.7 13.2 13.1 0.0 18 17 19 
21 24 19 24 20 22 18 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 13.2 0.0 0.0 
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 13.2 13.1 13.2 25.3 0 --- --- 250 0 0 -100.0 
-100.0 0 0 0 0 0 0.0 16.7 16.6 7.9 1018.7 1018.5 34 11:40PM 12:05_AM  4.0E+0252 
 7.9E-0067 12.9 12.7 18 2014 -9.4 -1 0 -1 285 247 274 246 250 253 240 246 253 
239 15.0 255.0 20.1 13.0 -37.11667 -174.58333 0.0 98 98 0.0 12:02_AM 197.6 0.0 
106.5 0.0 0.0 0.0 4.4 12:13_AM 12:02_AM !!C10.37R!! 
          
0         12345    ID code
1         6.1      Average windspeed (kts) (rolling average of last 60 readings 
(updated every second), unless station provides average 
2         8.5      Current windspeed (kts)
3         235      Wind direction
4         16.3     Temperature (oC)
5         79       Outdoor humidity (%)
6         1010.0   Barometer (hpa)
7         0.0      Daily rainfall (mm)
8         17.6     Monthly  "       "
9         376.8    Yearly   "       "
10        0.0      Rain rate (mm/min)
11        0.0      Max rain rate (mm/min) for the day
12        20.8     Indoor temperature (oC)
13        0        Indoor humidity (%)
14        15.9     Soil temperature (oC)
15        0        Forecast icon
16        0.0      WMR968 extra temperature (oC)
17        0        WMR968 extra humidity (%)
18        0        WMR968 extra sensor number
19        6.6      Yesterday rainfall (mm)
20        20.8     Extra temperature sensor #1 (oC)
21        22.6     Extra temperature sensor #2   
22        -20.0    Extra temperature sensor #3    
23        -20.0    Extra temperature sensor #4   
24        -20.0    Extra temperature sensor #5     
25        -20.0    Extra temperature sensor #6     
26        0.0      Extra humidity sensor #1   (%)
27        0.0      Extra humidity sensor #2   
28        0.0      Extra humidity sensor #3    
19        21        Hour
30        29        Minute
31        42        Seconds
32        Awhitu    Stationname and time added
33        0         Lightning counts since noon. If using nextstorm, then its 
the total counts supplied by nexstorm
34        0         Actual solar reading
35        7         Day
36        4         Month
37        0         WMR968 battery level 1
38        0         WMR968 battery level 2 
39        7         WMR968 battery level 3
40        4         WMR968 battery level 4
41        100       WMR968 battery level 5
42        100       WMR968 battery level 6
43        100       WMR968 battery level 7
44        19.5      Current windchill reading  (oC)
45        18.5      Current humidex value (oC)
46        15.5      Maximum daily temperature (oC)
47        12.5      Minimum daily temperature (oC)
48        0         Current Condition Icon # - see list:
                   0= imagesunny
                   1= imageclearnight
                   2= imagecloudy
                   3= mainly fine (only a few clouds)
                   4= imagecloudynight
                   5= imagedry (cloudy periods)
                   6= imagefog
                   7= imagehaze
                   8= imageheavyrain (heavy rain)
                   9= imagemainlyfine
                   10=imagemist
                   11=imagenightfog
                   12=imagenightheavyrain
                   13=imagenightovercast
                   14=imagenightrain
                   15=imagenightshowers
                   16=imagenightsnow
                   17=imagenightthunder
                   18=imageovercast
                   19=imagemainlycloudy
                   20=imagerain (normal rain)
                   21=light rain
                   22=imageshowers2  (light rain/drizzle)
                   23=imagesleet
                   24=imagesleetshowers
                   25=imagesnow
                   26=imagesnowmelt
                   27=imagesnowshowers2 (light snow/snow showers)
                   28=imagesunny
                   29=imagethundershowers
                   30=imagethundershowers2
                   31=imagethunderstorms
                   32=imagetornado
                   33=imagewindy
                   34=stopped rainning
                   35=windy rain
                   36=sunrise
                   37=sunset
49        Current weather description
50        Baro trend last hour (hPa):for the local file clientraw.txt
51-70     the next 20  positions = the windspeed array for the wind speed graph
71        maximum gust for the day (kts)
72        dew pointer temperature (oC)
73        cloud height in feet
74        current date  (either as day/mth/year or mth/day/year, depending on 
your date format setting in WD)
75        maximum humidex
76        minumim humidex
77        maximum windchill
78        minimum windchill
79        Davis VP UV
80-89     array of last hour windspeed (10 positions)
90-99     array of last hour temperature (10 positions)
100-109   array of last rain last hour (10 positions)
110       max heat index
111       min heat index
112       heat index value (oC)
113       Maximum average speed for the day (kts)
114       Lightning count last minute
115       Time of last lightning count 
116       date of last lightning count 
117       Average wind direction (degrees)
118       Nexstorm distance of last strike
119       Nexstorm bearing of last strike
120       Extra temperature sensor #7
121       Extra temperature sensor #8
122       Extra humidity sensor #4
123       Extra humidity sensor #5
124       Extra humidity sensor #6
125       Extra humidity sensor #7
126       Extra humidity sensor #8
127       VP solar wm/2 reading
128       Max indoor temperature
129       Min indoor temperature
130       Apparent temperature
131       Max barometer
132       Min barometer
133       Max gust last hour
134       Max gust last hour time
135       Max gust today time
136       Max Apparent temperature
137       Min apparent temperature
138       max dew point
139       min dew point
140       max gust in the last minute
141       Year
142       THSWI index (needs to be enabled in WD)
143       Temp Trend (-1/0/1)
144       Humidity Trend (-1/0/1)
145       Humidex Trend (-1/0/1)
146-155   next 10 data positions = wind direction last hour
156       VP leaf wetness
157       VP soil moisture
158       10 minute average windspeed (kts)
159       wetbulb
160       latitude
161       longitude
162       9am reset rain total (mm)
163       daily high humidity
164       daily low humidity
165       midnight reset rain total (mm)
166       time of daily low windchill  //position 166
167       current cost channel 1 (watts)
168       current cost channel 2
169       current cost channel 3
170       current cost channel 4
171       current cost channel 5
172       current cost channel 6
173       daily wind run (km) (9am or midnight reset)
174       Time of daily max temp
175       Time of daily min temp
176       Version of WD
          
Description of the clientrawextra.txt
-------------------------------------
starts with 12345
array of last 24 hour windspeed (20 positions)
array of last 24 hour temperature (20 positions)
array of last 24 rain last hour (20 positions)
****Record month high temperature
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record month low temperature
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record month high gust
hour of that record
minute of that record
day of that record
month of that record
****Record month rain rate
hour of that record
minute of that record
day of that record
month of that record
****Record month low baro
hour of that record
minute of that record
day of that record
month of that record
****Record high baro
hour of that record
minute of that record
day of that record
month of that record
****Record month daily rain
hour of that record
minute of that record
day of that record
month of that record
****Record month rain in 1 hour
hour of that record
minute of that record
day of that record
month of that record
****Record month average speed
hour of that record
minute of that record
day of that record
month of that record
****not used at the moment
hour of that record
minute of that record
day of that record
month of that record
****Record month high soil
hour of that record
minute of that record
day of that record
month of that record
****Record month low soil
hour of that record
minute of that record
day of that record
month of that record
****Record month low chill
hour of that record
minute of that record
day of that record
month of that record
****Record month high gust direction
hour of that record
minute of that record
day of that record
month of that record
****Record month average speed direction
hour of that record
minute of that record
day of that record
month of that record
****Record month warmest day on record
hour of that record
minute of that record
day of that record
month of that record
****Record month coldest night on record
hour of that record
minute of that record
day of that record
month of that record
****Record month coldest day on record
hour of that record
minute of that record
day of that record
month of that record
****Record month warmest night on record
hour of that record
minute of that record
day of that record
month of that record
**** from here its repeated in the same sequence for all time records for the 
year to date, then all time records to date (21 data records in each seqeunce)

array of barometer last 24 hour (20 positions)
array of time stamp last 24 hour2 (20 positions)

Snow for the day
Snow for the month
Snow for the season
Days since last rain
Days of rain this month
The next 7 are rain for each day of the week (starts monday, ends sunday). 
Divide by 10
array of last 24 hour solar reading (20 positions)
array of last 24 hour UV reading (20 positions)
Davis VP forecast text
Evapotranspiration rate (mm)
Yesterdayrain (mm)
Version of weather display
last 24 hours wind direction (20 data points)
Max extra temperature 1
Min extra temperature 1
Max extra temp2
Min extra temp2
etc, up to extra temp 8
Day/night flag (i.e D or M )
array of last 24 humidity last hour (20 positions)
FWI value
array of last 24 indoor temperature last hour (20 positions)

****Record high solar month
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record high UV month
hour of that record
minute of that record
day of that record
month of that record
year of that record

****Record high solar year
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record high UV year
hour of that record
minute of that record
day of that record
month of that record
year of that record

****Record high solar all time
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record high UV all time
hour of that record
minute of that record
day of that record
month of that record
year of that record

daily sunshine hours
current snow depth
hour
minute
day
Flag for if solar data (i.e station has solar or UV) or not (s1 = yes s0 = no )
Flag for if UV data (i.e station has solar or UV) or not (u1 = yes u0 = no )
Flag for if soil temperature data (i.e station has solar or UV) or not (o1 = 
yes o0 = no )
Nexstorm lightning count totals for each hour (23 values)
****Record high dew month
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record low dew month
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record high dew year
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record low dew year
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record high dew all time
hour of that record
minute of that record
day of that record
month of that record
year of that record
****Record low dew all time
hour of that record
minute of that record
day of that record
month of that record
year of that record
chandler burning index
visibility
yesterday max temp 
yesterday min temp
yesterday max temp time
yesterday min temp time
yesterday max baro
yesterday min baro
yesterday max baro time
yesterday min baro time
yesterday max hum
yesterday min hum
yesterday max hum time
yesterday min hum time
yesterday max gust
yesterday max gust time
yesterday max average
yesterday max average time
yesterday min chill
yesterday min chill time
yesterday max heat
yesterday max heat time
yesterday max dew
yesterday min dew
yesterday max dew time
yesterday min dew time
yesterday max solar
yesterday max solar time
today max temp 
today min temp
today max temp time
today min temp time
today max baro
today min baro
today max baro time
today min baro time
today max hum
today min hum
today max hum time
today min hum time
today max gust
today max gust time
today max average
today max average time
today min chill
today min chill time
today max heat
today max heat time
today max dew
today min dew
today max dew time
today min dew time
today max solar
today max solar time

clientrawdaily.txt:
-------------------

Array of month to date daily hi temperatures (31 positions)
Array of month to date daily lo temperatures (31 positions)
Array of month to date rain total for month (31 positions)
Array of month to date barometer reading at daily reset time (31 positions)
Array of month to date average daily windspeed (31 positions)
Array of month to date average daily direction (31 positions)
Array of last 12 months rain totals (12 positions)
Array of month to date humdity readings (31 positions)
hour
minute
day
Temp last 7 days             (28 data points (4 per day)
Barometer last 7 days              "
Humidity last 7 days               "
Wind direction last 7 days          "
Wind speed last 7 days             "
Solar last 7 days                    "
UV last 7 days    
Last years Rain total to Dec (from rain season start)
Average rain for Jan, and then for the other months (mm):
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Indoor temperature last 7 days (28 data points (4 per day)) -> optional

Clientrawhour.txt: (updted at 59 minutes every hour)
------------------
last 60 minutes windspeed (kts), 1 minute resolution (i.e 60 numbers)
last 60 minutes gustspeed (kts)
last 60 minutes direction
last 60 minutes temperature (oC)
last 60 minutes humidity
last 60 minutes barometer (hpa)
last 60 minutes daily rain total (mm)
last 60 minutes of solar data (wm/2) 
last 24 hours of solar data (wm/2), every 15 minutes (95 data points)
last 24 hours of UV data , every 15 minutes (95 data points)
         
         
         
         
         
         

Reply via email to