-
Notifications
You must be signed in to change notification settings - Fork 297
Twitter helps you create and share ideas and information instantly, without barriers.
This is an extension to weewx that tweets weather data.
You must obtain oauth credentials for your weather station. Login to twitter at
where you can create a new app and obtain the credentials.
wget -O weewx-twitter.zip https://github.com/matthewwall/weewx-twitter/archive/master.zip
-
Install the Twitter Python bindings:
sudo pip install twython
-
Run the extension installer:
NB: you may need to run this as root (preface the following command with 'sudo')
```
weectl extension install weewx-twitter.zip
```
-
Modify weewx.conf:
[StdRESTful] [[Twitter]] app_key = APP_KEY app_key_secret = APP_KEY_SECRET oauth_token = OAUTH_TOKEN oauth_token_secret = OAUTH_TOKEN_SECRET
-
Restart weewx
sudo systemctl stop weewx sudo systemctl start weewx
The message contents are controlled by the format option. For example, to display only the temperature, use this format:
[StdRESTful]
[[Twitter]]
format = "temperature: {outTemp:%.2f}"
The default format contains observations common to most weather stations:
[StdRESTful]
[[Twitter]]
format = "{station:%.8s}: Ws: {windSpeed:%.1f}; Wd: {windDir:%03.0f}; \
Wg: {windGust:%.1f}; oT: {outTemp:%.1f}; oH: {outHumidity:%.2f}; \
P: {barometer:%.3f}; R: {rain:%.3f}"
By default, units are those specified in the [StdConvert]
section of weewx.conf
. To use other units, use the unit_system option:
[StdRESTful]
[[Twitter]]
unit_system = METRICWX # US, METRIC, or METRICWX
By default, the extension will use the archive interval set in the weewx.conf
to post to Twitter. If you don't want to post that often, it is recommended that you add a post_interval
setting.
[StdRESTful]
[[Twitter]]
post_interval = 3600 # 3600 Seconds = 1 hour
Simply run the extension installer then restart weewx. If your weewx.conf
already contained twitter credentials, these should be remembered by the installer.
[StdRESTful] WeatherCloud id = 8db153598f2b97a5 key = 7a15724328403c02e1311e6c62be88fs sudo /etc/init.d/weewx stop sudo /etc/init.d/weewx start