Prevent progress bar calculation greater than 100% (#18809)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein
2025-06-19 23:24:53 +02:00
committed by GitHub
parent 3b12334e1a
commit 41dd287597
@@ -217,7 +217,7 @@ public class RokuHandler extends BaseThingHandler {
updateState(TIME_TOTAL, UnDefType.UNDEF);
}
if (position >= 0 && duration > 0) {
if (duration > 0 && position >= 0 && position <= duration) {
updateState(END_TIME, new DateTimeType(Instant.now().plusSeconds(duration - position)));
updateState(PROGRESS,
new PercentType(BigDecimal.valueOf(Math.round(position / (double) duration * 100.0))));