Skip to content

Instantly share code, notes, and snippets.

@tehmaze
Created April 20, 2014 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tehmaze/11124608 to your computer and use it in GitHub Desktop.
Save tehmaze/11124608 to your computer and use it in GitHub Desktop.
WX report generator for PyMultimonAPRS
#!/usr/bin/env python
import json
import pywapi
import sys
import time
LOCATION_ID = sys.argv[1]
wxs = pywapi.get_weather_from_weather_com('NLXX0250', 'metric')
cur = wxs['current_conditions']
out = dict(
timestamp=int(time.time()),
wind=dict(
gust=0,
direction=int(cur['wind']['direction']),
speed=float(cur['wind']['speed']),
),
pressure=float(cur['barometer']['reading']),
humidity=int(cur['humidity']),
temperature=float(cur['temperature']),
)
print json.dumps(out, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment