| netmenu#item7 | String | The text of USB/Net Menu entry 7 |
| netmenu#item8 | String | The text of USB/Net Menu entry 8 |
| netmenu#item9 | String | The text of USB/Net Menu entry 9 |
+| information#audioIn | String | Details of the input audio format |
+| information#audioOut | String | Details of the output audio format |
+| information#videoIn | String | Details of the input video format |
+| information#videoOut | String | Details of the output video format |
## Rule Actions
String avrLrNet_Item7 "Item7 [%s]" <text> { channel="onkyo:onkyoAVR:avr-livingroom:netmenu#item7" }
String avrLrNet_Item8 "Item8 [%s]" <text> { channel="onkyo:onkyoAVR:avr-livingroom:netmenu#item8" }
String avrLrNet_Item9 "Item9 [%s]" <text> { channel="onkyo:onkyoAVR:avr-livingroom:netmenu#item9" }
+
+String audioIn "Audio In [%s]" <settings> ["Point"] { channel="onkyo:onkyoAVR:avr-livingroom:information#audioIn" }
+String audioOut "Audio Out [%s]" <settings> ["Point"] { channel="onkyo:onkyoAVR:avr-livingroom:information#audioOut" }
+String videoIn "Video In [%s]" <settings> ["Point"] { channel="onkyo:onkyoAVR:avr-livingroom:information#videoIn" }
+String videoOut "Video Out [%s]" <settings> ["Point"] { channel="onkyo:onkyoAVR:avr-livingroom:information#videoOut" }
```
## Sitemap Configuration
Text item=avrLrNet_Item8
Text item=avrLrNet_Item9
}
+ Frame label="Audio & Video Information" {
+ Text item=audioIn
+ Text item=audioOut
+ Text item=videoIn
+ Text item=videoOut
+ }
}
```
public static final String CHANNEL_NET_MENU8 = "netmenu#item8";
public static final String CHANNEL_NET_MENU9 = "netmenu#item9";
+ public final static String CHANNEL_AUDIO_IN_INFO = "info#audioIn";
+ public final static String CHANNEL_AUDIO_OUT_INFO = "info#audioOut";
+ public final static String CHANNEL_VIDEO_IN_INFO = "info#videoIn";
+ public final static String CHANNEL_VIDEO_OUT_INFO = "info#videoOut";
+
// Used for Discovery service
public static final String MANUFACTURER = "ONKYO";
public static final String UPNP_DEVICE_TYPE = "MediaRenderer";
--- /dev/null
+/**
+ * Copyright (c) 2010-2021 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.onkyo.internal;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.core.library.types.StringType;
+
+/**
+ * Helper to parse messages.
+ *
+ * @author Marcel Verpaalen - Initial contribution
+ */
+@NonNullByDefault
+public final class OnkyoParserHelper {
+
+ /**
+ * Slices the string, removing empty values
+ *
+ * @param data comma separated string
+ * @param startIndex initial index of the range to be copied
+ * @param endIndex final index of the range to be copied (inclusive)
+ * @return formatted StringType
+ */
+ public static StringType infoBuilder(String data, int startIndex, int endIndex) {
+ String[] params = data.split(",");
+ int toIndex = endIndex < params.length ? endIndex + 1 : params.length;
+ if (params.length >= startIndex) {
+ return new StringType(Stream.of(Arrays.copyOfRange(params, startIndex, toIndex))
+ .filter(p -> p.trim().length() > 0).map(p -> p.trim()).collect(Collectors.joining(", ", "", "")));
+ }
+ return StringType.EMPTY;
+ }
+}
AUDIOINFO("IFA", ""),
AUDIOINFO_QUERY("IFA", "QSTN"),
+ VIDEOINFO("IFV", ""),
+ VIDEOINFO_QUERY("IFV", "QSTN"),
SOURCE_UP("SLI", "UP"),
SOURCE_DOWN("SLI", "DOWN"),
import org.openhab.binding.onkyo.internal.OnkyoAlbumArt;
import org.openhab.binding.onkyo.internal.OnkyoConnection;
import org.openhab.binding.onkyo.internal.OnkyoEventListener;
+import org.openhab.binding.onkyo.internal.OnkyoParserHelper;
import org.openhab.binding.onkyo.internal.OnkyoStateDescriptionProvider;
import org.openhab.binding.onkyo.internal.ServiceType;
import org.openhab.binding.onkyo.internal.automation.modules.OnkyoThingActions;
connection.openConnection();
if (connection.isConnected()) {
updateStatus(ThingStatus.ONLINE);
-
- sendCommand(EiscpCommand.INFO_QUERY);
- sendCommand(EiscpCommand.AUDIOINFO_QUERY);
+ checkStatus();
}
});
sendCommand(EiscpCommand.AUDIOINFO_QUERY);
}
break;
+
+ /*
+ * MEDIA INFO
+ */
+ case CHANNEL_AUDIO_IN_INFO:
+ case CHANNEL_AUDIO_OUT_INFO:
+ if (command.equals(RefreshType.REFRESH)) {
+ sendCommand(EiscpCommand.AUDIOINFO_QUERY);
+ }
+ break;
+ case CHANNEL_VIDEO_IN_INFO:
+ case CHANNEL_VIDEO_OUT_INFO:
+ if (command.equals(RefreshType.REFRESH)) {
+ sendCommand(EiscpCommand.VIDEOINFO_QUERY);
+ }
+ break;
/*
* MISC
*/
case AUDIOINFO:
updateState(CHANNEL_AUDIOINFO, convertDeviceValueToOpenHabState(data.getValue(), StringType.class));
logger.debug("audioinfo message: '{}'", data.getValue());
+ updateState(CHANNEL_AUDIO_IN_INFO, OnkyoParserHelper.infoBuilder(data.getValue(), 0, 2));
+ updateState(CHANNEL_AUDIO_OUT_INFO, OnkyoParserHelper.infoBuilder(data.getValue(), 3, 5));
+ break;
+ case VIDEOINFO:
+ updateState(CHANNEL_VIDEO_IN_INFO, OnkyoParserHelper.infoBuilder(data.getValue(), 0, 3));
+ updateState(CHANNEL_VIDEO_OUT_INFO, OnkyoParserHelper.infoBuilder(data.getValue(), 4, 7));
break;
case INFO:
processInfo(data.getValue());
sendCommand(EiscpCommand.LISTEN_MODE_QUERY);
sendCommand(EiscpCommand.INFO_QUERY);
sendCommand(EiscpCommand.AUDIOINFO_QUERY);
+ sendCommand(EiscpCommand.VIDEOINFO_QUERY);
if (isChannelAvailable(CHANNEL_POWERZONE2)) {
sendCommand(EiscpCommand.ZONE2_POWER_QUERY);
# channel group types
+channel-group-type.onkyo.information.label = Audio & Video Info
channel-group-type.onkyo.netMenuControls.label = Net/USB Menu
channel-group-type.onkyo.netMenuControls.channel.item0.label = Menu Item 0
channel-group-type.onkyo.netMenuControls.channel.item0.description = Net/USB menu item at position 0
channel-type.onkyo.albumArtUrl.description = Url to the image of cover art of the current song
channel-type.onkyo.artist.label = Artist
channel-type.onkyo.artist.description = Artist name of the current song
+channel-type.onkyo.audioIn.label = Audio Input Info
+channel-type.onkyo.audioIn.description = Audio Input Stream Information
+channel-type.onkyo.audioOut.label = Audio Output Info
+channel-type.onkyo.audioOut.description = Audio Output Stream Information
channel-type.onkyo.audioinfo.label = Audio Info
channel-type.onkyo.audioinfo.description = Detailed audio info
channel-type.onkyo.control.label = Control
channel-type.onkyo.power.description = Power on/off your device
channel-type.onkyo.title.label = Title
channel-type.onkyo.title.description = Title of the current song
+channel-type.onkyo.videoIn.label = Video Input Info
+channel-type.onkyo.videoIn.description = Video Input Stream Information
+channel-type.onkyo.videoOut.label = Video Output Info
+channel-type.onkyo.videoOut.description = Video Output Stream Information
channel-type.onkyo.volume.label = Volume
channel-type.onkyo.volume.description = Volume of your device
</channels>
</channel-group-type>
+ <channel-group-type id="information">
+ <label>Audio & Video Info</label>
+ <channels>
+ <channel id="audioIn" typeId="audioIn"/>
+ <channel id="audioOut" typeId="audioOut"/>
+ <channel id="videoIn" typeId="videoIn"/>
+ <channel id="videoOut" typeId="videoOut"/>
+ </channels>
+ </channel-group-type>
+
</thing:thing-descriptions>
<description>Position of the currently selected menu item</description>
<state readOnly="true" pattern="%s"></state>
</channel-type>
+ <channel-type id="audioIn" advanced="true">
+ <item-type>String</item-type>
+ <label>Audio Input Info</label>
+ <description>Audio Input Stream Information</description>
+ <state readOnly="true" pattern="%s"></state>
+ </channel-type>
+ <channel-type id="audioOut" advanced="true">
+ <item-type>String</item-type>
+ <label>Audio Output Info</label>
+ <description>Audio Output Stream Information</description>
+ <state readOnly="true" pattern="%s"></state>
+ </channel-type>
+ <channel-type id="videoIn" advanced="true">
+ <item-type>String</item-type>
+ <label>Video Input Info</label>
+ <description>Video Input Stream Information</description>
+ <state readOnly="true" pattern="%s"></state>
+ </channel-type>
+ <channel-type id="videoOut" advanced="true">
+ <item-type>String</item-type>
+ <label>Video Output Info</label>
+ <description>Video Output Stream Information</description>
+ <state readOnly="true" pattern="%s"></state>
+ </channel-type>
</thing:thing-descriptions>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone1Controls" id="zone1"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone1Controls" id="zone1"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone2Controls" id="zone2"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>
<channel-group typeId="zone3Controls" id="zone3"/>
<channel-group typeId="playerControls" id="player"/>
<channel-group typeId="netMenuControls" id="netmenu"/>
+ <channel-group typeId="information" id="info"/>
</channel-groups>
<config-description-ref uri="thing-type:onkyo:config"/>