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

[dolbycp] Initial Contribution #16216

Merged
merged 26 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
888c019
Added new binding cp750
Cybso Jan 5, 2024
6bd172a
Changed binding name to 'dolbycp' as suggested in pull request discus…
Cybso Jan 7, 2024
b49c3a5
Implemented changes requested in pull request
Cybso Jan 8, 2024
95e2b60
Merge branch 'main' into cp750
Cybso Jan 8, 2024
6180cbb
Applied spotless after merge to bundles/pom.xml
Cybso Jan 8, 2024
5136860
Applied changes required by Sat
Cybso Jan 8, 2024
e868983
Fixed style / null checks on DolbyCPHandler
Cybso Jan 8, 2024
049593e
The last commit introduced a new bug which is resolved by this one
Cybso Jan 8, 2024
f669c60
And spotless again...
Cybso Jan 8, 2024
9ac4ad3
More changes from review
Cybso Jan 8, 2024
5f384d8
More changes from review
Cybso Jan 9, 2024
02f5fe7
Update bundles/org.openhab.binding.dolbycp/README.md
Cybso Jan 16, 2024
adf4877
Update bundles/org.openhab.binding.dolbycp/README.md
Cybso Jan 16, 2024
8233d75
From review request: removed channel prefix, unnecessary file and cla…
Cybso Jan 16, 2024
33bbb36
Update bundles/org.openhab.binding.dolbycp/src/main/java/org/openhab/…
Cybso Jan 21, 2024
45cac6b
Update bundles/org.openhab.binding.dolbycp/src/main/java/org/openhab/…
Cybso Jan 21, 2024
c002f77
Update bundles/org.openhab.binding.dolbycp/src/main/java/org/openhab/…
Cybso Jan 21, 2024
9512f79
Update bundles/org.openhab.binding.dolbycp/src/main/java/org/openhab/…
Cybso Jan 21, 2024
068921a
Updated default translations
Cybso Jan 21, 2024
6b067a2
Added dependencies
Cybso Jan 21, 2024
0bee7dc
A refresh interval of 0 does not make any sense in this context
Cybso Jan 26, 2024
bac7738
Code refactoring based on suggestions in pull request
Cybso Feb 7, 2024
e8f9d04
Moved 'osversion' into property
Cybso Feb 7, 2024
20b55ee
Update bundles/org.openhab.binding.dolbycp/README.md
Cybso Feb 10, 2024
62ca473
Update bundles/org.openhab.binding.dolbycp/src/main/resources/OH-INF/…
Cybso Feb 10, 2024
d50ed88
Update bundles/org.openhab.binding.dolbycp/src/main/java/org/openhab/…
Cybso Feb 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -77,6 +77,7 @@
/bundles/org.openhab.binding.digitalstrom/ @openhab/add-ons-maintainers
/bundles/org.openhab.binding.dlinksmarthome/ @MikeJMajor
/bundles/org.openhab.binding.dmx/ @openhab/add-ons-maintainers
/bundles/org.openhab.binding.dolbycp/ @Cybso
/bundles/org.openhab.binding.dominoswiss/ @Friesoch
/bundles/org.openhab.binding.doorbird/ @mhilbush
/bundles/org.openhab.binding.draytonwiser/ @andrew-schofield
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Expand Up @@ -376,6 +376,11 @@
<artifactId>org.openhab.binding.dmx</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.dolbycp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.dominoswiss</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.dolbycp/NOTICE
@@ -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
49 changes: 49 additions & 0 deletions bundles/org.openhab.binding.dolbycp/README.md
@@ -0,0 +1,49 @@
# DolbyCP Binding

This binding is intended to connect to a _Dolby Digital Cinema Processor CP750_.
Support for CP950 may be added in future (if someone who owns one helps to test it).

It uses ASCII commands send over a TCP connection on port 61408. Please note that the CP750 only accepts up to 20 simultaneous connection and will discard the oldest connection if a 21st connection is established. So be sure to grateful shutdown each connection using the client's close() method, or it's AutoCloseable functionality.

This binding wraps the CP750 Java library from https://github.com/Cybso/cp750-java/.

This project is NOT affiliated with, funded, or in any way associated with Dolby Laboratories, Inc.

Currently, only _Fader_, _Mute_ and _Input Mode_ channels are implemented.

Cybso marked this conversation as resolved.
Show resolved Hide resolved
## Supported Things

- `cp750`
Cybso marked this conversation as resolved.
Show resolved Hide resolved

## Thing Configuration

Normally, only the hostname or IP address must be configured.

### `sample` Thing Configuration

| Name | Type | Description | Default | Required | Advanced |
|-------------------|---------|---------------------------------------------------|---------|----------|----------|
| hostname | text | Hostname or IP address of the device | N/A | yes | no |
| port | integer | TCP port if different from 61408 | 61408 | no | no |
| refreshInterval | integer | Interval the device is polled in sec. | 5 | no | no |
| reconnectInterval | integer | Interval a new connection is tried after IO error | 10 | no | no |
Cybso marked this conversation as resolved.
Show resolved Hide resolved

## Channels

_Here you should provide information about available channel types, what their meaning is and how they can be used._

_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/OH-INF/thing``` of your binding._

| Channel | Type | Read/Write | Description |
|---------|--------|------------|-----------------------------------------------------------------------------------------------------------------|
| version | Switch | R | Version as reported by the device |
| fader | Dimmer | RW | Fader value (0 to 100) |
| mute | Switch | RW | Mute (ON or OFF) |
| input | String | RW | Input channel as string (one of "analog", "dig-1", "dig-2", "dig-3", "dig-4", "non-sync" or "mic") |
| analog | Switch | RW | Is ON if input mode is 'analog'. When an ON command is retrieved, input mode will be changed to this channel. |
| dig1 | Switch | RW | Is ON if input mode is 'dig-1'. When an ON command is retrieved, input mode will be changed to this channel. |
| dig2 | Switch | RW | Is ON if input mode is 'dig-2'. When an ON command is retrieved, input mode will be changed to this channel. |
| dig3 | Switch | RW | Is ON if input mode is 'dig-3'. When an ON command is retrieved, input mode will be changed to this channel. |
| dig4 | Switch | RW | Is ON if input mode is 'dig-4'. When an ON command is retrieved, input mode will be changed to this channel. |
| nonsync | Switch | RW | Is ON if input mode is 'non-sync'. When an ON command is retrieved, input mode will be changed to this channel. |
| mic | Switch | RW | Is ON if input mode is 'mic'. When an ON command is retrieved, input mode will be changed to this channel. |
26 changes: 26 additions & 0 deletions bundles/org.openhab.binding.dolbycp/pom.xml
@@ -0,0 +1,26 @@
<?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 https://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>4.2.0-SNAPSHOT</version>
</parent>

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

<name>openHAB Add-ons :: Bundles :: DolbyCP Binding</name>
lsiepel marked this conversation as resolved.
Show resolved Hide resolved

<dependencies>
<dependency>
<groupId>de.cybso.cp750</groupId>
<artifactId>cp750</artifactId>
<version>0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.dolbycp-${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-dolbycp" description="DolbyCP Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.dolbycp/${project.version}</bundle>
</feature>
</features>
@@ -0,0 +1,44 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.dolbycp.internal;

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

/**
* The {@link DolbyCPBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Roland Tapken - Initial contribution
*/
@NonNullByDefault
public class DolbyCPBindingConstants {

private static final String BINDING_ID = "dolbycp";

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

// List of all Channel ids
public static final String CHANNEL_FADER = "channel-fader";
Cybso marked this conversation as resolved.
Show resolved Hide resolved
public static final String CHANNEL_MUTE = "channel-mute";
public static final String CHANNEL_INPUT = "channel-input";
public static final String CHANNEL_ANALOG = "channel-analog";
public static final String CHANNEL_DIG1 = "channel-dig1";
public static final String CHANNEL_DIG2 = "channel-dig2";
public static final String CHANNEL_DIG3 = "channel-dig3";
public static final String CHANNEL_DIG4 = "channel-dig4";
public static final String CHANNEL_NONSYNC = "channel-nonsync";
public static final String CHANNEL_MIC = "channel-mic";
public static final String CHANNEL_VERSION = "channel-version";
}
@@ -0,0 +1,43 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.dolbycp.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link DolbyCPConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Roland Tapken - Initial contribution
*/
@NonNullByDefault
public class DolbyCPConfiguration {
/**
* Hostname or IP address of the CP750 device
*/
public String hostname = "";

/**
* TCP Port to connect o (default: 61408)
*/
public int port = 61408;

/**
* Interval to update channels
Cybso marked this conversation as resolved.
Show resolved Hide resolved
*/
public int refreshInterval = 5;

/**
* Reconnect interval after a broken TCP connection
Cybso marked this conversation as resolved.
Show resolved Hide resolved
*/
public int reconnectInterval = 10;
}