From 20155f0cf1c24d0fe49ea43b2b4bdcf8b598e283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=B6hn?= Date: Sat, 28 Dec 2024 11:02:30 +0100 Subject: [PATCH] upnp: ignore negative volume values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Höhn --- .../upnpcontrol/internal/handler/UpnpRendererHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java index 6f0165ddb10..67a615d08b4 100644 --- a/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java +++ b/bundles/org.openhab.binding.upnpcontrol/src/main/java/org/openhab/binding/upnpcontrol/internal/handler/UpnpRendererHandler.java @@ -1113,6 +1113,11 @@ public class UpnpRendererHandler extends UpnpHandler { long volume = Long.valueOf(value); volume = volume * 100 / config.maxvolume; + if (volume < 0) { + logger.warn("UPnP device {} received invalid volume value {}", thing.getLabel(), value); + return; + } + String upnpChannel = variable.replace("Volume", "volume").replace("Master", ""); updateState(upnpChannel, new PercentType((int) volume));