Skip to content

Commit

Permalink
[oppo] Oppo Blu-ray Player Binding - initial contribution (openhab#7746)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
  • Loading branch information
mlobstein authored and andrewfg committed Aug 31, 2020
1 parent 2523ab0 commit 5a8dc3a
Show file tree
Hide file tree
Showing 27 changed files with 3,019 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
/bundles/org.openhab.binding.openthermgateway/ @ArjenKorevaar
/bundles/org.openhab.binding.openuv/ @clinique
/bundles/org.openhab.binding.openweathermap/ @cweitkamp
/bundles/org.openhab.binding.oppo/ @mlobstein
/bundles/org.openhab.binding.orvibo/ @tavalin
/bundles/org.openhab.binding.paradoxalarm/ @theater
/bundles/org.openhab.binding.pentair/ @jsjames
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@
<artifactId>org.openhab.binding.openweathermap</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.oppo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.orvibo</artifactId>
Expand Down
32 changes: 32 additions & 0 deletions bundles/org.openhab.binding.oppo/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions bundles/org.openhab.binding.oppo/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.oppo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.oppo/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
211 changes: 211 additions & 0 deletions bundles/org.openhab.binding.oppo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
# Oppo UDP-203/205, BDP-103/105, BDP-93/95 & BDP-83 Blu-ray player Binding

This binding can be used to control the Oppo UDP-203/205 or BDP-83/93/95/103/105 Blu-ray player.
Almost all features of the various models of this player line are supported by the binding.
This binding was tested on a BDP-103 only, so there might be issues with other models that will need to be fixed.
Please report any issues found.
Also review the notes below for some important usage caveats.

The binding supports three different kinds of connections:

* direct IP connection (with caveats),
* serial connection,
* serial over IP connection

For users without a serial connector on server side, you can use a serial to USB adapter.

You don't need to have your player device directly connected to your openHAB server.
You can connect it for example to a Raspberry Pi and use [ser2net Linux tool](https://sourceforge.net/projects/ser2net/) to make the serial connection available on LAN (serial over IP).

## Supported Things

There is exactly one supported thing type, which represents the player.
It has the `player` id.

## Discovery

Manually initiated Auto-discovery is supported if the player is accessible on the same IP subnet of the openHAB server.
In the Inbox, select Search For Things and then choose the Oppo Blu-ray Player Binding to initiate discovery.

## Binding Configuration

There are no overall binding configuration settings that need to be set.
All settings are through thing configuration parameters.

## Thing Configuration

The thing has the following configuration parameters:

| Parameter Label | Parameter ID | Description | Accepted values |
|------------------|--------------|----------------------------------------------------------------------------------------------------------------------------------|---------------------------|
| Player Model | model | Specifies what model of player is to be controlled by the binding (required). | 83, 103, 105, 203, or 205 |
| Address | host | Host name or IP address of the Oppo player or serial over IP device. | host name or ip |
| Port | port | Communication port for using serial over IP. Leave blank if using direct IP connection to the player. | ip port number |
| Serial Port | serialPort | Serial port to use for directly connecting to the Oppo player | a comm port name |
| Verbose Mode | verboseMode | (Optional) If true, the player will send time updates every second. If set false, the binding polls the player every 15 seconds. | Boolean; default false |

Some notes:

* If using direct IP connection on the BDP series (83/93/95/103/105), verbose mode is not supported.
* For some reason on these models, the unsolicited status update messages are not generated over the IP socket.
* If fast updates are required on these models, a direct serial or serial over IP connection to the player is required.
* The UDP-20x series should be fully functional over direct IP connection but this was not able to be tested by the developer.
* As previously noted, when using verbose mode, the player will send time code messages once per second while playback is ongoing.
* Be aware that this could cause performance impacts to your openHAB system.
* In non-verbose (the default), the binding will poll the player every 15 seconds to update play time, track and chapter information instead.
* In order for the direct IP connection to work while the player is turned off, the Standby Mode setting must be set to "Quick Start" in the Device Setup menu.
* Likewise if the player is turned off, it may not be discoverable by the Binding's discovery scan.
* If you experience any issues using the binding, first ensure that the player's firmware is up to date with the latest available version (especially on the older models).
* For the older models, some of the features in the control API were added after the players were shipped.
* Available HDMI modes for BDP-83 & BDP-9x: AUTO, SRC, 1080P, 1080I, 720P, SDP, SDI
* Available HDMI modes for BDP-10x: AUTO, SRC, 4K2K, 1080P, 1080I, 720P, SDP, SDI
* Available HDMI modes for UDP-20x: AUTO, SRC, UHD_AUTO, UHD24, UHD50, UHD60, 1080P_AUTO, 1080P24, 1080P50, 1080P60, 1080I50, 1080I60, 720P50, 720P60, 567P, 567I, 480P, 480I
* On Linux, you may get an error stating the serial port cannot be opened when the Oppo binding tries to load.
* You can get around this by adding the `openhab` user to the `dialout` group like this: `usermod -a -G dialout openhab`.
* Also on Linux you may have issues with the USB if using two serial USB devices e.g. Oppo and RFXcom.
* See the [general documentation about serial port configuration](/docs/administration/serial.html) for more on symlinking the USB ports.
* Here is an example of ser2net.conf you can use to share your serial port /dev/ttyUSB0 on IP port 4444 using [ser2net Linux tool](https://sourceforge.net/projects/ser2net/) (take care, the baud rate is specific to the Oppo player):

```
4444:raw:0:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT LOCAL
```

## Channels

The following channels are available:

| Channel ID | Item Type | Description |
|-------------------|-------------|----------------------------------------------------------------------------------------------------------------|
| power | Switch | Turn the power for the player on or off |
| volume | Dimmer | Control the volume for the player (0-100%) |
| mute | Switch | Mute or unmute the volume on the player |
| source | Number | Select the source input for the player (0-6; number of available options varies by model) |
| play_mode | String | Indicates the current playback mode of the player (ReadOnly) |
| control | Player | Simulate pressing the transport control buttons on the remote control (play/pause/next/previous/rew/ffwd) |
| time_mode | String | Sets the time information display mode on the player (T, X, C, K) |
| time_display | Number:Time | The playback time elapsed/remaining in seconds (ReadOnly) |
| current_title | Number | The current title or track number playing (ReadOnly) |
| total_title | Number | The total number of titles or tracks on the disc (ReadOnly) |
| current_chapter | Number | The current chapter number player (ReadOnly) |
| total_chapter | Number | The total number of chapters in the current title (ReadOnly) |
| repeat_mode | String | Sets the current repeat mode (00-06) |
| zoom_mode | String | Sets the current zoom mode (00-12) |
| disc_type | String | The current type of disc in the player (ReadOnly) |
| audio_type | String | The current audio track type (ReadOnly) |
| subtitle_type | String | The current subtitle selected (ReadOnly) |
| aspect_ratio | String | The aspect ratio of the current video output [UDP-203/205 only] (ReadOnly) |
| source_resolution | String | The video resolution of the content being played (ReadOnly) |
| output_resolution | String | The video resolution of the player output (ReadOnly) |
| 3d_indicator | String | Indicates if the content playing is 2D or 3D (ReadOnly) |
| osd_position | Number | Sets the OSD position (0 to 5) [10x models and up] |
| sub_shift | Number | Sets the subtitle shift (-10 to 10) [10x models and up] (note more than 5 from 0 throws an error on the BDP103)|
| hdmi_mode | String | Sets the current HDMI output mode (options vary by model; see notes above for allowed values) |
| hdr_mode | String | Sets current HDR output mode (Auto, On, Off) [UDP-203/205 only] |
| remote_button | String | Simulate pressing a button on the remote control (3 letter code; codes can be found in the API documentation) |

## Full Example

oppo.things:

```java
// direct IP connection
oppo:player:myoppo "Oppo Blu-ray" [ host="192.168.0.10", model=103, verboseMode=false]

// direct serial connection
oppo:player:myoppo "Oppo Blu-ray" [ serialPort="COM5", model=103, verboseMode=true]

// serial over IP connection
oppo:player:myoppo "Oppo Blu-ray" [ host="192.168.0.9", port=4444, model=103, verboseMode=true]
```

oppo.items:

```java
Switch oppo_power "Power" { channel="oppo:player:myoppo:power" }
Dimmer oppo_volume "Volume [%d %%]" { channel="oppo:player:myoppo:volume" }
Switch oppo_mute "Mute" { channel="oppo:player:myoppo:mute" }
Number oppo_source "Source Input [%s]" { channel="oppo:player:myoppo:source" }
String oppo_play_mode "Play Mode [%s]" { channel="oppo:player:myoppo:play_mode" }
Player oppo_control "Control" { channel="oppo:player:myoppo:control" }
String oppo_time_mode "Time Mode [%s]" { channel="oppo:player:myoppo:time_mode" }
Number:Time oppo_time_display "Time [JS(secondsformat.js):%s]" { channel="oppo:player:myoppo:time_display" }
Number oppo_current_title "Current Title/Track [%s]" { channel="oppo:player:myoppo:current_title" }
Number oppo_total_title "Total Title/Track [%s]" { channel="oppo:player:myoppo:total_title" }
Number oppo_current_chapter "Current Chapter [%s]" { channel="oppo:player:myoppo:current_chapter" }
Number oppo_total_chapter "Total Chapter [%s]" { channel="oppo:player:myoppo:total_chapter" }
String oppo_repeat_mode "Repeat Mode [%s]" { channel="oppo:player:myoppo:repeat_mode" }
String oppo_zoom_mode "Zoom Mode [%s]" { channel="oppo:player:myoppo:zoom_mode" }
String oppo_disc_type "Disc Type [%s]" { channel="oppo:player:myoppo:disc_type" }
String oppo_audio_type "Audio Type [%s]" { channel="oppo:player:myoppo:audio_type" }
String oppo_subtitle_type "Subtitle Type [%s]" { channel="oppo:player:myoppo:subtitle_type" }
String oppo_aspect_ratio "Aspect Ratio [%s]" { channel="oppo:player:myoppo:aspect_ratio" }
String oppo_source_resolution "Source Resolution [%s]" { channel="oppo:player:myoppo:source_resolution" }
String oppo_output_resolution "Output Resolution [%s]" { channel="oppo:player:myoppo:output_resolution" }
String oppo_3d_indicator "3D/2D Indicator [%s]" { channel="oppo:player:myoppo:3d_indicator" }
Number oppo_osd_position "OSD Position [%s]" { channel="oppo:player:myoppo:osd_position" }
Number oppo_sub_shift "Subtitle Shift [%s]" { channel="oppo:player:myoppo:sub_shift" }
String oppo_hdmi_mode "HDMI Mode [%s]" { channel="oppo:player:myoppo:hdmi_mode" }
String oppo_hdr_mode "HDR Mode [%s]" { channel="oppo:player:myoppo:hdr_mode" }
String oppo_remote_button "Remote Button [%s]" { channel="oppo:player:myoppo:remote_button" }
```

secondsformat.js:

```java
(function(totalSeconds) {
if (isNaN(totalSeconds)) {
return '-';
} else {
hours = Math.floor(totalSeconds / 3600);
totalSeconds %= 3600;
minutes = Math.floor(totalSeconds / 60);
seconds = totalSeconds % 60;
if ( hours < 10 ) {
hours = '0' + hours;
}
if ( minutes < 10 ) {
minutes = '0' + minutes;
}
if ( seconds < 10 ) {
seconds = '0' + seconds;
}
return hours + ':' + minutes + ':' + seconds;
}
})(input)
```

oppo.sitemap:

```perl
sitemap oppo label="Oppo Blu-ray" {
Frame label="Player" {
Switch item=oppo_power
//Volume can be a Setpoint also
Slider item=oppo_volume minValue=0 maxValue=100 step=1 visibility=[oppo_power==ON] icon="soundvolume"
Switch item=oppo_mute visibility=[oppo_power==ON] icon="soundvolume_mute"
Selection item=oppo_source visibility=[oppo_power==ON] icon="player"
Text item=oppo_play_mode visibility=[oppo_power==ON] icon="zoom"
Default item=oppo_control visibility=[oppo_power==ON]
Selection item=oppo_time_mode visibility=[oppo_power==ON] icon="time"
Text item=oppo_time_display visibility=[oppo_power==ON] icon="time"
Text item=oppo_current_title visibility=[oppo_power==ON] icon="zoom"
Text item=oppo_total_title visibility=[oppo_power==ON] icon="zoom"
Text item=oppo_current_chapter visibility=[oppo_power==ON] icon="zoom"
Text item=oppo_total_chapter visibility=[oppo_power==ON] icon="zoom"
Selection item=oppo_repeat_mode visibility=[oppo_power==ON] icon="none"
Selection item=oppo_zoom_mode visibility=[oppo_power==ON] icon="none"
Text item=oppo_disc_type visibility=[oppo_power==ON] icon="none"
Text item=oppo_audio_type visibility=[oppo_power==ON] icon="none"
Text item=oppo_subtitle_type visibility=[oppo_power==ON] icon="none"
Text item=oppo_aspect_ratio visibility=[oppo_power==ON] icon="none"
Text item=oppo_source_resolution visibility=[oppo_power==ON] icon="video"
Text item=oppo_output_resolution visibility=[oppo_power==ON] icon="video"
Text item=oppo_3d_indicator visibility=[oppo_power==ON] icon="none"
Setpoint item=oppo_osd_position label="OSD Position [%d]" minValue=0 maxValue=5 step=1 visibility=[oppo_power==ON]
Setpoint item=oppo_sub_shift label="Sub Title Shift [%d]" minValue=-10 maxValue=10 step=1 visibility=[oppo_power==ON]
Selection item=oppo_hdmi_mode visibility=[oppo_power==ON] icon="video"
Selection item=oppo_hdr_mode visibility=[oppo_power==ON] icon="colorwheel"
Selection item=oppo_remote_button visibility=[oppo_power==ON]
}
}
```
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.oppo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.8-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.oppo</artifactId>

<name>openHAB Add-ons :: Bundles :: Oppo Binding</name>

</project>
10 changes: 10 additions & 0 deletions bundles/org.openhab.binding.oppo/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.oppo-${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-oppo" description="Oppo Whole House Audio Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-serial</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.oppo/${project.version}</bundle>
</feature>
</features>
Loading

0 comments on commit 5a8dc3a

Please sign in to comment.