Skip to content

Commit

Permalink
[mpd] fix invalid volume (openhab#10166)
Browse files Browse the repository at this point in the history
Fixes openhab#10142.

Signed-off-by: Stefan Roellin <stefan@roellin-baumann.ch>
Also-by: Jan N. Klug <jan.n.klug@rub.de>
Signed-off-by: John Marshall <john.marshall.au@gmail.com>
  • Loading branch information
stefanroellin authored and themillhousegroup committed May 10, 2021
1 parent fa3bf87 commit eaa23de
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ private void updateChannel(String channelID, State state) {
@Override
public void updateMPDStatus(MPDStatus status) {
volume = status.getVolume();
updateChannel(CHANNEL_VOLUME, new PercentType(status.getVolume()));
if (volume < 0 || volume > 100) {
updateChannel(CHANNEL_VOLUME, UnDefType.UNDEF);
} else {
updateChannel(CHANNEL_VOLUME, new PercentType(volume));
}

State newControlState = UnDefType.UNDEF;
switch (status.getState()) {
Expand Down

0 comments on commit eaa23de

Please sign in to comment.