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. Plugin is incompatible with the latest WordPress version. The icon, which adds the graph, will not be visible. To bypass this, please install Disable Gutenberg plugin. With it, you will get the classic text editor and will be able to add the graph. 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 your 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!

Readings from 10.10.2018

[line_chart title=”My weather station temperatures” day=”10.10.2018″ display=”Temperature” scale=”Celsius” v_title=”Temperatures” width=”600px” height=”400px” ]

Sample readings

[line_chart title=”My weather station temperatures” day=”1.1.2001″ display=”Temperatures” scale=”Celsius” v_title=”Temperatures” width=”600px” height=”400px” ]

Skip to content