Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Add new binding for LIRC. #2537

Merged
merged 3 commits into from
Jul 12, 2017
Merged

Add new binding for LIRC. #2537

merged 3 commits into from
Jul 12, 2017

Conversation

kabili207
Copy link
Contributor

This binding allows decoding and sending of infrared signals used by most remotes controls via LIRC (and its Windows counterpart WinLIRC).

Each remote that is known by LIRC is represented by a thing with a single channel. This channel is a String type that contains the name of the button the user pressed.

I had considered dynamically creating channels for each button on a remote, but I decided against it as most TV remotes can have upwards of of 30 or more buttons and only one can be activated at any given time.

Signed-off-by: Andrew Nagle kabili@zyrenth.com

Copy link
Contributor

@sjsf sjsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this really good contribution!

I just had a look through and left a few comments - don't panic by the sheer number, it's mostly about blank lines where they don't add to the readability and a few minor remarks where you might want to have a look.

There is only one major question I have. It's about the channel, whether it should be only one for sending AND receiving, or maybe we should split this in two as we are talking about different physical things: one is a button on the remote control which was pressed, the other is a state of a device which should be altered. See also my inline comment about it.

@@ -0,0 +1,11 @@
# binding
binding.lirc.name = <Your localized Binding name>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???

<!-- LIRC Server -->
<bridge-type id="bridge">
<label>LIRC Server</label>
<description>The LIRC Server represents the LIRC Server bridge.</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x representing x doesn't say much. How about "The LIRC Server Bridge"?

</parameter>
<parameter name="portNumber" type="integer" min="0" max="65536" step="1">
<label>Port Number</label>
<description>The port number the LIRC server is listening on.</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The port the LIRC server is listening to

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">

<!-- Sample Thing Type -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Sample", really??


</thing-type>

<!-- Sample Channel Type -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample, really?

}

private void addRemote(ThingUID bridge, String remote) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line

*/
package org.eclipse.smarthome.binding.lirc.internal.messages;

public class LIRCButtonEvent {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here some javadoc is missing

package org.eclipse.smarthome.binding.lirc.internal.messages;

public class LIRCButtonEvent {
String code;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these fields should all be private final

}

public String getCode() {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line

*/
package org.eclipse.smarthome.binding.lirc.internal.messages;

public class LIRCResponse {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javadoc is missing

The binding does not send the number of repeats and does
not support UNIX sockets, so the LIRC server must be
exposed as over TCP.

Signed-off-by: Andrew Nagle <kabili@zyrenth.com>
@kabili207
Copy link
Contributor Author

Okay, I've gone through and updated everything based on your suggestions. Splitting the channel into "event" and "transmit" channels worked nicely and does make a lot more sense.

The way LIRC handles transmitting repeats isn't how most users
expect it to behave. Sending the command "KEY_VOLUMEUP 5" would
actually transmit the volume up code six times. The commit
changes that behavior to be more user-friendly. This also
includes examples on using the binding.

Signed-off-by: Andrew Nagle <kabili@zyrenth.com>
@computerlyrik
Copy link

+1 User wants to use this and gets to test binding with openhab2 on RPi3

Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
@sjsf
Copy link
Contributor

sjsf commented Jul 7, 2017

Thanks a lot for addressing all the comments that quickly and my deepest apologies for then taking ages to getting back to this!

From my point of view this now is good to go. As your PR exceeds 1000 lines of code, we unfortunately have to run it through Eclipse's IP process. This will hopefully only add a few days or additional delay and normally won't impose any work on your side.

The only think I need to ask you is to not push any further commits to here. In case it should be necessary it will have to go through another PR.

@sjsf sjsf added the CQ label Jul 7, 2017
@sjsf
Copy link
Contributor

sjsf commented Jul 7, 2017

For the record: I have submitted this as CQ 13830

@sjsf
Copy link
Contributor

sjsf commented Jul 12, 2017

Good news: the CQ has been approved.

@sjsf sjsf merged commit 28e865a into eclipse-archived:master Jul 12, 2017
@sjsf
Copy link
Contributor

sjsf commented Jul 12, 2017

Thanks!


<config-description>
<parameter name="host" type="text">
<label>The Host</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add context "network-address".

<parameter name="host" type="text">
<label>The Host</label>
<description>The host of the LIRC server</description>
<required>true</required>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a default, you usually should not set required to true.

<default>localhost</default>
</parameter>
<parameter name="portNumber" type="integer" min="0" max="65536" step="1">
<label>Port Number</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Port" should be good enough.

<parameter name="portNumber" type="integer" min="0" max="65536" step="1">
<label>Port Number</label>
<description>The port number the LIRC server is listening to.</description>
<required>true</required>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a default, you usually should not set required to true.

Bundle-SymbolicName: org.eclipse.smarthome.binding.lirc;singleton:=true
Bundle-Vendor: Eclipse.org/SmartHome
Bundle-Version: 0.9.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 1.8

<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2014-2016 by the respective copyright holders.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like an outdated header (should be 2017)

[Install]
WantedBy=multi-user.target
```
By default, LIRC will listen on IP address 0.0.0.0 (any available IP address) and port 8765. If you would
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add an empty line after every code section.

Thing remote Samsung [ remote="Samsung" ]
}
```
Bridge:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add an empty line after every code section.

* **remote**: The name of the remote as known by LIRC

### Items
```xtend
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add an empty line after every header.

```

### Rules
```xtend
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add an empty line after every code header.

@sjsf sjsf mentioned this pull request Jul 18, 2017
@sjsf
Copy link
Contributor

sjsf commented Jul 18, 2017

see #3848

@kabili207
Copy link
Contributor Author

Thank you for taking care of that @SJKA!

@kaikreuzer kaikreuzer added this to the 0.9.0 milestone Nov 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants