]> git.basschouten.com Git - openhab-addons.git/commitdiff
[sonos] Add new channel for microphone (Arc, Beam, Move, One) (#9999)
authorlolodomo <lg.hc@free.fr>
Sun, 31 Jan 2021 21:49:46 +0000 (22:49 +0100)
committerGitHub <noreply@github.com>
Sun, 31 Jan 2021 21:49:46 +0000 (22:49 +0100)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.sonos/README.md
bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosBindingConstants.java
bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/handler/ZonePlayerHandler.java
bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Arc.xml
bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Beam.xml
bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Move.xml
bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/One.xml
bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/channels.xml

index b706f326098d59116567292f92511134e1dd90dc..fb19d071fbe45575dd5dff6d90595c07af8827ba 100644 (file)
@@ -75,6 +75,7 @@ The devices support the following channels:
 | digitallinein       | Switch    | R           | Indicator set to ON when the digital line-in of the Zone Player is connected                                                                              | Amp                                  |
 | localcoordinator    | Switch    | R           | Indicator set to ON if the this Zone Player is the Zone Group Coordinator                                                                                 | all                                  |
 | loudness            | Switch    | RW          | Enable or disable the loudness                                                                                                                            | all                                  |
+| microphone          | Switch    | R           | Indicator set to ON when the microphone is enabled                                                                                                        | Arc, Beam, Move, One                 |
 | mute                | Switch    | RW          | Set or get the mute state of the master volume of the Zone Player                                                                                         | all                                  |
 | nightmode           | Switch    | RW          | Enable or disable the night mode feature                                                                                                                  | PLAYBAR, PLAYBASE, Beam, Amp         |
 | notificationsound   | String    | W           | Play a notification sound by a given URI                                                                                                                  | all                                  |
index b437c0715ca90682ef106fe386b89af930c69443..66797f1a0c7be50f3f121a86d1db619d9cc1bc36 100644 (file)
@@ -103,6 +103,7 @@ public class SonosBindingConstants {
     public static final String DIGITALLINEIN = "digitallinein";
     public static final String LOCALCOORDINATOR = "localcoordinator";
     public static final String LOUDNESS = "loudness";
+    public static final String MICROPHONE = "microphone";
     public static final String MUTE = "mute";
     public static final String NIGHTMODE = "nightmode";
     public static final String NOTIFICATIONSOUND = "notificationsound";
index e4b59fbb4b70d88c67ffcf5281ae047c4b1a00ae..5e8f0e06eb4706b28c3e977ddc867ea425c3a19e 100644 (file)
@@ -693,6 +693,9 @@ public class ZonePlayerHandler extends BaseThingHandler implements UpnpIOPartici
                     updateChannel(BATTERYCHARGING);
                     updateChannel(BATTERYLEVEL);
                     break;
+                case "MicEnabled":
+                    updateChannel(MICROPHONE);
+                    break;
                 default:
                     break;
             }
@@ -973,6 +976,12 @@ public class ZonePlayerHandler extends BaseThingHandler implements UpnpIOPartici
                     newState = new DecimalType(value);
                 }
                 break;
+            case MICROPHONE:
+                value = getMicEnabled();
+                if (value != null) {
+                    newState = OnOffType.from(value);
+                }
+                break;
             default:
                 newState = null;
                 break;
@@ -2143,6 +2152,10 @@ public class ZonePlayerHandler extends BaseThingHandler implements UpnpIOPartici
         return mode;
     }
 
+    public @Nullable String getMicEnabled() {
+        return stateMap.get("MicEnabled");
+    }
+
     protected void updatePlayMode(String playMode) {
         executeAction(SERVICE_AV_TRANSPORT, ACTION_SET_PLAY_MODE, Map.of("InstanceID", "0", "NewPlayMode", playMode));
     }
index a825d35c0c0d2dc1e34e5a3bdac383f674cc93a8..571c3ae23ce4c13b92231a1a14caf65b84f8c43d 100644 (file)
@@ -58,6 +58,7 @@
                        <channel id="currenttrackuri" typeId="currenttrackuri"/>
                        <!-- Extended SONOS channels -->
                        <channel id="linein" typeId="linein"/>
+                       <channel id="microphone" typeId="microphone"/>
                        <channel id="nightmode" typeId="nightmode"/>
                        <channel id="speechenhancement" typeId="speechenhancement"/>
                        <channel id="subwoofer" typeId="subwoofer"/>
index ff6a77977f3bb7d6fae300fabd15779206dce90f..63eab8b1c3f9348e2a8c769c6873007e14b35b34 100644 (file)
@@ -58,6 +58,7 @@
                        <channel id="currenttrackuri" typeId="currenttrackuri"/>
                        <!-- Extended SONOS channels -->
                        <channel id="linein" typeId="linein"/>
+                       <channel id="microphone" typeId="microphone"/>
                        <channel id="nightmode" typeId="nightmode"/>
                        <channel id="speechenhancement" typeId="speechenhancement"/>
                        <channel id="subwoofer" typeId="subwoofer"/>
index 1bca40910cd1855606a4fcd3b130a00a69565a8a..28b1c9cf8128e7ceb41d67ef0252436d536db6d4 100644 (file)
@@ -56,6 +56,7 @@
                        <!-- Extended SONOS channels -->
                        <channel id="batterycharging" typeId="batterycharging"/>
                        <channel id="batterylevel" typeId="system.battery-level"/>
+                       <channel id="microphone" typeId="microphone"/>
                </channels>
 
                <properties>
index ccaa8a877a353f55a2751e31ca75ea0f56073ae4..9cae3f68df4760939f1060ddd1a7cd4cbf811c95 100644 (file)
@@ -57,6 +57,8 @@
                        <channel id="sleeptimer" typeId="sleeptimer"/>
                        <channel id="currenttransporturi" typeId="currenttransporturi"/>
                        <channel id="currenttrackuri" typeId="currenttrackuri"/>
+                       <!-- Extended SONOS channels -->
+                       <channel id="microphone" typeId="microphone"/>
                        <channel id="speechenhancement" typeId="speechenhancement"/>
                </channels>
 
index 6fc4cd4e01634934e174839cdd9f2595f0454c01..1409838e48d86b6e1c0bb9a166143a2d188e0694 100644 (file)
                <state readOnly="true"/>
        </channel-type>
 
+       <!-- Extended channels (for One, Beam, Arc and Move only) -->
+       <channel-type id="microphone" advanced="true">
+               <item-type>Switch</item-type>
+               <label>Microphone</label>
+               <description>Indicator set to ON when the microphone is enabled</description>
+               <state readOnly="true"/>
+       </channel-type>
+
 </thing:thing-descriptions>