Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Fixing bug in wunderground where it'd return null
Browse files Browse the repository at this point in the history
  • Loading branch information
billykwooten committed Jul 19, 2017
1 parent 1f8bc43 commit a31de84
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ecobee/ecobee.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import time

logging.basicConfig(filename='log/hydrogen.log', level=logging.DEBUG)
logging.basicConfig(filename='log/hydrogen.log', level=logging.INFO)

with open('ecobee/data/ecobee_secret.json') as data_file:
data = json.load(data_file)
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from hydrogen import hydrogen
from wunderground import wunderground

logging.basicConfig(filename='log/hydrogen.log', level=logging.DEBUG)
logging.basicConfig(filename='log/hydrogen.log', level=logging.INFO)

# Set your ecobee index list
thermostatlist = [0, 1]
Expand Down
7 changes: 5 additions & 2 deletions wunderground/wunderground.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def pull_weather_json():
humidity = float(humidity)
feels_like = float(w['current_observation']['feelslike_f'])
dewpoint = float(w['current_observation']['dewpoint_f'])

if 'current_observation' not in w:
logging.info("weather json isn't normal")

with open('wunderground/cache/wunderground.cache', 'w') as data_file:
data_file.write('%s' % currenttemp)
Expand All @@ -58,11 +61,11 @@ def pull_weather_json():

def get_current_temperature():
minutes = checkcache_mtime()
if minutes > 30:
if minutes >= 30:
logging.info("Pulling new outside temperature")
temp = pull_weather_json()
return temp
elif minutes < 30:
elif minutes <= 29:
logging.info("Using cached outside temperature, as old temp isn't 30 minutes old")
with open('wunderground/cache/wunderground.cache', 'r') as data_file:
temp = data_file.read()
Expand Down

0 comments on commit a31de84

Please sign in to comment.