Raspberry Weather graph

After all of this hard work, now comes the easy and most satisfying part. Hopefully you have followed the tutorials to this point without any problems. If you want, now is the time to make sure that the readings are successfully stored in the database. Connect to mysql using mysql -u root -p (replace root with correct username, if you’re not using root). You will be prompted for a password, not you Raspbian password but mysql password. Write use WordPressDB; where WordPressDB is the name of the database that you are using for WordPress. Check if there are any readings with select * from temperatures; if you get some output you are ready to go!

Now you need to display these values in a nice graph within WordPress. This part is much easier to do than the previous things, but it still requires some bit of tinkering to fit in your webpage.

Navigate to you Dashboard, Plugins and choose Add new. Search for Raspberry Weather plugin, install and activate it. After the plugin is activated another icon will appear in the Tiny MCE editor. Pressing the icon that resembles a dark sun (see its exact position here) will insert the shortcode inside the new page or post. It will look something like this [linechart title="My weather station temperatures" day="Today" display="Both" v_title="Temperatures" scale="Celsius" width="600px" height="400px" ].

This shortcode contains some extra arguments that help you out with customization of the chart itself. Title holds the title of your chart, it is displayed above the graph. You can enter any text you want instead of the default one. The v_title option contains text for the y-axis, same as before, enter anything you wish. The width and high arguments are pretty self explanatory. Set them to such values as are best for your website, you will have to play around a bit with this part.

With the 1.4 version, you can display readings taken in the last week or in the last month. All you have to do is change the day=”Week”. For last week readings change it to Week, for last month readings change it to day=”Month”. Make sure that you have enough readings to display though.

Notice: The sensor is not positioned properly, at certain parts of the day the temperature is higher than it should be!

Today’s readings

Yesterday’s readings

Last 7 days

Current month

Sample readings