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

Initial contribution of IRtrans 2.0 binding #16

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions addons/binding/org.openhab.binding.irtrans/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.irtrans/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.irtrans</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="irtrans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">

<name>IRtrans Binding</name>
<description>This is the binding for IRtrans (www.irtrans.de) Transceivers</description>
<author>Karel Goderis</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="irtrans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Blaster/Receiver diode connected to an IRtrans transceiver -->
<thing-type id="blaster">
<supported-bridge-type-refs>
<bridge-type-ref id="ethernetbridge" />
</supported-bridge-type-refs>

<label>Blaster</label>
<description>This is an infrared transmitter that can send infrared commands</description>

<channels>
<channel id="io" typeId="io" />
</channels>

<config-description>
<parameter name="led" type="text" required="true">
<label>Led</label>
<description>The Led on which infrared commands will be emitted</description>
</parameter>

<parameter name="remote" type="text" required="true">
<label>Remote</label>
<description>The remote or manufacturer name which's commands will be allowed, as defined in the IRtrans server database and flashed into the transceiver. Can be '*' for any remote</description>
</parameter>

<parameter name="command" type="text" required="true">
<label>Command</label>
<description>The name of the command will be allowed, as defined in the IRtrans server database and flashed into the transceiver. Can be '*' for any command</description>
</parameter>
</config-description>
</thing-type>

<channel-type id="io">
<item-type>String</item-type>
<label>Input/Output channel for infrared commands</label>
<description>The IO channel allows to read infrared commands received by the blaster, as well as to write infrared commands to be sent by the blaster</description>
</channel-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="irtrans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Bridge Thing Type -->
<bridge-type id="ethernet">
<label>IRtrans Ethernet Bridge</label>
<description>This Thing supports the Ethernet (PoE) IRtrans transceiver equipped with an on-board IRDB database </description>

<config-description>
<parameter name="ipAddress" type="text" required="true">
<label>Network Address</label>
<description>Network address of the ethernet transceiver</description>
</parameter>
<parameter name="portNumber" type="integer" required="true">
<label>Port Number</label>
<description>TCP port number of the transceiver service</description>
</parameter>
<parameter name="bufferSize" type="integer" required="false">
<label>Buffer Size </label>
<description>Buffer size used by the TCP socket when sending and receiving commands to the transceiver</description>
<default>1024</default>
</parameter>
<parameter name="refreshInterval" type="integer" required="false">
<label>Refresh interval</label>
<description>Specifies the refresh interval in milliseconds.</description>
<default>50</default>
</parameter>
<parameter name="responseTimeOut" type="integer" required="false">
<label>Response time out interval</label>
<description>Specifies the time milliseconds to wait for a response from the transceiver when sending a command.</description>
<default>100</default>
</parameter>
<parameter name="pingTimeOut" type="integer" required="false">
<label>Ping time out interval</label>
<description>Specifies the time milliseconds to wait for a response from the transceiver when pinging the device</description>
<default>1000</default>
</parameter>
<parameter name="reconnectInterval" type="integer" required="false">
<label>Reconnect interval</label>
<description>Specifies the time seconds to wait before reconnecting to a transceiver after a communication failure</description>
<default>10</default>
</parameter>
</config-description>
</bridge-type>

<channel-type id="blaster">
<item-type>String</item-type>
<label>Blaster Channel</label>
<description>The Blaster Channel allows to send (filtered) infrared commands over the specified blaster led of the transceiver</description>
<config-description>
<parameter name="led" type="text" required="true">
<label>Led</label>
<description>The Led on which infrared commands will be emitted</description>
</parameter>
<parameter name="remote" type="text" required="true">
<label>Led</label>
<description>The remote or manufacturer name which's commands will be allowed, as defined in the IRtrans server database and flashed into the transceiver. Can be '*' for any remote</description>
</parameter>
<parameter name="command" type="text" required="true">
<label>Led</label>
<description>The name of the command will be allowed, as defined in the IRtrans server database and flashed into the transceiver. Can be '*' for any command</description>
</parameter>
</config-description>
</channel-type>

<channel-type id="receiver">
<item-type>String</item-type>
<label>Receiver Channel</label>
<description>The Receiver Channel allows to receive (filtered) infrared commands on the receiver led of the transceiver</description>
<config-description>
<parameter name="remote" type="text" required="true">
<label>Led</label>
<description>The remote or manufacturer name which's commands will be allowed, as defined in the IRtrans server database and flashed into the transceiver. Can be '*' for any remote</description>
</parameter>
<parameter name="command" type="text" required="true">
<label>Led</label>
<description>The name of the command will be allowed, as defined in the IRtrans server database and flashed into the transceiver. Can be '*' for any command</description>
</parameter>
</config-description>
</channel-type>

</thing:thing-descriptions>
21 changes: 21 additions & 0 deletions addons/binding/org.openhab.binding.irtrans/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: IRtrans Binding
Bundle-SymbolicName: org.openhab.binding.irtrans;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
Import-Package: com.google.common.collect,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.types,
org.slf4j,
org.openhab.binding.irtrans,
org.openhab.binding.irtrans.handler,
org.apache.commons.lang
Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.irtrans,
org.openhab.binding.irtrans.handler
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2010-2017 by the respective copyright holders.

All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.binding.irtrans.factory.IRtransHandlerFactory">

<implementation class="org.openhab.binding.irtrans.factory.IRtransHandlerFactory"/>

<service>
<provide interface="org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory"/>
</service>

</scr:component>
97 changes: 97 additions & 0 deletions addons/binding/org.openhab.binding.irtrans/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# IRtrans Binding

This binding integrates infrared receivers and blasters manufactured by IRtrans (www.irtrans.de)

## Supported Things

The *ethernet* Bridge supports the Ethernet (PoE) IRtrans transceiver equipped with an on-board IRDB database. Blasters and receivers are defined as Channels on the Bridge, but one can also define blasters as a *blaster* child Thing on the Bridge.

## Discovery

There is no Discovery feature available.

## Binding Configuration

There is no specific binding configuration required.

## Thing Configuration

The *ethernet* Bridge requires an *ipAddress* IP address and *portNumber* TCP port number in order to configure it. Optionally, one can add the following parameters to the configuration:

*bufferSize* : Buffer size used by the TCP socket when sending and receiving commands to the transceiver (default: 1024)
*refreshInterval* : Specifies the refresh interval, in milliseconds, for status updates (default: 50)
*responseTimeOut* : Specifies the time milliseconds to wait for a response from the transceiver when sending a command (default: 100)
*pingTimeOut* : Specifies the time milliseconds to wait for a response from the transceiver when pinging the device (default: 1000)
*reconnectInterval* : Specifies the time seconds to wait before reconnecting to a transceiver after a communication failure (default: 10)

The *blaster* Thing requires a *led* parameter to specify on which infrared commands will be emitted, *remote* the remote or manufacturer name which's commands will be allowed, as defined in the IRtrans server database that is flashed into the transceiver (can be '*' for 'any' remote), and *command* the name of the command will be allowed, as defined in the IRtrans server database that is flashed into the transceiver (can be '*' for 'any' command).

## Channels

The *ethernet* Thing supports the following Channel Types:

| Channel Type ID | Item Type | Description |
|-----------------|-----------|-------------------------------------------------------------------------------------|
| blaster | String | Send (filtered) infrared commands over the specified blaster led of the transceiver |
| receiver | String | Receive (filtered) infrared commands on the receiver led of the transceiver |

The *blaster* Channel Type requires a *led* configuration parameter to specify on which infrared commands will be emitted, *remote* the remote or manufacturer name which's commands will be allowed, as defined in the IRtrans server database that is flashed into the transceiver (can be '*' for 'any' remote), and *command* the name of the command will be allowed, as defined in the IRtrans server database that is flashed into the transceiver (can be '*' for 'any' command).

The *receiver* Channel Type requires *remote* the remote or manufacturer name which's commands will be allowed, as defined in the IRtrans server database that is flashed into the transceiver (can be '*' for 'any' remote), and *command* the name of the command will be allowed, as defined in the IRtrans server database that is flashed into the transceiver (can be '*' for 'any' command).

The *blaster* Thing supports a *io* Channel (of Item Type String) that allows to read infrared commands received by the blaster, as well as to write infrared commands to be sent by the blaster.

The IRtrans transceivers store infrared commands in a "remote,command" table, e.g. "telenet,power". Sending the literal text string "telenet,power" to the transceiver will make the transceiver "translate" that into the actual infrared command that will be emitted by the transceiver. A "remote,command" string sent to a Channel that does not match the defined filter will be ignored.

## Full Example

demo.things:
```
Bridge irtrans:ethernet:kitchen [ ipAddress="192.168.0.56", portNumber=21000, bufferSize=1024, refreshInterval=50, responseTimeOut=100, pingTimeOut=2000, reconnectInterval=10 ]
{
Channels:
Receiver : any [remote="*", command="*"]
Receiver : telenet_power [remote="telenet", command="power"]
Blaster : samsung [led="E", remote="samsung", command="*"]
}
```

In the above example, the first channel will be updated when any IR command from any type of device is received. The second channel will only be updated if a "power" infrared command from the remote/device type "telenet" is received. The third channel can be used to feed any type of infrared command to a Samsung television by means of the "E" emitter of the IRtrans device.

```
Bridge irtrans:ethernet:technicalfacilities [ ipAddress="192.168.0.58", portNumber=21000, bufferSize=1024, refreshInterval=50, responseTimeOut=100, pingTimeOut=2000, reconnectInterval=10 ]
{
Channels:
Receiver : any [remote="*", command="*"]
Blaster : telenet1 [led="2", remote="telenet", command="*"]
Blaster : telenet2 [led="1", remote="telenet", command="*"]
Blaster : appletv [led="3", remote="appletv", command="*"]
}
```

In the above channel a single IRtrans transceiver has 3 output leds in use, 2 to drive 2 DTV SetTopBoxes, and a third one to drive an Apple TV device.

demo.items:
```
String KitchenIRReceiverAny {channel="irtrans:ethernet:kitchen:any"}
String KitchenIRReceiverTelenetPower {channel="irtrans:ethernet:kitchen:telenet_power"}
String KitchenIRBlasterSamsung {channel="irtrans:ethernet:kitchen:samsung"}

String TechnicalFacilitiesIRReceiverAny {channel="irtrans:ethernet:technicalfacilities:any"}
String TechnicalFacilitiesIRBlasterTelenet2 {channel="irtrans:ethernet:technicalfacilities:telenet2"}
String TechnicalFacilitiesIRBlasterTelenet1 {channel="irtrans:ethernet:technicalfacilities:telenet1"}
String TechnicalFacilitiesIRBlasterAppleTV {channel="irtrans:ethernet:technicalfacilities:appletv"}
```

demo.rules:

```
rule "Kitchen switch IR rule"
when
Item KitchenIRReceiverTelenetPower received update
then
createTimer(now.plusSeconds(5)) [|
KitchenIRBlasterSamsung.sendCommand("samsung,power")
]
end
```
32 changes: 32 additions & 0 deletions addons/binding/org.openhab.binding.irtrans/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>

<p>March 30, 2017</p>
<h3>License</h3>

<p>
The openHAB community makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>

<p>
If you did not receive this Content directly from the openHAB community, the Content is
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.openhab.org/">openhab.org</a>.
</p>

</body>
</html>
8 changes: 8 additions & 0 deletions addons/binding/org.openhab.binding.irtrans/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source.. = src/main/java/
output.. = target/classes
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
ESH-INF/,\
about.html

19 changes: 19 additions & 0 deletions addons/binding/org.openhab.binding.irtrans/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.binding</groupId>
<artifactId>pom</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>org.openhab.binding</groupId>
<artifactId>org.openhab.binding.irtrans</artifactId>
<version>2.1.0-SNAPSHOT</version>

<name>IRtrans Binding</name>
<packaging>eclipse-plugin</packaging>

</project>
Loading