Twitter - weewx/weewx GitHub Wiki

Twitter helps you create and share ideas and information instantly, without barriers.

This is an extension to weewx that tweets weather data.

Credentials

You must obtain oauth credentials for your weather station. Login to twitter at

http://dev.twitter.com/apps

where you can create a new app and obtain the credentials.

Download

wget -O weewx-twitter.zip https://github.com/matthewwall/weewx-twitter/archive/master.zip

How to Install

  1. Install the Twitter Python bindings:

    sudo pip install twython
    
  2. 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
```
  1. Modify weewx.conf:

    [StdRESTful]
        [Twitter](/weewx/weewx/wiki/Twitter)
            app_key = APP_KEY
            app_key_secret = APP_KEY_SECRET
            oauth_token = OAUTH_TOKEN
            oauth_token_secret = OAUTH_TOKEN_SECRET
    
  2. Restart weewx

    sudo systemctl stop weewx
    sudo systemctl start weewx
    

Options

The message contents are controlled by the format option. For example, to display only the temperature, use this format:

[StdRESTful]
    [Twitter](/weewx/weewx/wiki/Twitter)
        format = "temperature: {outTemp:%.2f}"

The default format contains observations common to most weather stations:

[StdRESTful]
    [Twitter](/weewx/weewx/wiki/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](/weewx/weewx/wiki/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](/weewx/weewx/wiki/Twitter)
        post_interval = 3600    # 3600 Seconds = 1 hour

Upgrading from weewx 2.6-2.7

Simply run the extension installer then restart weewx. If your weewx.conf already contained twitter credentials, these should be remembered by the installer.

Source repository

https://github.com/matthewwall/weewx-twitter/