Skip to content

Commit

Permalink
[twitter] rename binding to X (openhab#15809)
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Siepel <[email protected]>
  • Loading branch information
lsiepel authored Nov 15, 2023
1 parent ab0ea34 commit 12f0212
Show file tree
Hide file tree
Showing 19 changed files with 228 additions and 274 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@
/bundles/org.openhab.binding.tplinksmarthome/ @Hilbrand
/bundles/org.openhab.binding.tr064/ @J-N-K
/bundles/org.openhab.binding.tradfri/ @cweitkamp @kaikreuzer
/bundles/org.openhab.binding.twitter/ @computergeek1507
/bundles/org.openhab.binding.unifi/ @mgbowman @Hilbrand
/bundles/org.openhab.binding.unifiedremote/ @GiviMAD
/bundles/org.openhab.binding.upb/ @marcusb
Expand Down Expand Up @@ -386,6 +385,7 @@
/bundles/org.openhab.binding.wled/ @Skinah
/bundles/org.openhab.binding.wolfsmartset/ @BoBiene
/bundles/org.openhab.binding.wundergroundupdatereceiver/ @danieldemus
/bundles/org.openhab.binding.x/ @computergeek1507
/bundles/org.openhab.binding.xmltv/ @clinique
/bundles/org.openhab.binding.xmppclient/ @pavel-gololobov
/bundles/org.openhab.binding.yamahamusiccast/ @coop-git
Expand Down
10 changes: 5 additions & 5 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1761,11 +1761,6 @@
<artifactId>org.openhab.binding.tradfri</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.twitter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.unifi</artifactId>
Expand Down Expand Up @@ -1921,6 +1916,11 @@
<artifactId>org.openhab.binding.wundergroundupdatereceiver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.x</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.xmltv</artifactId>
Expand Down
63 changes: 0 additions & 63 deletions bundles/org.openhab.binding.twitter/README.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

File renamed without changes.
60 changes: 60 additions & 0 deletions bundles/org.openhab.binding.x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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

```text
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:

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

x.items:

```java
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:

```java
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" )
```
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
<version>4.1.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.twitter</artifactId>
<artifactId>org.openhab.binding.x</artifactId>

<name>openHAB Add-ons :: Bundles :: Twitter Binding</name>
<name>openHAB Add-ons :: Bundles :: X Binding</name>

<properties>
<bnd.importpackage>!android.*,!com.android.org.*,!dalvik.*,!javax.annotation.meta.*,!org.apache.harmony.*,!org.conscrypt.*,!sun.*,!com.google.appengine.api.*</bnd.importpackage>
<bnd.importpackage>!org.slf4j.impl.*,!android.*,!com.android.org.*,!dalvik.*,!javax.annotation.meta.*,!org.apache.harmony.*,!org.conscrypt.*,!sun.*,!com.google.appengine.api.*</bnd.importpackage>
</properties>

<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>4.0.7</version>
<version>4.1.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.twitter-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<features name="org.openhab.binding.x-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-twitter" description="Twitter Binding" version="${project.version}">
<feature name="openhab-binding-x" description="X Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.twitter/${project.version}</bundle>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.x/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.twitter.internal;
package org.openhab.binding.x.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

/**
* The {@link TwitterBindingConstants} class defines common constants, which are
* The {@link XBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Scott Hanson - Initial contribution
*/
@NonNullByDefault
public class TwitterBindingConstants {
public class XBindingConstants {

private static final String BINDING_ID = "twitter";
private static final String BINDING_ID = "x";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_ACCOUNT = new ThingTypeUID(BINDING_ID, "account");

// List of all Channel ids
public static final String CHANNEL_LASTTWEET = "lasttweet";
public static final String CHANNEL_LASTPOST = "lastpost";
}
Loading

0 comments on commit 12f0212

Please sign in to comment.