Twitter binding in OpenHAB2

Hi,

I would like to use Twitter binding in OpenHAB2 but the following error occured during Twitter integration process :

2015-10-07 22:49:28.559 [INFO ] [o.o.a.t.i.TwitterActionService] - ################################################################################################
2015-10-07 22:49:28.560 [INFO ] [o.o.a.t.i.TwitterActionService] - # Twitter-Integration: U S E R   I N T E R A C T I O N   R E Q U I R E D !!
2015-10-07 22:49:28.562 [INFO ] [o.o.a.t.i.TwitterActionService] - # 1. Open URL 'https://api.twitter.com/oauth/authorize?oauth_token=xxx'
2015-10-07 22:49:28.563 [INFO ] [o.o.a.t.i.TwitterActionService] - # 2. Grant openHAB access to your Twitter account
2015-10-07 22:49:28.564 [INFO ] [o.o.a.t.i.TwitterActionService] - # 3. Create an empty file 'twitter.pin' in your openHAB home directory
2015-10-07 22:49:28.565 [INFO ] [o.o.a.t.i.TwitterActionService] - # 4. Add the line 'pin=<authpin>' to the twitter.pin file
2015-10-07 22:49:28.566 [INFO ] [o.o.a.t.i.TwitterActionService] - # 5. openHAB will automatically detect the file and complete the authentication process
2015-10-07 22:49:28.566 [INFO ] [o.o.a.t.i.TwitterActionService] - # NOTE: You will only have 5 mins before openHAB gives up waiting for the pin!!!
2015-10-07 22:49:28.566 [INFO ] [o.o.a.t.i.TwitterActionService] - ################################################################################################
2015-10-07 22:49:30.060 [INFO ] [ui.internal.servlet.PaperUIApp] - Started Paper UI at /ui
2015-10-07 22:49:30.460 [INFO ] [.service.AbstractActiveService] - Exec Refresh Service has been started
2015-10-07 22:49:30.474 [INFO ] [.service.AbstractActiveService] - HTTP Refresh Service has been started
2015-10-07 22:49:30.687 [INFO ] [.u.d.internal.DashboardService] - Started dashboard at /start
2015-10-07 22:49:31.079 [INFO ] [.s.u.c.i.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2015-10-07 22:49:31.204 [INFO ] [.o.core.internal.CoreActivator] - openHAB runtime has been started (v2.0.0, build 201510060108).
2015-10-07 22:50:44.754 [ERROR] [o.o.a.t.i.TwitterActionService] - Failed to authenticate openHAB against Twitter
java.io.FileNotFoundException: etc/twitter.token (No such file or directory)
	at java.io.FileOutputStream.open0(Native Method) ~[na:1.8.0_45-internal]
	at java.io.FileOutputStream.open(FileOutputStream.java:270) ~[na:1.8.0_45-internal]
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213) ~[na:1.8.0_45-internal]
	at java.io.FileOutputStream.<init>(FileOutputStream.java:162) ~[na:1.8.0_45-internal]
	at org.openhab.action.twitter.internal.TwitterActionService.saveProperties(TwitterActionService.java:216) [bundleFile:na]
	at org.openhab.action.twitter.internal.TwitterActionService.saveToken(TwitterActionService.java:212) [bundleFile:na]
	at org.openhab.action.twitter.internal.TwitterActionService.getAccessToken(TwitterActionService.java:169) [bundleFile:na]
	at org.openhab.action.twitter.internal.TwitterActionService.start(TwitterActionService.java:104) [bundleFile:na]
	at org.openhab.action.twitter.internal.TwitterActionService.updated(TwitterActionService.java:253) [bundleFile:na]
	at org.eclipse.equinox.internal.cm.ManagedServiceTracker$1.run(ManagedServiceTracker.java:276) [org.eclipse.equinox.cm_1.1.0.v20131021-1936.jar:na]
	at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:36) [org.eclipse.equinox.cm_1.1.0.v20131021-1936.jar:na]
2015-10-07 22:50:44.755 [INFO ] [o.o.a.t.i.TwitterActionService] - Twitter authentication failed. Please use OSGi console to restart the org.openhab.io.net-Bundle and re-initiate the authorization process!

My execution environment is :

Did anyone succeed in using Twitter binding in OH2 ? : :relieved:

Sorry, I missed this post and just saw it now. There is indeed a problem with this action and I have entered https://github.com/openhab/openhab/issues/3454 to have it fixed.

Thanks for reporting!
Kai

Hi @Kai,

I have founded a workaround until a fix to your PR 3454. My workaround consists of adding a folder etc/ in the <OH2_home> folder.

Thanks for your response,
Nicolas

1 Like

@nokyyz, we have a fix merged into master now, it should be contained in tonights jenkins build.

Could you install a fresh SNAPSHOT tomorrow, rename your etc/ folder, and test again?

Regards,
Hakan