Skip to content

Commit

Permalink
[sonos] Ignore TRANSITIONING device state when updating channels (ope…
Browse files Browse the repository at this point in the history
…nhab#13241)

* [sonos] Ignore TRANSITIONING device state when updating channels
* Remove TRANSITIONING state option

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo authored and andan67 committed Nov 5, 2022
1 parent 8b60915 commit ace8410
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public class ZonePlayerHandler extends BaseThingHandler implements UpnpIOPartici
private static final String STATE_PLAYING = "PLAYING";
private static final String STATE_PAUSED_PLAYBACK = "PAUSED_PLAYBACK";
private static final String STATE_STOPPED = "STOPPED";
private static final String STATE_TRANSITIONING = "TRANSITIONING";

private static final String LINEINCONNECTED = "LineInConnected";
private static final String TOSLINEINCONNECTED = "TOSLinkConnected";
Expand Down Expand Up @@ -761,7 +762,8 @@ protected void updateChannel(String channelId) {
case STATE:
value = getTransportState();
if (value != null) {
newState = new StringType(value);
// Ignoring state TRANSITIONING
newState = STATE_TRANSITIONING.equals(value) ? null : new StringType(value);
}
break;
case CONTROL:
Expand All @@ -772,12 +774,15 @@ protected void updateChannel(String channelId) {
newState = PlayPauseType.PAUSE;
} else if (STATE_PAUSED_PLAYBACK.equals(value)) {
newState = PlayPauseType.PAUSE;
} else if (STATE_TRANSITIONING.equals(value)) {
// Ignoring state TRANSITIONING
newState = null;
}
break;
case STOP:
value = getTransportState();
if (value != null) {
newState = OnOffType.from(STATE_STOPPED.equals(value));
newState = STATE_TRANSITIONING.equals(value) ? null : OnOffType.from(STATE_STOPPED.equals(value));
}
break;
case SHUFFLE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ channel-type.sonos.state.description = The State channel contains state of the S
channel-type.sonos.state.state.option.STOPPED = Stopped
channel-type.sonos.state.state.option.PLAYING = Playing
channel-type.sonos.state.state.option.PAUSED_PLAYBACK = Paused
channel-type.sonos.state.state.option.TRANSITIONING = Transitioning
channel-type.sonos.stop.label = Stop
channel-type.sonos.stop.description = Stop the Sonos device. ON if the player is stopped.
channel-type.sonos.subwoofer.label = Subwoofer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@
<option value="STOPPED">Stopped</option>
<option value="PLAYING">Playing</option>
<option value="PAUSED_PLAYBACK">Paused</option>
<option value="TRANSITIONING">Transitioning</option>
</options>
</state>
</channel-type>
Expand Down

0 comments on commit ace8410

Please sign in to comment.