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>
  • Loading branch information
stefanroellin authored and thinkingstone committed Nov 7, 2021
1 parent d386205 commit bc753ad
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 bc753ad

Please sign in to comment.