mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[aWATTar] fix counddown and remaining time (#17067)
Signed-off-by: Thomas Leber <thomas@tl-photography.at>
This commit is contained in:
parent
5aec1c8a89
commit
2f8e9adf16
@ -44,7 +44,9 @@ import org.openhab.binding.awattar.internal.AwattarNonConsecutiveBestPriceResult
|
||||
import org.openhab.binding.awattar.internal.AwattarPrice;
|
||||
import org.openhab.core.i18n.TimeZoneProvider;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
@ -195,12 +197,16 @@ public class AwattarBestPriceHandler extends BaseThingHandler {
|
||||
diff = result.getStart() - Instant.now().toEpochMilli();
|
||||
if (diff >= 0) {
|
||||
state = getDuration(diff);
|
||||
} else {
|
||||
state = QuantityType.valueOf(0, Units.MINUTE);
|
||||
}
|
||||
break;
|
||||
case CHANNEL_REMAINING:
|
||||
diff = result.getEnd() - Instant.now().toEpochMilli();
|
||||
if (result.isActive()) {
|
||||
diff = result.getEnd() - Instant.now().toEpochMilli();
|
||||
state = getDuration(diff);
|
||||
} else {
|
||||
state = QuantityType.valueOf(0, Units.MINUTE);
|
||||
}
|
||||
break;
|
||||
case CHANNEL_HOURS:
|
||||
|
Loading…
Reference in New Issue
Block a user