openhab-addons/bundles/org.openhab.binding.x
Jacob Laursen f4596f581e
Update license headers to 2024 (#16168)
* Update copyright year in configuration
* Update license headers
* Manually update nibeheatpump headers (.cpp/.h/.ino)
* Manually update smsmodem header
* Manually update hueemulation header
* Manually update addon-header.xml header

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
2024-01-01 18:14:57 +01:00
..
src/main Update license headers to 2024 (#16168) 2024-01-01 18:14:57 +01:00
NOTICE
pom.xml Apply spotless after release (#16097) 2023-12-22 23:30:38 +01:00
README.md

X Binding

The X (formerly known as Twitter) binding allows your home to post 280 characters at a time. It also supports direct messages and posting with media.

Supported Things

account - X Account.

Thing Configuration

The X Account Thing requires you to create a X App in the X Developer Page.

Property Default Required Description
consumerKey Yes Consumer API Key
consumerSecret Yes Consumer API Secret
accessToken Yes Access Token
accessTokenSecret Yes Access Token Secret
refresh 30 No Post refresh interval in minutes

Channels

channel type description
lastpost String This channel provides the Latest post message

Full Example

x.things:

Thing x:account:sampleaccount [ consumerKey="11111", consumerSecret="22222", accessToken="33333", accessTokenSecret="444444" ]

x.items:

String sample_post   "Latest post: [%s]" { channel="x:account:sampleaccount:lastpost" }

Rule Action

This binding includes rule actions for sending posts and direct messages.

  • boolean success = sendPost(String text)
  • boolean success = sendPostWithAttachment(String text, String URL)
  • boolean success = sendDirectMessage(String recipientID, String text)

Examples:

val postActions = getActions("x","x:account:sampleaccount")
val success  = postActions.sendPost("This is A Post")
val success2 = postActions.sendPostWithAttachment("This is A Post with a Pic", file:///tmp/201601011031.jpg)
val success3 = postActions.sendPostWithAttachment("Windows Picture", "D:\\Test.png" )
val success4 = postActions.sendPostWithAttachment("HTTP Picture", "http://www.mywebsite.com/Test.png" )
val success5 = postActions.sendDirectMessage("1234567", "Wake Up" )