mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
Prevent progress bar calculation greater than 100% (#18809)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
+1
-1
@@ -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))));
|
||||
|
||||
Reference in New Issue
Block a user