]> git.basschouten.com Git - openhab-addons.git/commitdiff
[onkyo] Add audio info channel (IFA Eiscp command) (#10483)
authorJared <39014663+baku104788@users.noreply.github.com>
Fri, 16 Apr 2021 19:41:40 +0000 (14:41 -0500)
committerGitHub <noreply@github.com>
Fri, 16 Apr 2021 19:41:40 +0000 (21:41 +0200)
* Add audio info channel

Signed-off-by: Jared <39014663+baku104788@users.noreply.github.com>
* Audio Info Channel implementation

Signed-off-by: Jared <39014663+baku104788@users.noreply.github.com>
* remove extra backup file

Signed-off-by: Jared <39014663+baku104788@users.noreply.github.com>
* Update readme info for audioinfo

Signed-off-by: Jared <39014663+baku104788@users.noreply.github.com>
bundles/org.openhab.binding.onkyo/README.md
bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/OnkyoBindingConstants.java
bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/eiscp/EiscpCommand.java
bundles/org.openhab.binding.onkyo/src/main/java/org/openhab/binding/onkyo/internal/handler/OnkyoHandler.java
bundles/org.openhab.binding.onkyo/src/main/resources/OH-INF/thing/channel-groups.xml
bundles/org.openhab.binding.onkyo/src/main/resources/OH-INF/thing/channels.xml

index 18d82a7398eda414cdd55b0447efa6d3559563b2..2417065446d2f2afc01c88f3f92919abf4b9ea1c 100644 (file)
@@ -150,6 +150,7 @@ The Onkyo AVR supports the following channels (some channels are model specific)
 | player#artist             | String    | Artist name of the current song (available if playing from Network or USB)                                      |
 | player#currentPlayingTime | String    | Current playing time of the current song (available if playing from Network or USB)                             |
 | player#listenmode         | Number    | Current listening mode e.g. Stereo, 5.1ch Surround, ...                                                         |
+| player#audioinfo          | String    | Current audio info (Refresh timer must be configured for updates)                                                     |     
 | player#playuri            | String    | Plays the URI provided to the channel                                                                           |
 | player#albumArt           | Image     | Image of the current album art of the current song                                                              |
 | player#albumArtUrl        | String    | URL to the current album art of the current song                                                                |
index 11ccab65bc63d5e668dc6d8c8db33fc433591c23..07b64c9391dba9d6717afaebc81a90b3cdb5421d 100644 (file)
@@ -73,6 +73,7 @@ public class OnkyoBindingConstants {
     public static final String CHANNEL_ALBUM_ART = "player#albumArt";
     public static final String CHANNEL_ALBUM_ART_URL = "player#albumArtUrl";
     public static final String CHANNEL_LISTENMODE = "player#listenmode";
+    public static final String CHANNEL_AUDIOINFO = "player#audioinfo";
     public static final String CHANNEL_PLAY_URI = "player#playuri";
 
     public static final String CHANNEL_NET_MENU_TITLE = "netmenu#title";
index 018c0b66be2ad5206a4182034949d4381e47f59f..41b1a8ab9bf0b9f93ec5c5cdba1f48ed8eeccb14 100644 (file)
@@ -38,6 +38,9 @@ public enum EiscpCommand {
     VOLUME_SET("MVL", "%02X"),
     VOLUME("MVL", ""),
 
+    AUDIOINFO("IFA", ""),
+    AUDIOINFO_QUERY("IFA", "QSTN"),
+
     SOURCE_UP("SLI", "UP"),
     SOURCE_DOWN("SLI", "DOWN"),
     SOURCE_QUERY("SLI", "QSTN"),
index ab9f984b131e57c1d7ebf1175e3fea7f0fa16add..67fd63b00b7212cdfb7d9c7eb886128d95123636 100644 (file)
@@ -122,6 +122,7 @@ public class OnkyoHandler extends UpnpAudioSinkHandler implements OnkyoEventList
                 updateStatus(ThingStatus.ONLINE);
 
                 sendCommand(EiscpCommand.INFO_QUERY);
+                sendCommand(EiscpCommand.AUDIOINFO_QUERY);
             }
         });
 
@@ -324,7 +325,11 @@ public class OnkyoHandler extends UpnpAudioSinkHandler implements OnkyoEventList
                     sendCommand(EiscpCommand.NETUSB_TITLE_QUERY);
                 }
                 break;
-
+            case CHANNEL_AUDIOINFO:
+                if (command.equals(RefreshType.REFRESH)) {
+                    sendCommand(EiscpCommand.AUDIOINFO_QUERY);
+                }
+                break;
             /*
              * MISC
              */
@@ -477,7 +482,10 @@ public class OnkyoHandler extends UpnpAudioSinkHandler implements OnkyoEventList
                 /*
                  * MISC
                  */
-
+                case AUDIOINFO:
+                    updateState(CHANNEL_AUDIOINFO, convertDeviceValueToOpenHabState(data.getValue(), StringType.class));
+                    logger.debug("audioinfo message: '{}'", data.getValue());
+                    break;
                 case INFO:
                     processInfo(data.getValue());
                     logger.debug("Info message: '{}'", data.getValue());
@@ -797,6 +805,7 @@ public class OnkyoHandler extends UpnpAudioSinkHandler implements OnkyoEventList
             sendCommand(EiscpCommand.NETUSB_TITLE_QUERY);
             sendCommand(EiscpCommand.LISTEN_MODE_QUERY);
             sendCommand(EiscpCommand.INFO_QUERY);
+            sendCommand(EiscpCommand.AUDIOINFO_QUERY);
 
             if (isChannelAvailable(CHANNEL_POWERZONE2)) {
                 sendCommand(EiscpCommand.ZONE2_POWER_QUERY);
index 03bb270fcd33656bb6147ca3bbd3c6e9545b5d28..1c0df2383e37c51af01b1405caeec0757550e031 100644 (file)
@@ -45,6 +45,7 @@
                        <channel id="album" typeId="album"/>
                        <channel id="artist" typeId="artist"/>
                        <channel id="listenmode" typeId="listenmode"/>
+                       <channel id="audioinfo" typeId="audioinfo"/>
                        <channel id="playuri" typeId="playuri"/>
                        <channel id="albumArt" typeId="albumArt"/>
                        <channel id="albumArtUrl" typeId="albumArtUrl"/>
index 49a3f8e457235798826c1d32455a96f14a60311d..505cf467f25bfa2c31b05e61b5958c1b43cb13d8 100644 (file)
                <label>Play URI</label>
                <description>Plays a given URI</description>
        </channel-type>
+       <channel-type id="audioinfo" advanced="true">
+               <item-type>String</item-type>
+               <label>Audio Info</label>
+               <description>Detailed audio info</description>
+       </channel-type>
        <channel-type id="netControl" advanced="true">
                <item-type>String</item-type>
                <label>Control</label>