Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[twitter] rename binding to X #15809

Merged
merged 18 commits into from
Nov 15, 2023
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,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 @@ -385,6 +384,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 @@ -1756,11 +1756,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 @@ -1916,6 +1911,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.

63 changes: 63 additions & 0 deletions bundles/org.openhab.binding.x/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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 |
lsiepel marked this conversation as resolved.
Show resolved Hide resolved

## Full Example

x.things:

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

lsiepel marked this conversation as resolved.
Show resolved Hide resolved
```

x.items:

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

lsiepel marked this conversation as resolved.
Show resolved Hide resolved
```

## 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 postpostActions = getActions("x","x:account:sampleaccount")
lsiepel marked this conversation as resolved.
Show resolved Hide resolved
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" )

lsiepel marked this conversation as resolved.
Show resolved Hide resolved
```
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