[sonos] Add new channel for microphone (Arc, Beam, Move, One) (#9999)

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2021-01-31 22:49:46 +01:00 committed by GitHub
parent f2ea947424
commit 0f8f72dd2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 0 deletions

View 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 |

View 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";

View 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));
}

View 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"/>

View 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"/>

View 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>

View 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>

View File

@ -358,4 +358,12 @@
<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>