Automatically Publish Current Conditions to a Twitter Account – Part 8

Previous: Download and Install Weewx – Part 7

From the Beginning: An Introduction – Part 1

Publishing current conditions to a Twitter account certainly isn’t required. Weewx and your Meteotemplate website will continue to work just fine. If you’re happy with that, that’s fine. You can stop here. You’re done. Congratulations!!!

If you do want to publish updates to Twitter, read on…

This image has an empty alt attribute; its file name is current_conditions_twitter-1024x580.png

It took a lot of research and trial and error, but I finally figured out how to publish current conditions from my weather station(s) to Twitter. I’ll spare you the details of what didn’t work the way I wanted it to, and skip to what did work.

This image has an empty alt attribute; its file name is weewx_rss_feed.png

You can find your Weewx website’s RSS feed by going to your Weewx website. Copy/paste it somewhere safe and save it. You’ll be using it, but replacing the local IP address part with your external IP.

If you want to control what details appear in your RSS feed, and thus your Twitter feed, you’ll need to edit the weewx_rss.xml.tmpl file.

This image has an empty alt attribute; its file name is RPI_edit_weewx_rss_xml_tmpl-1024x768.png

I strongly recommend creating a backup of the Weewx RSS file. You can find it by looking in the folder (not using Terminal) found in the following command To edit the Weewx RSS file, type (please note all commands are case sensitive):

sudo nano /etc/weewx/skins/Standard/RSS/weewx_rss.xml.tmpl (and press enter)

If at any point you make a mistake or want to start over, DO NOT SAVE the file. Press CTRL+X, N (for no), and enter. Then reopen the RSS file.

What you see in the image above is not what the original file looks like.

Click the image to view it full-size, and change the file so it looks like what you see in the image.

Then, in that file, scroll down a bit. You need to change the section between <p> and </p>. It’s very similar to the other section, but slightly different. Time, Temp, Wind Chill, Heat Index, etc. Feel free to *carefully* copy/paste (using ‘paste’ in the Edit menu). It will paste to wherever the cursor is. Do NOT use CTRL+C and CTRL+V.

Time: $current.dateTime<br/>
Temp: $current.outTemp<br/>
Wind Chill: $current.windchill<br/>
Heat Index: $current.heatindex<br/>
Dewpoint: $current.dewpoint<br/>
Humidity: $current.outHumidity<br/>
Barometer: $current.barometer<br/>
Wind: $current.windSpeed from $current.windDir.ordinal_compass<br/>
Max Wind Gust this hour: $span($hour_delta=1).windGust.max<br/>
Rain Rate: $current.rainRate<br/>

When you’re done, it should look like this:

When you’re done editing the file, press CTRL+X, then Y (yes), and press enter, and it will save and close the file. While still in Terminal, for good measure, restart Weewx or simply reboot (sudo reboot):

sudo /etc/init.d/weewx restart

Changes may not take effect immediately, so on to the next step while you wait…

This image has an empty alt attribute; its file name is dlvr_it_pro_plan-1024x524.png

I tried a few different services that publish RSS feed items to Twitter, including IFTTT, Zapier, and finally found my ideal solution with Many IFTTT “applets” will do the job, but IFTTT is free, and is limited to 100 posts per day, which may be adequate depending on how often you set Weewx to update. Zapier also does the job, but I found their setup too complicated and their pricing too expensive ($250/year), and they only post a max of 250 tweets per day.

Then I checked out It’s $99 USD per year, allows unlimited posts to Twitter per day, and plays nice with the Weewx RSS feed. Nothing complicated about it, either.

Why would I want unlimited posts to Twitter, you may ask? Twitter’s own daily tweet daily limit is 2,500. No one will read or care about all those posts, we can all agree on that. Twitter is about real-time updates, and my weather stations and Weewx is setup to update every 5 minutes, because weather conditions can change quickly at times. People generally don’t care what the weather was like 5 minutes ago, they want to know what it’s like right now, so past tweets don’t matter a lot. Not a lot of people subscribe to my weather stations’ Twitter updates, and that’s fine, but those that do appreciate it, and so do I, as I always have Tweetdeck open. Regardless, it’s been part of a fun project for me.

This image has an empty alt attribute; its file name is dlvr_it_leducweather1-1024x466.png

Once you’ve subscribed to the Pro plan, and after you’ve created a Twitter account and linked it to your account, create a new “feed”. On the ‘Detail’ tab, copy/paste your Weewx’s RSS feed address (using the external IP).

This image has an empty alt attribute; its file name is dlvr_it_leducweather2.png

On the ‘Updates’ tab, you can choose the frequently of how often checks the RSS feed for new items.

Weewx sends out more than just current conditions in each RSS feed update, so choose ‘1’ max update per post to just grab the current conditions part.

Don’t worry about the ‘Max posts per day’ field. I asked about that. They said they allow unlimited posts per day up to Twitter’s own limit, and couldn’t explain why that field is there.

This image has an empty alt attribute; its file name is dlvr_it_leducweather3.png

On the ‘Advanced’ tab, choose ‘Prefer Full Content’ under ‘Body Posting Options’.

This image has an empty alt attribute; its file name is dlvr_it_leducweather4-1024x410.png

Click the feed your want to modify, and click the Settings ‘gear’ icon.

This image has an empty alt attribute; its file name is dlvr_it_leducweather_output_no_url.png

On the ‘Settings’ page, under ‘Post Options’, turn off ‘Post Title’, turn on ‘Post Body’, and turn off ‘Post Url’. These will ensure that only the current conditions are posted as Twitter updates, and nothing else.

That’s it, it should pull from the Weewx RSS feed and start posting shortly. If it doesn’t, you’ll have to investigate what’s happening. Everything I’ve described has worked for me, so hopefully it works for you. If it does, once again, you’re awesome, congratulations!!!

Once you have everything working the way you want it to, I *strongly* recommend creating a system image of your RPi’s MicroSD card using Win32 Disk Imager (free) using this very handy guide from the Pi Hut, and put the image somewhere safe. At least once a month, I recommend connecting to your RPi and doing updates via Terminal (sudo apt-get update, sudo apt-get upgrade), and restarting to ensure your RPi continues working smoothly.

You can find my weather stations websites, Facebook pages, and Twitter accounts here.

Side note: please do NOT reach out to me for any kind of technical support or help regarding this guide. Though you’re welcome to connect with me in general via email or on Twitter via my Contact page. I will not be held responsible for any actions you take during your own weather station website project setup. My only advice is to backup any files before you make changes, and be very careful and deliberate when making those changes. Best of luck to you!

Previous: Download and Install Weewx – Part 7

Next: Publishing Weather Station Data to Third Party Websits – Part 9

From the Beginning: An Introduction – Part 1