Exemplo n.º 1
0
#!/usr/bin/env python
# checkWeather.py
#
# Print current weather conditions.

import sys
sys.path.append('../customLibraries')
import WeatherStation

# Check arguments.
if 1 != len(sys.argv):
  print "Usage:\n  checkWeather.py"
  exit(1)

# Create a WeatherStation object.
ws = WeatherStation.WeatherStation("/home/pi/data/weatherData.csv")

# Get down to business.
ws.fetchData()
ws.printData()
Exemplo n.º 2
0
def main():
    station = WeatherStation.WeatherStation()
    phone = PhoneWeatherService.PhoneWeatherService(station)
    station.Add(phone)
    station.Run()
Exemplo n.º 3
0
#!/usr/bin/env python
# recordWeather.py
#
# Record the current weather conditions.

import sys
from optparse import OptionParser
sys.path.append('../customLibraries')
import WeatherStation

# Use OptionParser to grab command-line options.
parser = OptionParser()
parser.add_option('-f', '--file', dest='dataFile', help='Write weather data to CSVFILE.', metavar='CSVFILE')
(options, args) = parser.parse_args()

# Supply a default filename, if necessary.
if None == options.dataFile:
  dataFile = '../data/weatherData.csv'
else:
  dataFile = options.dataFile

# Create a WeatherStation object.
ws = WeatherStation.WeatherStation(dataFile=dataFile)

# Get down to business.
ws.fetchData()
ws.recordData()
ws.printData()