If you want to use a direct solution and not have to rely on WeatherCloud as a proxy, I use a Python script and cron (I use a RPI 3). It takes some configuration though. It's been so long since I configured it I might take a while to get it all together if anyone is interested.
EDIT: I think regardless if anyone says yes or no I will go ahead and provide details on how I did this.
Pre-requisites - *must* have Python 3 installed, and must install Twython (the Twitter wrapper for Python 3) The assumption here is that you are doing this using some form of Linux, whether it be a full-fledged version, or the Raspian OS. You must also generate consumer keys and access keys assigned to the app (in my instance I just have a generic). To do this visit
https://dev.twitter.com
Once you have Python 3 and Twython imported (I believe you still do this by issuing the 'pip modulename' command), you create a python script to do what you need. I have mine and will provide it (with tokens masked of course but you'll get the idea).
Code: Select all
#!/usr/bin/env python
from twython import Twython
# delay 5 seconds
import time
time.sleep(5)
# Define constants
CONSUMER_KEY = 'xxxxxxxxxxxxxxxxxxxx'
CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxx'
ACCESS_KEY = 'xxxxxxxxxxxxxxxxxxxx'
ACCESS_SECRET ='xxxxxxxxxxxxxxxxxxxx'
# Create a copy of the Twython object with all our keys and secrets to allow easy commands.
api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET)
text = open('/path/to/generated/tweet.txt','rb') # Cumulus has been set to create tweet.txt by processing tweetT.txt
api.update_status(status=text)
# api.update_status is now deprecated, but works, and is simpler than the below [untested]
#twitter.update_status(status=text)
You will need to create a template file that you generate using the web interval with the tags you want to include in the tweet. As an example, here's what I use (template filename is tweetT.txt) but you can include or exclude whatever you want:
Code: Select all
Temp: <#temp>°F DP: <#dew>°F HtIdx: <#heatindex>°F High today: <#tempTH>°F @ <#TtempTH> Low today: <#tempTL>°F @ <#TtempTL> Wind: <#wdir> @ <#wspeed> mph Baro: <#press> inHg and <#presstrend> Rain Today <#rfall>in Rain for <#shortmonthname>: <#rmonth>in #okwx
Generate the file, and name it whatever you want, but make sure the file reference in the python script above is the path and filename to the file generated.
Once you've done this, I would suggest you test it first before you set to a schedule in a cron job.
Assuming you've named the python script 'twitter.py', issue the following command:
Be patient, it may take a few seconds to complete. There is no progress indicator, but as long as you don't see any error it should work. Once completed, this was what I saw after my test:
2021-11-27_121858.png
If there are any question, please reply here and I will answer them to the best of my ability.