loading

Let's face it, we humans talk about the weather a lot ⛅️. The average person talks about the weather four times a day, for an average of 8 minutes and 21 seconds. Do the math and that totals 10 months of your life that you will spend yapping about the weather. The weather ranks as the #1 go-to topic for conversation starters and uncomfortable silence breakers. If we are going to talk about it that much, we might as well take our weather street cred to a whole new level. This super-fun and easy project will leverage the Internet of Things (IoT) and a Raspberry Pi to do just that.

We are going to build our very own hyper-local weather dashboard, capturing the weather inside and outside our house over time. The next time someone asks you "how about the weather lately?", you will be able to whip out your phone and leave them breathless with your mad weather analysis skillz ☀️.

What you will need to take the course:
1. Raspberry Pi™ 3 Model B Weather Monitor Kit

2. That's it!

Project level: Beginner

Approximate time to complete: 20 minutes

Approximate fun factor: Off the charts

In this step-by-step tutorial, you will:
learn how to use Wunderground's API to get the local outside weather in your area

- Learn how to use a Raspberry Pi with a Sense HAT (https://www.raspberrypi.org/products/sense-hat/) to capture weather data inside your house

- Build your own personal hyper-local weather dashboard that you can access from any web browser on your laptop or mobile device

- Give your meteorologist a run for their money

Step 1: Getting Started

We’ve already put in a lot of the leg work for you putting the code together, and organizing the information. We’ll just need you to make a few adjustments along the way.

To retrieve all of the things we’ve prepared for you, you’ll need to clone the repository from GitHub. Github is an awesome service that allows us to store, revise and manage projects like this. To clone the repository all we need to do is go into our Pi’s terminal, or your computers terminal that’s SSH’d into your pi and type this command:


$ git clone https://github.com/InitialState/wunderground-sensehat.git

Hit enter and you’ll see this information:

pi@raspberrypi ~ $ git clone https://github.com/InitialState/wunderground-sensehat.git

Cloning into 'wunderground-sensehat'...

remote: Counting objects: 28, done.

remote: Total 28 (delta 0), reused 0 (delta 0), pack-reused 28

Unpacking objects: 100% (28/28), done.

Checking connectivity... done.

Once you see this then congrats, you’ve successfully cloned the Github Repo and have all of the necessary files to build your Super Weather Station. Before we move onto the next step, let’s take some time to explore around this directory and learn a few basic command line commands.

Type in the command below into your terminal:

$ ls

This command lists everything that’s available in the directory that you’re currently in. This list shows that our Github Repo has been successfully cloned into our directory under the name “wunderground-sensehat.” Let’s take a look at what’s in that directory. To change directory’s, all you need to do is type “cd” and then type the name of the directory that you wish to go to.

In this case, we’ll type:

$ cd wunderground-sensehat

Once we hit enter, you’ll see that we’re now in the wunderground-sensehat directory. Let’s type ls again to see what files we’ve installed on our pi.

README.md sensehat.py sensehat_wunderground.py wunderground.py

Here we see the we’ve got our readme document, and a couple different python files. Let’s take a look at sensehat.py. Instead of jumping into the file w/ the cd command like we did for directory’s, we’re going to use the nano command. The nano command allows us to open up the nano text editor where we have all of our python code for each segment of this project. Go ahead and type:

$ nano sensehat.py

Here you can see all of the code we’ve prepared for you for this project. We’re not going to make any changes to this document just yet, but feel free to scroll around and see what we’re going to be doing later in this tutorial.

Step 2: Get Access to Wundergrounds API

The Weather Underground (http://www.wunderground.com) provides real-time online weather information assisted by a network 140,000+ personal weather stations setup all over the world. Chances are, there is a Weather Underground personal weather station near you. The really cool aspect of Wunderground is that they have an API that we can use to retrieve the weather data (pretty much) any where in the world.

Temperature, dew point, wind gust, humidity, precipitation, pressure, UV index, ... all easily available for wherever we want, whenever we want. Let's learn how to use Wunderground's super-simple API.

Weather Underground is a registered trademark of The Weather Channel, LLC. both in the United States and internationally. The Weather Underground Logo is a trademark of Weather Underground, LLC.



In order to use the Wunderground API, you first need your own API key. Getting an API key is quick and free.

1. Go to: http://www.wunderground.com/weather/api/?MR=1.Cli...

2. Click “Sign Up for FREE!”.

3. Create an account and click the link sent to you in a validation email to activate your account

4. Sign in

5. Go to Pricing and select the free Stratus Plan (default selection). You get 500 API calls per day for $0. There is no credit card required to get the Developer level API.

6. Click “Purchase Key”

7. Fill out the form and submit it to get your API key

Your key will look something like this: 0def10027afaebb7. Save it.
You can make an API to Wunderground by typing in a URL into your browser in the following format:

http://api.wunderground.com/api/YOUR_API_KEY/conditions/q/THE_DESIRED_STATE/THE_DESIRED_CITY.json

for example, to get the weather in San Francisco, CA:

http://api.wunderground.com/api/0def10027afaebb7/conditions/q/CA/San_Francisco.json

to get the weather in London:

http://api.wunderground.com/api/0def10027afaebb7/conditions/q/UK/London.jsonLet's

look at what is returned:


{
"response": { "version":"0.1", "termsofService":"http://www.wunderground.com/weather/api/d/terms.html", "features": { "conditions": 1 } } , "current_observation": { "image": { "url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png", "title":"Weather Underground", "link":"http://www.wunderground.com" }, "display_location": { "full":"London, United Kingdom", "city":"London", "state":"", "state_name":"United Kingdom", "country":"UK", "country_iso3166":"GB", "zip":"00000", "magic":"1", "wmo":"03772", "latitude":"51.47999954", "longitude":"-0.44999999", "elevation":"24.00000000" }, "observation_location": { "full":"London, ", "city":"London", "state":"", "country":"UK", "country_iso3166":"GB", "latitude":"51.47750092", "longitude":"-0.46138901", "elevation":"79 ft" }, "estimated": { }, "station_id":"EGLL", "observation_time":"Last Updated on October 23, 5:50 AM BST", "observation_time_rfc822":"Fri, 23 Oct 2015 05:50:00 +0100", "observation_epoch":"1445575800", "local_time_rfc822":"Fri, 23 Oct 2015 06:13:53 +0100", "local_epoch":"1445577233", "local_tz_short":"BST", "local_tz_long":"Europe/London", "local_tz_offset":"+0100", "weather":"Overcast", "temperature_string":"50 F (10 C)", "temp_f":50, "temp_c":10, "relative_humidity":"87%", "wind_string":"From the Variable at 4 MPH", "wind_dir":"Variable", "wind_degrees":0, "wind_mph":4, "wind_gust_mph":0, "wind_kph":6, "wind_gust_kph":0, "pressure_mb":"1022", "pressure_in":"30.18", "pressure_trend":"0", "dewpoint_string":"46 F (8 C)", "dewpoint_f":46, "dewpoint_c":8, "heat_index_string":"NA", "heat_index_f":"NA", "heat_index_c":"NA", "windchill_string":"NA", "windchill_f":"NA", "windchill_c":"NA", "feelslike_string":"50 F (10 C)", "feelslike_f":"50", "feelslike_c":"10", "visibility_mi":"6.2", "visibility_km":"10.0", "solarradiation":"--", "UV":"0","precip_1hr_string":"-9999.00 in (-9999.00 mm)", "precip_1hr_in":"-9999.00", "precip_1hr_metric":"--", "precip_today_string":"0.00 in (0.0 mm)", "precip_today_in":"0.00", "precip_today_metric":"0.0", "icon":"cloudy", "icon_url":"http://icons.wxug.com/i/c/k/nt_cloudy.gif", "forecast_url":"http://www.wunderground.com/global/stations/03772.html", "history_url":"http://www.wunderground.com/history/airport/EGLL/2015/10/23/DailyHistory.html", "ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=51.47750092,-0.46138901", "nowcast":"" } }


Look at all of that glorious weather data. We just need to make a script to parse it, then ship it to a web-based dashboard. First, let's setup the destination for our data -> Initial State.


Step 3: Initial State

We want to stream all of our weather data to a cloud service and have that service turn our data into a nice dashboard that we can access from our laptop or mobile device. Our data needs a destination. We will use Initial State as that destination.


Step 1: Register for an Initial State account

Go to https://www.initialstate.com/app#/register/ and create a new account.


Step 2: Install the ISStreamer

Install the Initial State Python module onto your Raspberry Pi: At a command prompt (don’t forget to SSH into your Pi first), run the following command:

$ cd /home/pi/

$ \curl -sSL https://get.initialstate.com/python -o - | sudo bash

Security Note: The above command has some important anatomy that the user should be aware of.

1) There is a preceding \ before curl. This is important to ensure no alias of curl gets run if one was created. This helps mitigate risk of the command doing more than intended.

2) The command is a piped command, so when running, you are piping the output of a script that is being retrieved from https://get.initialstate.com/python into the command sudo bash. This is done to simplify installation, however, it should be noted that https is important here for helping ensure no man-in-the-middle manipulation of the install script, especially since the script is being run with elevated privileges. This is a common way to simplify install and setup, but if you are a little more wary there are some slightly less convenient alternatives: you can break the command out into two steps and investigate the bash script being downloaded from the curl command yourself to insure it's fidelity OR you can follow the pip instructions, you just wont get an automatically generated example script.

Step 3: Make some Automagic

After Step 2 you will see something similar to the following output to the screen:

pi@raspberrypi ~ $ \curl -sSL https://get.initialstate.com/python -o - | sudo bash

Password: Beginning ISStreamer Python Easy Installation!

This may take a couple minutes to install, grab some coffee :)

But don't forget to come back, I'll have questions later!

Found easy_install: setuptools 1.1.6

Found pip: pip 1.5.6 from /Library/Python/2.7/site-packages/pip-1.5.6- py2.7.egg (python 2.7)

pip major version: 1

pip minor version: 5

ISStreamer found, updating...

Requirement already up-to-date: ISStreamer in /Library/Python/2.7/site-packages Cleaning up...

Do you want automagically get an example script? [y/N]

(the output may be different and take longer if you have never installed the Initial State Python streaming module before)

When prompted to automatically get an example script, type y.

This will create a test script that we can run to ensure that we can stream data to Initial State from our Pi. You will be prompted:

Where do you want to save the example? [default: ./is_example.py]:

You can either type a custom local path or hit enter to accept the default. You will be prompted for your username and password that you just created when you registered your Initial State account. Enter both and the installation will complete.

Step 4: Access Keys

Let’s take a look at the example script that was created. Type:

$ nano is_example.py

On line 15, you will see a line that starts with streamer = Streamer(bucket_ .... This lines creates a new data bucket named “Python Stream Example” and is associated with your account. This association happens because of the access_key=”...” parameter on that same line. That long series of letters and numbers is your Initial State account access key. If you go to your Initial State account in your web browser, click on your username in the top right, then go to “my account”, you will find that same access key at the bottom of the page under “Streaming Access Keys”.

Every time you create a data stream, that access key will direct that data stream to your account (so don’t share your key with anyone).

Step 5: Run the Example

Run the test script to make sure we can create a data stream to your Initial State account.

Run the following:

$ python is_example.py

Step 6: Profit

Go back to your Initial State account in your web browser. A new data bucket called “Python Stream Example” should have shown up on the left in your log shelf (you may have to refresh the page). Click on this bucket and then click on the Waves icon to view the test data.

You will want to step through the Waves tutorial to familiarize yourself with how to use this data visualization tool. Next, view the data in Tiles to see this same data in dashboard form.

You are now ready to start streaming real data from Wunderground and more.

Step 4: Wunderground Dashboard

Now for the fun part. We are ready to start using the Wunderground API to create a weather dashboard and capture the weather history for wherever we choose. To do this, we are going to use the Python script: https://github.com/InitialState/wunderground-sens...

This script simply calls the Wunderground API using your API key and retrieves the weather information on a specified time interval. It also streams that data to your Initial State account, which will allow you to create a Wunderground dashboard.

You can either copy this script to your Pi, or access it through the Github repository that we cloned earlier.

You can do this by changing into your wunderground-sensehat directory by typing:

$ cd wunderground-sensehat

From here, you'll be able to access the python file that we'll run to create our weather dashboard. Before you run it, you need to set your desired parameters and insert your keys. Nano into the wunderground.py file by typing:

$ nano wunderground.py

Then edit the section near the top of the script:

# --------- User Settings ---------
STATE = "CA"

CITY = "San_Francisco"

WUNDERGROUND_API_KEY = "PLACE YOUR WUNDERGROUND API KEY HERE"

BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"

BUCKET_KEY = "wu1"

ACCESS_KEY = "PLACE YOUR INITIAL STATE ACCESS KEY HERE"

MINUTES_BETWEEN_READS = 15

# ---------------------------------

You need to set the desired state and city. You also have to insert your Wunderground API key and your Initial State account access key or your data isn't going to go anywhere. The MINUTES_BETWEEN_READS parameter will set how often your script will poll the Wunderground API for weather information. 15 minutes provides a nice interval long-term. For the sake of short-term testing, you can set this to 0.5 minutes.

Once you have your parameters set, you are ready to run your script:

$ python wunderground.py

If you are ssh'ing into your Pi and want to leave this script running uninterrupted for a long time, you can use the nohup command (no hang-up) as follows:

$ nohup python wunderground.py &

This script is going to do a bit more than just read the weather data and send it to Initial State. This script is going to take advantage of the emoji support built into Initial State's tools to make the dashboard a bit more sexy. You can see the logic used to take the weather status from the current_observation -> icon status and convert it to an emoji token in the weather_icon function. Something similar happens for the moon phase in the moon_icon function and wind direction in the wind_dir_icon function.


Go to your Initial State account and look at your data. The screenshot of the dashboard above was taken after 9 days of data collection running at 15 minute intervals. You can edit your dashboard by changing chart types with the cog icon in the top right corner of each tile and by right-clicking on a tile to resize/move it around.

The next step in this project is to start collecting weather data from our own sensors.

Step 5: Sense HAT

The Sense HAT is an add-on board for the Raspberry Pi that is full of sensors, LEDs, and a tiny joystick. What is so great about this little add-on is that it is incredibly easy to install and use thanks to a fantastic Python library that you can quickly install. For this project, we will use the temperature, humidity, and barometric pressure sensors on the Sense HAT. Let's set it up.

The first step in using the Sense HAT is to physically install it onto your Pi. With the Pi powered down, attached the HAT as shown in the image.

Power on your Pi. We need to install the Python library to make it easy to read the sensor values from the Sense HAT. First, you will need to ensure that everything is up-to-date on your version of Raspbian by typing:

$ sudo apt-get update

Next, install the Sense HAT Python library:

$ sudo apt-get install sense-hat

Reboot your Pi.

We are ready to test the Sense HAT by reading sensor data from it and sending that data to Initial State.

Let's test our Sense HAT to make sure everything is working. We will use the script located athttps://github.com/InitialState/wunderground-sensehat/blob/master/sensehat.py. You can copy this script to a file on your Pi or access it from our Github repository that we cloned earlier. Change into your wunderground-sensehat directory and then nano into your sensehat.py file by typing:

$ nano sensehat.py

Notice on the first line that we are importing the SenseHat library into the script. Before you run this script, we need to setup our user parameters.

# --------- User Settings ---------
CITY = "Nashville"

BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"

BUCKET_KEY = "sensehat"

ACCESS_KEY = "Your_Access_Key"

SENSOR_LOCATION_NAME = "Office"

MINUTES_BETWEEN_SENSEHAT_READS = 0.1

# ---------------------------------

Specifically, you need to set your ACCESS_KEY to your Initial State account access key. Notice how easy it is to read data from the Sense HAT in a single line of Python (e.g. sense.get_temperature()).
At a command prompt on your Pi, run the script:

$ sudo python sensehat.py

Go to your Initial State account and view the new data bucket created by the Sense HAT.


Now, we are ready to put it all together and create our hyper-local weather dashboard!

Step 6: Hyper Local Weather Dashboard

The final step in this project is simply combining our Wunderground script and our Sense HAT script into a single Python script. We will be using https://github.com/InitialState/wunderground-sens... for this last step. Copy this file to your Pi or access it via the Github repository that we cloned earlier in this tutorial. Change into your wunderground-sensehat directory, and then nano into the sensehat_wunderground.py file by typing:


$ nano sensehat_wunderground.py


Modify the user section near the top of the file:


# --------- User Settings ---------

STATE = "CA"

CITY = "San_Francisco"

SENSOR_LOCATION_NAME = "Office"

WUNDERGROUND_API_KEY = "PLACE YOUR WUNDERGROUND API KEY HERE"

BUCKET_NAME = ":partly_sunny: " + CITY + " Weather"

BUCKET_KEY = "shwu1"

ACCESS_KEY = "PLACE YOUR INITIAL STATE ACCESS KEY HERE"

MINUTES_BETWEEN_READS = 15

# ---------------------------------

Make sure you put your Wunderground API key, Initial State account access key, and desired city/state in this section. Specify the name of the location that your Sense HAT will be collecting environmental data in the SENSOR_LOCATION_NAME variable.


Run the script on your Pi:

$ sudo python sensehat_wunderground.py

If you are ssh'ing into your Pi and want this script to run uninterrupted for a long time, run the script using the nohup (no hang-up) command:

$ nohup sudo python sensehat_wunderground.py &

After a couple of days, it is interesting to compare the temperature changes in your room versus the temperature changes outside. Same with humidity. If you want to add more sensors to the same dashboard, simply send the data to the same BUCKET_KEY specified in the User Settings (along with the same ACCESS_KEY). These additional sensors can be on any device and located anywhere and still send data to the same bucket. For example, you could have 10 different temperature sensors connected to 10 different types of single-board computers (Pi, Arduino, BeagleBone, Edison) and have them all streaming data into your one hyper-local weather dashboard.

Step 7: Add a Map to Your Dashboard (Bonus)

We can easily add a map tile to our dashboard showing the location of our weather stream. You can learn more about the interactive map view in tiles athttp://support.initialstate.com/knowledgebase/articles/800232-tiles-map-view. We could simply add a new streamer.log statement in our Python script (and I'll explain how you can do that at the end of this section). Instead, we will take this opportunity to show you a different way to send data into your dashboard.

Step 1: Get Your Location's Latitude/Longitude Coordinates

You need to get the latitude/longitude coordinates of your location. One way to do this is to go to Google Maps, search for your location, and zoom in to your exact location. In the URL, you will see your latitude/longitude coordinates. In the example above, my coordinates are 35.925298,-86.8679478.

Copy your coordinates (you will need them in step 2), and make sure you don't accidentally copy any extra characters from the URL.

Step 2: Build a URL to Send Data Into Your Dashboard

Click on the "settings" link under the bucket name in the bucket shelf. This will bring up the screen above. Copy the text in the API Endpoint section and paste it in your favorite text editor. We will use this to build a URL that we can use to send data into our existing bucket and dashboard. In my bucket, the text that I copied looks like: https://groker.initialstate.com/api/events?accessKey=bqHk4F0Jj4j4M4CrhJxEWv6ck3nfZ79o&bucketKey=shwu1 Your URL will have your accessKey and bucketKey. We need to add a stream name and value to the URL parameters to complete the URL.

Add "&MapLocation=YOUR_COORDINATES_FROM_STEP1" to your URL

(insert the coordinates from Step 1, no spaces and don't copy mine!!)

Here's what mine looks like: https://groker.initialstate.com/api/events?accessKey=bqHk4F0Jj4j4M4CrhJxEWv6ck3nfZ79o&bucketKey=shwu1&MapLocation=35.925298,-86.8679478

Paste your complete URL to the address bar of your browser and hit enter (or use the 'curl' command at a command prompt) to send your map coordinates to the stream, "MapLocation", in your new bucket.

If you look at your dashboard in Tiles now (you may have to refresh if you get impatient), a new Tile named MapLocation should have appeared zoomed into your current location.

Step 2 Alternative: Modify Your Script

If you really do not like Step 2 above, you can simply add another streamer.log statement to your Python script. Simply add the line

streamer.log("MapLocation","YOUR_COORDINATES_FROM_STEP1")

somewhere inside the def main(): function of the sensehat_wunderground.py script (pay attention to indentation b/c Python requires you to follow strict indentation rules). For example, I added streamer.log("MapLocation","35.925298,-86.8679478") right after line 138.

Step 8: Fixing the Sense Hat Temperature Reading

You may notice that your Sense HAT's temperature readings seem a bit high - that's because they are. The culprit is the heat generated from the Pi’s CPU heating up the air around the Sense HAT when it is sitting on top of the Pi.

To make the temperature sensor useful, we need to either get the HAT away from the Pi (which would eliminate the important benefit of being a compact solution) or try to calibrate the temperature sensor reading. The CPU is the primary cause of the parasitic heat affecting our temperature sensor, so we need to figure out the correlation. When reviewing the Enviro pHAT for the Pi Zero we came up with an equation to account for the CPU temperature affecting a hat's temperature reading. We just need the CPU temperature and a scaling factor to calculate the calibrated temperature:

temp_calibrated = temp - ((cpu_temp - temp)/FACTOR) 

We can find the factor by recording the actual temperature and solving for it. In order to find the actual temperature in the room, we need a different temperature sensor setup. Using a DHT22 sensor (setup instructions here and script here), we can record and visualize both temperatures simultaneously:

The result reveals that the Sense HAT's reading is off by 5-6 degrees Fahrenheit pretty consistently. Adding the CPU temperature into the mix (with this script), first off shows that it is extremely hot, and second off reveals a sort of wave that the Sense HAT measurement mimics.

After recording for about 24 hours, I solved for the factor using six different readings at six different points in time. Averaging the factor values gave a final factor value of 5.466. Applying the equation

temp_calibrated = temp - ((cpu_temp - temp)/5.466)

the calibrated temperature came to within one degree of the actual temperature reading:

You can run this calibration correction on the Pi itself, inside of the wunderground_sensehat.py script.

<p>I keep getting an error saying &quot;inconsistent use of tabs and spaces in indentation&quot;. I've tried deleting, unifying the tab region, and taking all the tabs out. I still keep getting the error. </p>
<p>Hi, I was just doing this on an inset day and in the first step the ':' colon isn't needed, or at least gave me a headache for sometime. Other then that it looks really good.</p>
<p>That was a typo! Sorry about that! Fixed now.</p>
<p>why is it not recognizing the first command? </p><p>pi@raspberrypi:~ $ git clone: <a href="https://github.com/InitialState/wunderground-sensehat.git"> https://github.com/InitialState/wunderground-sens...</a></p><p>git: 'clone:' is not a git command. See 'git --help'.</p><p>Did you mean this?</p><p> clone</p>
<p>edit: I removed the &quot;:&quot; and it worked...</p>
<p>Whoops! That was a typo. Fixed it. Thanks for letting me know!</p>
Do I HAVE to use the sense hat? I don't have one, and don't want one. I just want to have the dashboard on a TV screen.
<p>Not particularly. You can just use the Wunderground API to get outside data if you're not concerned with having inside data. You can even just run the script from your laptop if you don't have a pi. </p><p>Although, you can connect nearly everything to an Initial State Dashboard. Here's a link to their tutorials page where you can see a ton of projects to put on your TV screen: <a href="http://www.initialstate.com/learn">www.initialstate.com/learn</a></p>
<p>This was the easiest Instructable to follow that I've ever done...thanks! Very well written, comprehensive, and explanatory. And, for those who think you need to buy the kit, you don't. As long as you have a Pi and SenseHAT, which I just happened to have, then you have everything you need.</p><p>I will say that I'm struggling with how to incorporate the CPU temperature adjustment into the wunderground_sensehat.py script. If anybody has an example of how that works, I'd appreciate it very much!</p><p>Awesome Instructable!</p>
<p>Hey there! I added a step the other day that should help calibrate the temperature taking CPU temp into consideration.</p>
<p>Hi Jeffrey - thanks for the response! Are you talking about Step 8? I read through that, but am not sure how to modify the wunderground_sensehat.py script to take that all into account. </p>
<p>We originally intended to merge the scripts, but we went ahead and did it for you here. You can replace your script with this one: https://github.com/initialstate/wunderground-sensehat/blob/master/sensehat_wunderground_calibrated.py</p>
<p>Very cool! Thank you very much! I'll be giving this a run when I get home tonight. Thanks!</p>
<p>Interesting Article. Everything worked as expected, but the code you provided does not take into account the Sense Hat temperature sensors picking up the temerature of the CPU causing the temp reading to be incorrect. (Mine was about 15 -20 degrees to high.) In the attached images I put the code that I used to compensate for this. I found this code on the AstroPI website in the watchdog repository: </p><p><a href="https://astro-pi.org/principia/winners/#watchdog" rel="nofollow">https://astro-pi.org/principia/winners/#watchdog</a></p><p>Thanks,</p><p>Bob M</p>
<p>Great article! I have a quick question, if you have time. I work at a<br> school in the middle east and we are using this to notify our nurses if<br> the temperature goes above 38C I want it to show a red flag icon if it<br> is and a white check if it isn't. I have the following code</p><p>redflagcheck=int(conditions['current_observation']['temp_c'])<br> if redflagcheck &gt;=38:<br> redflag=True<br> else:<br> redflag=False</p><p>and then</p><p>if redflag == True:<br> streamer.log(&quot;:triangular_flag_on_post: &quot; + &quot;Red Flag&quot;, &quot;:triangular_flag_on_post:&quot;)<br> else:<br> streamer.log(&quot;:white_check_mark: &quot; + &quot;Red Flag&quot;, &quot;:white_check_mark:&quot;)</p><p>The<br> problem is when it changes value, it doesn't get rid of the old tile on<br> initial state and shows both. Is there a way to only show one icon or <br>the other? Thanks ahead of time for any help.</p><p>Bob</p>
<p>I think it's just because your stream name is different - it needs to be the same over both. So &ldquo;Red Flag&rdquo; instead of &ldquo;:flag: Red Flag&rdquo; or &ldquo;:check: Red Flag&quot;</p>
<p>When I run the python command, the cursor goes to the next line, and stays there (locked up?). I used Ctrl+C to break out and get this:</p><p>^CTraceback (most recent call last):</p><p>File &quot;wunderground.py&quot;, line 191, in &lt;module&gt;</p><p>time.sleep(60*MINUTES_BETWEEN_READS)</p><p>and no new bucket at initialstate.com</p>
<p>I get the same thing. Did you resolve this?</p>
<p>The cursor stays there for me. It might just be indicating that the script is running. Let it sit for a minute, and then check Initial State. If that doesn't work then let me know.</p>
<p>It's the same. I had the time update interval set to 0.5 as indicated in the instruction. I let it sit for over 5 minutes. Other folks have gotten it to work so it must be something on my system possibly. I used the Pi3 and PiB+.</p>
<p>Hmmm... Only thing I can think of off the top of my head is that there could be a typo in your access key or somewhere else in that section. I always make sure copy and paste those things to make sure something doesn't get lost in translation. Or, it could be something else.</p>
<p>I checked both the WU and InitialState access codes. But, I'll triple check again. But, thanks for your input. If you think of anything else....much appreciated. </p>
<p>Ok. You were correct. I looked in my account and there was another 'key' there for some reason. I used that second key and it worked. I'm still puzzled about the second key.</p><p>I forgot to mention....Great project. </p><p>Thanks for you input.</p>
<p>You can have multiple keys on Initial State, so you just have to make sure you're using the right one! I do that all the time. Check out some of the other instructables I've posted using them! Lots o' fun.</p>
<p>There a way to build a sensor suite with the raspberry pi that will communicate with Weather Underground?</p>
<p>Also, Is there a way to put a radar.. I like to have one to help me understand when I look at weather</p>
<p>There is currently not a way to do this, but there may be in the future. You can submit a feature request to Initial State to let them know you'd like to see that in the future here: http://support.initialstate.com/forums/252778-feature-requests</p>
<p>Hi, Wonderful Idea and easy project... Although I am wondering if ( and how ) to change the clock from 24 hour clock to 12 hour clock</p><p>Thanks in advance as I await a response, once again, great and easy project</p>
<p>Wow this was great!! thanks.</p>
<p>Glad you enjoyed it!!</p>
<p>Wow this was great!! thanks.</p>
<p>Wow this was great!! thanks.</p>
<p>Awesome project!! =D<br>Congratulations!</p>
<p>Thanks!</p>
<p>I think the name given here isn't correct. This is not a wheather station but a monitor of an internet site. </p>
<p>Not true. You are using a sense HAT on a Pi to detect indoor weather (temperature, humidity, pressure). You are pulling outdoor weather data off of another site, but that is to compare with the indoor data that your sensors are collecting.</p>
<p>Indoor, you say it.</p>
<p>Weather (Cambridge Dictionary Online): The conditions in the air above the earth such as wind, rain, or temperature, especially at a particular time over a particular area. The temperature and RH inside a house isn't really 'weather'.</p>
<p>Then put your Pi + sense HAT outside and voila, you are detecting &quot;weather&quot; Mr. Dictionary Police.</p>
<p>I'm usually grammar police, but that works too :)</p><p>You would then need protection in a radiation shielded aspirated enclosure, but you are still missing important wind speed/direction and a tipping bucket for rainfall. A solar radiation sensor and CO2 sensor would complete the kit. </p>
<p>Hey there! We get that data from the Wunderground API! This tutorial is meant to be a quick, reliable and easy way to see how/if the temperature data inside your home is affected by the outside conditions. I thought it was pretty cool to see all of the outside weather along with the temperature of my home. I've attached a dashboard of just the outside data so you can see a lot of the information you're talking about.</p>
<p>weather conglomerator then? </p><p>I use the ecobee thermostat for exactly this purpose, and yes <a href="https://www.instructables.com/member/JeffreyLoucks" style="">JeffreyLoucks</a>, it's pretty cool to see how outdoor conditions affect your home indoor climate!</p>
<p>Hah, that works! Ecobee looks pretty cool. I'll have to check that out. For now, I'll use my home made system here!</p>
<p>Exactly, I came here hoping it was an outside weather station with temp and wind speed. Oh well. </p>
<p>@ my first run:</p><p>File &quot;wunderground.py&quot;, line 132</p><p> print &quot;Error! Wunderground API call failed, check your STATE and CITY and make sure your Wunderground API key is valid!&quot;</p><p> ^</p><p>SyntaxError: Missing parentheses in call to 'print'</p>
<p>That error usually happens if you don't have a valid STATE or CITY parameter set. What are your STATE and CITY parameters set to? </p>
<p>I was intrigued by and overwhelmed by the 'all you have to is. . . ' description of this project and WAY out of my depth and comfort level but decided to jump in with both feet and give it a go. Looked at the $150 kit price as well as the subscription (after the first free year) and enthusiasm went south for the year, sigh. No longer on my 'I wanna do list'.</p>
<p>You can do the project w/ out the kit if you already have a Raspberry Pi, and a Sense HAT. You can also use the free version of initial state if you leave the MINUTES_BETWEEN_READS line at 15 (minutes) in the user settings section of the sensehat_wunderground.py file then it will be approximately 40,000 data points a month. If you increase it to about 25 (It would read: MINUTES_BETWEEN_READS = 25) then it should fit under 25,000 events for the free account. -- The kit is just the easiest way to get all the materials since the Sense HAT is hard to find right now.</p>
Not really a DIY project - Looks more like an AD!<br><br>BOOO on you!
Nice project would be much better if it was more DIY instead of a purchased product

About This Instructable

50,911views

760favorites

License:

More by JeffreyLoucks:Update a Real Time Dashboard with Google Sheets Create a Scoreboard with the DO Button Create an Interactive Fitbit Dashboard With IFTTT 
Add instructable to: