This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added occupancy checks, as well as weather checks to automatically se…
…t hvac mode to heat or cool
- Loading branch information
1 parent
dcd7bd5
commit bd42497
Showing
10 changed files
with
144 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
{ | ||
"apikey": "" | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"apikey": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Current version 0.1 | ||
|
||
0.1 *) @Cryson, Initial version release |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# INI file for weather settings. Modify this file to change weather output | ||
# | ||
# Example INI file | ||
# | ||
# user_apiid: 83jd324asjc0f5a | ||
# user_city: New_York | ||
# user_state: NY | ||
# cachefile: /opt/test/Scripts/weather.data | ||
# | ||
|
||
[weather_settings] | ||
#APIID/Key from weatherunderground | ||
user_apiid: | ||
|
||
#City, e.g. New_York | ||
user_city: | ||
|
||
#State e.g. MN, FL, CA | ||
user_state: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import json | ||
import urllib2 | ||
import ConfigParser | ||
|
||
Config = ConfigParser.ConfigParser() | ||
Config.read('wunderground/config/config.ini') | ||
|
||
user_apiid = Config.get('weather_settings', 'user_apiid') | ||
user_city = Config.get('weather_settings', 'user_city') | ||
user_state = Config.get('weather_settings', 'user_state') | ||
|
||
|
||
def getWeatherCondition(): | ||
try: | ||
url = "http://api.wunderground.com/api/" | ||
url += "%s/conditions/q/%s/" % (user_apiid, user_state) | ||
url += "%s.json" % user_city | ||
req = urllib2.Request(url) | ||
response = urllib2.urlopen(req) | ||
jsondata = response.read() | ||
return jsondata | ||
except Exception as e: | ||
print("Could not get weather data") | ||
return e | ||
|
||
|
||
def pull_weather_json(): | ||
weather = getWeatherCondition() | ||
w = json.loads(weather) | ||
|
||
# Grab Weather Data | ||
currenttemp = float(w['current_observation']['temp_f']) | ||
atmospressure = float(w['current_observation']['pressure_in']) | ||
windspeed = float(w['current_observation']['wind_mph']) | ||
humidity = w['current_observation']['relative_humidity'] | ||
humidity = humidity[:-1] | ||
humidity = float(humidity) | ||
feels_like = float(w['current_observation']['feelslike_f']) | ||
dewpoint = float(w['current_observation']['dewpoint_f']) | ||
|
||
return currenttemp | ||
|
||
|
||
def get_current_temperature(): | ||
return pull_weather_json() | ||
|
||
|