mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[mpd] fix invalid volume (#10166)
Fixes #10142. Signed-off-by: Stefan Roellin <stefan@roellin-baumann.ch> Also-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
parent
c0cec8028c
commit
8a4b87e04e
@ -254,7 +254,11 @@ public class MPDHandler extends BaseThingHandler implements MPDEventListener {
|
|||||||
@Override
|
@Override
|
||||||
public void updateMPDStatus(MPDStatus status) {
|
public void updateMPDStatus(MPDStatus status) {
|
||||||
volume = status.getVolume();
|
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;
|
State newControlState = UnDefType.UNDEF;
|
||||||
switch (status.getState()) {
|
switch (status.getState()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user