Skip to content

Commit c4a2425

Browse files
authored
Remove binding configuration (#19748)
Signed-off-by: Jacob Laursen <[email protected]>
1 parent 5d97a88 commit c4a2425

File tree

6 files changed

+3
-51
lines changed

6 files changed

+3
-51
lines changed

bundles/org.openhab.binding.energidataservice/README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ This can be used to plan energy consumption, for example to calculate the cheape
88

99
All channels are available for thing type `service`.
1010

11-
## Binding Configuration
12-
13-
This advanced configuration option can be used if the transition to the Day-Ahead Prices dataset is postponed.
14-
For the latest updates, please refer to the [Energi Data Service news](https://energidataservice.dk/news).
15-
16-
| Name | Type | Description | Default | Required |
17-
| ---------------------- | ------- | ---------------------------------------------------------------------- | ---------- | -------- |
18-
| dayAheadTransitionDate | text | The date when the addon switches to using the Day-Ahead Prices dataset | 2025-09-30 | no |
19-
2011
## Thing Configuration
2112

2213
### `service` Thing Configuration

bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/factory/EnergiDataServiceHandlerFactory.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import static org.openhab.binding.energidataservice.internal.EnergiDataServiceBindingConstants.*;
1616

17-
import java.time.LocalDate;
1817
import java.util.Map;
1918
import java.util.Set;
2019

@@ -25,7 +24,6 @@
2524
import org.openhab.binding.energidataservice.internal.handler.EnergiDataServiceHandler;
2625
import org.openhab.binding.energidataservice.internal.provider.Co2EmissionProvider;
2726
import org.openhab.binding.energidataservice.internal.provider.ElectricityPriceProvider;
28-
import org.openhab.core.config.core.ConfigParser;
2927
import org.openhab.core.i18n.TimeZoneProvider;
3028
import org.openhab.core.io.net.http.HttpClientFactory;
3129
import org.openhab.core.thing.Thing;
@@ -35,7 +33,6 @@
3533
import org.openhab.core.thing.binding.ThingHandlerFactory;
3634
import org.osgi.service.component.annotations.Activate;
3735
import org.osgi.service.component.annotations.Component;
38-
import org.osgi.service.component.annotations.Modified;
3936
import org.osgi.service.component.annotations.Reference;
4037

4138
/**
@@ -49,7 +46,6 @@
4946
public class EnergiDataServiceHandlerFactory extends BaseThingHandlerFactory {
5047

5148
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_SERVICE);
52-
private static final String DAY_AHEAD_TRANSITION_DATE_CONFIG = "dayAheadTransitionDate";
5349

5450
private final HttpClient httpClient;
5551
private final TimeZoneProvider timeZoneProvider;
@@ -66,16 +62,6 @@ public EnergiDataServiceHandlerFactory(final @Reference HttpClientFactory httpCl
6662
this.timeZoneProvider = timeZoneProvider;
6763
this.electricityPriceProvider = electricityPriceProvider;
6864
this.co2EmissionProvider = co2EmissionProvider;
69-
70-
configChanged(config);
71-
}
72-
73-
@Modified
74-
public void configChanged(Map<String, Object> config) {
75-
String dayAheadDateValue = ConfigParser.valueAs(config.get(DAY_AHEAD_TRANSITION_DATE_CONFIG), String.class);
76-
LocalDate dayAheadDate = dayAheadDateValue != null ? LocalDate.parse(dayAheadDateValue)
77-
: DAY_AHEAD_TRANSITION_DATE;
78-
electricityPriceProvider.setDayAheadTransitionDate(dayAheadDate);
7965
}
8066

8167
@Override

bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ public int updateSpotPriceTimeSeries(LocalDate startDate, LocalDate endDate)
445445
Currency currency = config.getCurrency();
446446
boolean isDKK = CURRENCY_DKK.equals(currency);
447447
TimeSeries spotPriceTimeSeries = new TimeSeries(REPLACE);
448-
LocalDate dayAheadFirstDate = electricityPriceProvider.getDayAheadTransitionDate().plusDays(1);
448+
LocalDate dayAheadFirstDate = DAY_AHEAD_TRANSITION_DATE.plusDays(1);
449449

450450
if (startDate.isBefore(dayAheadFirstDate)) {
451451
ElspotpriceRecord[] spotPriceRecords = apiController.getSpotPrices(config.priceArea, currency,

bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/provider/ElectricityPriceProvider.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import java.math.BigDecimal;
1818
import java.time.Duration;
1919
import java.time.Instant;
20-
import java.time.LocalDate;
2120
import java.time.LocalDateTime;
2221
import java.time.LocalTime;
2322
import java.time.format.DateTimeFormatter;
@@ -84,7 +83,6 @@ public class ElectricityPriceProvider extends AbstractProvider<ElectricityPriceL
8483
private @Nullable ScheduledFuture<?> refreshFuture;
8584
private @Nullable ScheduledFuture<?> priceUpdateFuture;
8685
private RetryStrategy retryPolicy = RetryPolicyFactory.initial();
87-
private LocalDate dayAheadTransitionDate = DAY_AHEAD_TRANSITION_DATE;
8886

8987
@Activate
9088
public ElectricityPriceProvider(final @Reference Scheduler scheduler,
@@ -106,14 +104,6 @@ public void deactivate() {
106104
stopJobs();
107105
}
108106

109-
public void setDayAheadTransitionDate(LocalDate transitionDate) {
110-
dayAheadTransitionDate = transitionDate;
111-
}
112-
113-
public LocalDate getDayAheadTransitionDate() {
114-
return dayAheadTransitionDate;
115-
}
116-
117107
public void subscribe(ElectricityPriceListener listener, Subscription subscription) {
118108
if (!(subscription instanceof ElectricityPriceSubscription)) {
119109
throw new IllegalArgumentException(subscription.getClass().getName() + " is not supported");
@@ -412,8 +402,8 @@ private Duration getDayAheadResolution() {
412402
}
413403

414404
private Dataset getDayAheadDataset() {
415-
return Instant.now()
416-
.isBefore(dayAheadTransitionDate.atTime(DAILY_REFRESH_TIME_CET).atZone(NORD_POOL_TIMEZONE).toInstant())
405+
return Instant.now().isBefore(
406+
DAY_AHEAD_TRANSITION_DATE.atTime(DAILY_REFRESH_TIME_CET).atZone(NORD_POOL_TIMEZONE).toInstant())
417407
? Dataset.SpotPrices
418408
: Dataset.DayAheadPrices;
419409
}

bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/addon/addon.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,4 @@
99
<connection>cloud</connection>
1010
<countries>dk,no,se</countries>
1111

12-
<config-description>
13-
<parameter name="dayAheadTransitionDate" type="text">
14-
<context>date</context>
15-
<label>Day-ahead Transition Date</label>
16-
<description>The date when the addon switches to using the Day-Ahead Prices dataset</description>
17-
<advanced>true</advanced>
18-
<default>2025-09-30</default>
19-
</parameter>
20-
</config-description>
21-
2212
</addon:addon>

bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/i18n/energidataservice.properties

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
addon.energidataservice.name = Energi Data Service Binding
44
addon.energidataservice.description = This is the binding for Energi Data Service providing open energy data from Energinet.
55

6-
# add-on config
7-
8-
addon.config.energidataservice.dayAheadTransitionDate.label = Day-ahead Transition Date
9-
addon.config.energidataservice.dayAheadTransitionDate.description = The date when the addon switches to using the Day-Ahead Prices dataset
10-
116
# thing types
127

138
thing-type.energidataservice.service.label = Energi Data Service

0 commit comments

Comments
 (0)