openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.69k forks source link

Implement Twitter Action #287

Closed openhab-bot closed 10 years ago

openhab-bot commented 10 years ago

From teichsta on May 07, 2013 22:40:50

see http://twitter4j.org/en/code-examples.html for more information

Original issue: http://code.google.com/p/openhab/issues/detail?id=287

openhab-bot commented 10 years ago

From ben.jone...@gmail.com on May 07, 2013 23:54:37

Hi - I just pushed a changed to my clone (benjones12-latitude) which includes a new 'Tweet' action (accessed by sendTweet('statusupdate').

The authentication is a bit tricky as Twitter enforces you to use the same request token when authenticating so it has to be done in one session. Therefore I have just added a Thread.wait() for 5 mins, checking for the existence of a 'twitter.pin' file in the openHAB app path (checks every 5s).

So the order of events is;

  1. Start openHAB and ensure some rule is going to try and send a tweet (this should probably be changed to attempt authentication on startup - with a config option to enable/disable tweeting)
  2. Check the log for the authentication URL
  3. Grant access to openHAB for your chosen Twitter account
  4. Copy the generated authentication pin and put inside a file called 'twitter.pin' in format 'pin=' (details in the log message)
  5. Wait a few seconds and openHAB should pick up the temp pin file, authenticate the request and generate/save access tokens in \etc\twitter.token for reuse later.
  6. Tweeting should now work...
openhab-bot commented 10 years ago

From ben.jone...@gmail.com on May 08, 2013 00:17:18

Just pushed a changed relating to 1. in my earlier comment. There is now a 'tweet.enabled=true' flag that needs to be set in openhab.cfg. This will then kick off the authentication process on startup.

openhab-bot commented 10 years ago

From teichsta on May 21, 2013 14:43:42

Owner: ---

openhab-bot commented 10 years ago

From teichsta on May 22, 2013 14:47:45

Status: Started
Owner: teichsta
Labels: -Version-later Version-1.3.0

openhab-bot commented 10 years ago

From teichsta on May 23, 2013 08:14:18

merged TwitterAction into default (see http://code.google.com/p/openhab/source/detail?r=36c4c2c763bd4f7ffe675968667f76f2afe189ff ). Additionally added the sendDirectMessage method

Status: Implemented