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
[emotiva] Initial contribution #16499
base: main
Are you sure you want to change the base?
Conversation
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/emotiva-av-processor-binding/154406/1 |
The build is failing because your commit it not signed. See here for instructions to fix it: https://github.com/openhab/openhab-addons/pull/16499/checks?check_run_id=22412921872 |
eca824b
to
e3162e3
Compare
3793c64
to
969b223
Compare
bundles/org.openhab.binding.anel/src/main/resources/OH-INF/config/config.xml
Outdated
Show resolved
Hide resolved
...inding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaCommandHandler.java
Outdated
Show resolved
Hide resolved
...inding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaCommandHandler.java
Outdated
Show resolved
Hide resolved
"@text/message.processor.connection.failed"); | ||
disconnect(); | ||
scheduleConnectRetry(retryConnectInMinutes); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking out loud: could (some of) this status updating be moved to handleStatusUpdate()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, the connection method is synchronized and try to make sure the connection is either working or we need to schedule a retry. Suggestions are welcome.
...ding.emotiva/src/main/java/org/openhab/binding/emotiva/internal/EmotivaProcessorHandler.java
Show resolved
Hide resolved
...tiva/src/main/java/org/openhab/binding/emotiva/internal/protocol/EmotivaControlCommands.java
Show resolved
Hide resolved
...ing.emotiva/src/main/java/org/openhab/binding/emotiva/internal/protocol/EmotivaDataType.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.emotiva/src/main/resources/OH-INF/config/config.xml
Show resolved
Hide resolved
bf10246
to
612fde5
Compare
Signed-off-by: Espen Fossen <espenaf@junta.no>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution. Looked at all except the key controller/handlers, will do in a next round.
For each comment, try to check if it can also apply to other parts of the code.
Please check that al SAT errors are fxied and the build comes without any warnings.
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> | ||
|
||
<thing-type id="processor"> | ||
<label>Emotiva Processor Binding Thing</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<label>Emotiva Processor Binding Thing</label> | |
<label>Emotiva Processor</label> |
</channel-group> | ||
<channel-group id="zone2" typeId="zone"> | ||
<label>Zone 2 Control</label> | ||
<description>Channels for zone2 of this processor.</description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<description>Channels for zone2 of this processor.</description> | |
<description>Channels for zone 2 of this processor.</description> |
bundles/org.openhab.binding.emotiva/src/main/resources/OH-INF/thing/thing-types.xml
Show resolved
Hide resolved
<label>General Control</label> | ||
<description>General channels for this processor.</description> | ||
<channels> | ||
<channel id="power" typeId="mainPower"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please adapt all channel names and types to the naming convention.
Details here:
https://www.openhab.org/docs/developer/guidelines.html#naming-convention
<channel-type id="dim"> | ||
<item-type>Number:Percentage</item-type> | ||
<label>Front Panel Dimness</label> | ||
<description>Percentage of dimness: "0", "20", "40", "60", "80", "100"</description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ony those presets are possible, you could provide an option list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dim command only cycles through these values, so one cannot select a specific value.
<name>Emotiva Binding</name> | ||
<description>This is the binding for devices from the Emotiva Audio Corporation.</description> | ||
<connection>local</connection> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if this can be extended with suggestion finder details
https://www.openhab.org/docs/developer/addons/addon.html#discovery-methods
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_SOURCE; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_TUNER_BAND; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_TUNER_CHANNEL_SELECT; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_ZONE2_SOURCE; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_TRIM_MAX_DECIBEL; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_TRIM_MIN_DECIBEL; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_VOLUME_MAX_DECIBEL; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_VOLUME_MIN_DECIBEL; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.MAP_SOURCES_MAIN_ZONE; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.MAP_SOURCES_ZONE_2; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.PROTOCOL_V3_LEVEL_MULTIPLIER; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.TRIM_SET_COMMAND_SUFFIX; | ||
import static org.openhab.binding.emotiva.internal.EmotivaCommandHelper.clamp; | ||
import static org.openhab.binding.emotiva.internal.EmotivaCommandHelper.volumePercentageToDecibel; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.NUMBER; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.SET; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.TOGGLE; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.UP_DOWN_HALF; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.UP_DOWN_SINGLE; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaDataType.FREQUENCY_HERTZ; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaSubscriptionTags.tuner_band; | ||
import static org.openhab.binding.emotiva.internal.protocol.EmotivaSubscriptionTags.tuner_channel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_SOURCE; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_TUNER_BAND; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_TUNER_CHANNEL_SELECT; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.CHANNEL_ZONE2_SOURCE; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_TRIM_MAX_DECIBEL; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_TRIM_MIN_DECIBEL; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_VOLUME_MAX_DECIBEL; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DEFAULT_VOLUME_MIN_DECIBEL; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.MAP_SOURCES_MAIN_ZONE; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.MAP_SOURCES_ZONE_2; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.PROTOCOL_V3_LEVEL_MULTIPLIER; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.TRIM_SET_COMMAND_SUFFIX; | |
import static org.openhab.binding.emotiva.internal.EmotivaCommandHelper.clamp; | |
import static org.openhab.binding.emotiva.internal.EmotivaCommandHelper.volumePercentageToDecibel; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.NUMBER; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.SET; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.TOGGLE; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.UP_DOWN_HALF; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaCommandType.UP_DOWN_SINGLE; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaDataType.FREQUENCY_HERTZ; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaSubscriptionTags.tuner_band; | |
import static org.openhab.binding.emotiva.internal.protocol.EmotivaSubscriptionTags.tuner_channel; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.* | |
import static org.openhab.binding.emotiva.internal.protocol.* |
} | ||
|
||
public EmotivaControlDTO createDTO(Command ohCommand, @Nullable State previousState) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
case UP_DOWN_HALF -> { | ||
if (ohCommand instanceof Number value) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DISCOVERY_BROADCAST_ADDRESS; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DISCOVERY_TIMEOUT_SECONDS; | ||
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.SUPPORTED_THING_TYPES_UIDS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DISCOVERY_BROADCAST_ADDRESS; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.DISCOVERY_TIMEOUT_SECONDS; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.SUPPORTED_THING_TYPES_UIDS; | |
import static org.openhab.binding.emotiva.internal.EmotivaBindingConstants.* |
This PR adds support for Emotiva Audio Corporation AV processors based on the Emotiva Network Remote Control protocol. Discovery is supported.
Binding has only been tested with an XMC-2, so please test and give feedback for other devices.
Has support for all Emotiva notification types in version 2.0 and 3.0 of the protocol, and adds support for almost all commands, has support for Zone 2 controls, browsing and controlling the menu and using the radio tuner.