From e184f78653405552f09850865e31058fb24b82c7 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Wed, 20 Sep 2023 20:38:19 +0200 Subject: [PATCH] Add new channel for reduced electricity tax Resolves #15635 Signed-off-by: Jacob Laursen --- .../README.md | 40 +++++++----- .../internal/CacheManager.java | 61 +++++++++++++++++++ .../EnergiDataServiceBindingConstants.java | 5 +- .../action/EnergiDataServiceActions.java | 9 ++- .../api/DatahubTariffFilterFactory.java | 6 ++ .../handler/EnergiDataServiceHandler.java | 46 +++++++++++++- .../OH-INF/i18n/energidataservice.properties | 2 + .../resources/OH-INF/thing/channel-groups.xml | 4 ++ .../resources/OH-INF/thing/thing-service.xml | 4 ++ .../resources/OH-INF/update/instructions.xml | 18 ++++++ .../action/EnergiDataServiceActionsTest.java | 4 ++ .../action/ReducedElectricityTaxes.json | 46 ++++++++++++++ 12 files changed, 227 insertions(+), 18 deletions(-) create mode 100644 bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/update/instructions.xml create mode 100644 bundles/org.openhab.binding.energidataservice/src/test/resources/org/openhab/binding/energidataservice/internal/action/ReducedElectricityTaxes.json diff --git a/bundles/org.openhab.binding.energidataservice/README.md b/bundles/org.openhab.binding.energidataservice/README.md index 00c603d3ecbdc..ac68bdb9e8c9d 100644 --- a/bundles/org.openhab.binding.energidataservice/README.md +++ b/bundles/org.openhab.binding.energidataservice/README.md @@ -45,6 +45,7 @@ To obtain the Global Location Number of your grid company: | net-tariff | Number | Current net tariff in DKK per kWh. Only available when `gridCompanyGLN` is configured | no | | system-tariff | Number | Current system tariff in DKK per kWh | no | | electricity-tax | Number | Current electricity tax in DKK per kWh | no | +| reduced-electricity-tax | Number | Current reduced electricity tax in DKK per kWh. For electric heating customers only | no | | transmission-net-tariff | Number | Current transmission net tariff in DKK per kWh | no | | hourly-prices | String | JSON array with hourly prices from 24 hours ago and onward | yes | @@ -107,6 +108,13 @@ _Nord Energi Net:_ | start | StartOfDay | | offset | -P1D | +#### Electricity Tax + +The standard channel for electricity tax is `electricity-tax`. +For customers using electricity for heating, a reduced electricity tax rate may apply after consuming the first 4000 kWh within a year. +This reduced rate is made available through channel `reduced-electricity-tax`. +The binding cannot determine or manage rate variations as they depend on metering data. + #### Hourly Prices The format of the `hourly-prices` JSON array is as follows: @@ -114,22 +122,24 @@ The format of the `hourly-prices` JSON array is as follows: ```json [ { - "hourStart": "2023-01-24T15:00:00Z", - "spotPrice": 1.67076001, + "hourStart": "2023-09-19T18:00:00Z", + "spotPrice": 0.0, "spotPriceCurrency": "DKK", - "netTariff": 0.432225, - "systemTariff": 0.054000, - "electricityTax": 0.008000, - "transmissionNetTariff": 0.058000 + "netTariff": 0.0, + "systemTariff": 0.054, + "electricityTax": 0.697, + "reducedElectricityTax": 0.008, + "transmissionNetTariff": 0.058 }, { - "hourStart": "2023-01-24T16:00:00Z", - "spotPrice": 1.859880005, + "hourStart": "2023-09-19T19:00:00Z", + "spotPrice": -0.00052, "spotPriceCurrency": "DKK", - "netTariff": 1.05619, - "systemTariff": 0.054000, - "electricityTax": 0.008000, - "transmissionNetTariff": 0.058000 + "netTariff": 0.0, + "systemTariff": 0.054, + "electricityTax": 0.697, + "reducedElectricityTax": 0.008, + "transmissionNetTariff": 0.058 } ] ``` @@ -310,14 +320,15 @@ These elements can be requested: | NetTariff | Net tariff | | SystemTariff | System tariff | | ElectricityTax | Electricity tax | +| ReducedElectricityTax | Reduced electricity tax | | TransmissionNetTariff | Transmission net tariff | -Using `null` as parameter returns the total prices including all price elements. +Using `null` as parameter returns the total prices including all price elements except `ReducedElectricityTax`. Example: ```javascript -var priceMap = actions.getPrices("SpotPrice,NetTariff"); +var priceMap = actions.getPrices("SpotPrice,NetTariff") ``` ## Full Example @@ -339,6 +350,7 @@ Number SpotPrice "Current Spot Price" (TotalPrice) { channel="energidata Number NetTariff "Current Net Tariff" (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#net-tariff" [profile="transform:VAT"] } Number SystemTariff "Current System Tariff" (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#system-tariff" [profile="transform:VAT"] } Number ElectricityTax "Current Electricity Tax" (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#electricity-tax" [profile="transform:VAT"] } +Number ReducedElectricityTax "Current Reduced Electricity Tax" (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#reduced-electricity-tax" [profile="transform:VAT"] } Number TransmissionNetTariff "Current Transmission Tariff" (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#transmission-net-tariff" [profile="transform:VAT"] } String HourlyPrices "Hourly Prices" { channel="energidataservice:service:energidataservice:electricity#hourly-prices" } ``` diff --git a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/CacheManager.java b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/CacheManager.java index d73ee12dd1d91..d14440091d841 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/CacheManager.java +++ b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/CacheManager.java @@ -53,12 +53,14 @@ public class CacheManager { private Collection netTariffRecords = new ArrayList<>(); private Collection systemTariffRecords = new ArrayList<>(); private Collection electricityTaxRecords = new ArrayList<>(); + private Collection reducedElectricityTaxRecords = new ArrayList<>(); private Collection transmissionNetTariffRecords = new ArrayList<>(); private Map spotPriceMap = new ConcurrentHashMap<>(SPOT_PRICE_MAX_CACHE_SIZE); private Map netTariffMap = new ConcurrentHashMap<>(TARIFF_MAX_CACHE_SIZE); private Map systemTariffMap = new ConcurrentHashMap<>(TARIFF_MAX_CACHE_SIZE); private Map electricityTaxMap = new ConcurrentHashMap<>(TARIFF_MAX_CACHE_SIZE); + private Map reducedElectricityTaxMap = new ConcurrentHashMap<>(TARIFF_MAX_CACHE_SIZE); private Map transmissionNetTariffMap = new ConcurrentHashMap<>(TARIFF_MAX_CACHE_SIZE); public CacheManager() { @@ -76,12 +78,14 @@ public void clear() { netTariffRecords.clear(); systemTariffRecords.clear(); electricityTaxRecords.clear(); + reducedElectricityTaxRecords.clear(); transmissionNetTariffRecords.clear(); spotPriceMap.clear(); netTariffMap.clear(); systemTariffMap.clear(); electricityTaxMap.clear(); + reducedElectricityTaxMap.clear(); transmissionNetTariffMap.clear(); } @@ -133,6 +137,17 @@ public void putElectricityTaxes(Collection records) { updateElectricityTaxes(); } + /** + * Replace current "raw"/unprocessed reduced electricity tax records in cache. + * Map of hourly taxes will be updated automatically. + * + * @param records to cache + */ + public void putReducedElectricityTaxes(Collection records) { + putDatahubRecords(reducedElectricityTaxRecords, records); + updateReducedElectricityTaxes(); + } + /** * Replace current "raw"/unprocessed transmission net tariff records in cache. * Map of hourly tariffs will be updated automatically. @@ -177,6 +192,14 @@ public void updateElectricityTaxes() { cleanup(); } + /** + * Update map of reduced electricity taxes from internal cache. + */ + public void updateReducedElectricityTaxes() { + reducedElectricityTaxMap = priceListParser.toHourly(reducedElectricityTaxRecords); + cleanup(); + } + /** * Update map of hourly transmission net tariffs from internal cache. */ @@ -297,6 +320,34 @@ public Map getElectricityTaxes() { return new HashMap(electricityTaxMap); } + /** + * Get current reduced electricity tax. + * + * @return reduced electricity tax currently valid + */ + public @Nullable BigDecimal getReducedElectricityTax() { + return getReducedElectricityTax(Instant.now(clock)); + } + + /** + * Get reduced electricity tax valid at provided instant. + * + * @param time {@link Instant} for which to get the reduced electricity tax + * @return reduced electricity tax at given time or null if not available + */ + public @Nullable BigDecimal getReducedElectricityTax(Instant time) { + return reducedElectricityTaxMap.get(getHourStart(time)); + } + + /** + * Get map of all cached reduced electricity taxes. + * + * @return reduced electricity taxes currently available, {@link #NUMBER_OF_HISTORIC_HOURS} back + */ + public Map getReducedElectricityTaxes() { + return new HashMap(reducedElectricityTaxMap); + } + /** * Get current transmission net tariff. * @@ -399,6 +450,15 @@ public boolean areElectricityTaxesValidTomorrow() { return isValidNextDay(electricityTaxRecords); } + /** + * Check if we have "raw" reduced electricity tax records cached which are valid tomorrow. + * + * @return true if reduced electricity tax records for tomorrow are cached + */ + public boolean areReducedElectricityTaxesValidTomorrow() { + return isValidNextDay(reducedElectricityTaxRecords); + } + /** * Check if we have "raw" transmission net tariff records cached which are valid tomorrow. * @@ -418,6 +478,7 @@ public void cleanup() { netTariffMap.entrySet().removeIf(entry -> entry.getKey().isBefore(firstHourStart)); systemTariffMap.entrySet().removeIf(entry -> entry.getKey().isBefore(firstHourStart)); electricityTaxMap.entrySet().removeIf(entry -> entry.getKey().isBefore(firstHourStart)); + reducedElectricityTaxMap.entrySet().removeIf(entry -> entry.getKey().isBefore(firstHourStart)); transmissionNetTariffMap.entrySet().removeIf(entry -> entry.getKey().isBefore(firstHourStart)); } diff --git a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/EnergiDataServiceBindingConstants.java b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/EnergiDataServiceBindingConstants.java index aa828627a98f0..210b133adb074 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/EnergiDataServiceBindingConstants.java +++ b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/EnergiDataServiceBindingConstants.java @@ -48,13 +48,16 @@ public class EnergiDataServiceBindingConstants { + "system-tariff"; public static final String CHANNEL_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR + "electricity-tax"; + public static final String CHANNEL_REDUCED_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY + + ChannelUID.CHANNEL_GROUP_SEPARATOR + "reduced-electricity-tax"; public static final String CHANNEL_TRANSMISSION_NET_TARIFF = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR + "transmission-net-tariff"; public static final String CHANNEL_HOURLY_PRICES = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR + "hourly-prices"; public static final Set ELECTRICITY_CHANNELS = Set.of(CHANNEL_SPOT_PRICE, CHANNEL_NET_TARIFF, - CHANNEL_SYSTEM_TARIFF, CHANNEL_ELECTRICITY_TAX, CHANNEL_TRANSMISSION_NET_TARIFF, CHANNEL_HOURLY_PRICES); + CHANNEL_SYSTEM_TARIFF, CHANNEL_ELECTRICITY_TAX, CHANNEL_REDUCED_ELECTRICITY_TAX, + CHANNEL_TRANSMISSION_NET_TARIFF, CHANNEL_HOURLY_PRICES); // List of all properties public static final String PROPERTY_REMAINING_CALLS = "remainingCalls"; diff --git a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActions.java b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActions.java index 3e9a3e64271b8..c0a3ee56d5053 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActions.java +++ b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActions.java @@ -65,6 +65,7 @@ private enum PriceElement { NET_TARIFF("nettariff"), SYSTEM_TARIFF("systemtariff"), ELECTRICITY_TAX("electricitytax"), + REDUCED_ELECTRICITY_TAX("reducedElectricitytax"), TRANSMISSION_NET_TARIFF("transmissionnettariff"); private static final Map NAME_MAP = Stream.of(values()) @@ -93,7 +94,8 @@ public static PriceElement fromString(final String name) { @RuleAction(label = "@text/action.get-prices.label", description = "@text/action.get-prices.description") public @ActionOutput(name = "prices", type = "java.util.Map") Map getPrices() { - return getPrices(Arrays.stream(PriceElement.values()).collect(Collectors.toSet())); + return getPrices(Arrays.stream(PriceElement.values()) + .filter(element -> element != PriceElement.REDUCED_ELECTRICITY_TAX).collect(Collectors.toSet())); } @RuleAction(label = "@text/action.get-prices.label", description = "@text/action.get-prices.description") @@ -250,6 +252,11 @@ private Map getPrices(Set priceElements) { mergeMaps(prices, electricityTaxMap, !spotPricesRequired); } + if (priceElements.contains(PriceElement.REDUCED_ELECTRICITY_TAX)) { + Map reducedElectricityTaxMap = handler.getReducedElectricityTaxes(); + mergeMaps(prices, reducedElectricityTaxMap, !spotPricesRequired); + } + if (priceElements.contains(PriceElement.TRANSMISSION_NET_TARIFF)) { Map transmissionNetTariffMap = handler.getTransmissionNetTariffs(); mergeMaps(prices, transmissionNetTariffMap, !spotPricesRequired); diff --git a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/api/DatahubTariffFilterFactory.java b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/api/DatahubTariffFilterFactory.java index 31a1f5b866768..51dd629732889 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/api/DatahubTariffFilterFactory.java +++ b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/api/DatahubTariffFilterFactory.java @@ -63,6 +63,7 @@ public class DatahubTariffFilterFactory { private static final String NOTE_NET_TARIFF_C_FLEX_HOUR = NOTE_NET_TARIFF_C_FLEX + " - time"; private static final String NOTE_SYSTEM_TARIFF = "Systemtarif"; private static final String NOTE_ELECTRICITY_TAX = "Elafgift"; + private static final String NOTE_REDUCED_ELECTRICITY_TAX = "Reduceret elafgift"; private static final String NOTE_TRANSMISSION_NET_TARIFF = "Transmissions nettarif"; public static final LocalDate N1_CUTOFF_DATE = LocalDate.of(2023, 1, 1); @@ -165,6 +166,11 @@ public static DatahubTariffFilter getElectricityTax() { DateQueryParameter.of(ENERGINET_CUTOFF_DATE)); } + public static DatahubTariffFilter getReducedElectricityTax() { + return new DatahubTariffFilter(Set.of(), Set.of(NOTE_REDUCED_ELECTRICITY_TAX), + DateQueryParameter.of(LocalDate.of(2021, 2, 1))); + } + public static DatahubTariffFilter getTransmissionNetTariff() { return new DatahubTariffFilter(Set.of(), Set.of(NOTE_TRANSMISSION_NET_TARIFF), DateQueryParameter.of(ENERGINET_CUTOFF_DATE)); diff --git a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java index 970d8a1da23be..56a1dd9edf861 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java +++ b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java @@ -91,7 +91,7 @@ public class EnergiDataServiceHandler extends BaseThingHandler { private record Price(String hourStart, BigDecimal spotPrice, String spotPriceCurrency, @Nullable BigDecimal netTariff, @Nullable BigDecimal systemTariff, @Nullable BigDecimal electricityTax, - @Nullable BigDecimal transmissionNetTariff) { + @Nullable BigDecimal reducedElectricityTax, @Nullable BigDecimal transmissionNetTariff) { } public EnergiDataServiceHandler(Thing thing, HttpClient httpClient, TimeZoneProvider timeZoneProvider) { @@ -182,6 +182,10 @@ private void refreshElectricityPrices() { downloadElectricityTaxes(); } + if (isLinked(CHANNEL_REDUCED_ELECTRICITY_TAX) || isLinked(CHANNEL_HOURLY_PRICES)) { + downloadReducedElectricityTaxes(); + } + if (isLinked(CHANNEL_TRANSMISSION_NET_TARIFF) || isLinked(CHANNEL_HOURLY_PRICES)) { downloadTransmissionNetTariffs(); } @@ -281,6 +285,20 @@ private void downloadElectricityTaxes() throws InterruptedException, DataService } } + private void downloadReducedElectricityTaxes() throws InterruptedException, DataServiceException { + GlobalLocationNumber globalLocationNumber = config.getEnerginetGLN(); + if (globalLocationNumber.isEmpty()) { + return; + } + if (cacheManager.areReducedElectricityTaxesValidTomorrow()) { + logger.debug("Cached reduced electricity taxes still valid, skipping download."); + cacheManager.updateReducedElectricityTaxes(); + } else { + cacheManager.putReducedElectricityTaxes( + downloadPriceLists(globalLocationNumber, DatahubTariffFilterFactory.getReducedElectricityTax())); + } + } + private void downloadTransmissionNetTariffs() throws InterruptedException, DataServiceException { GlobalLocationNumber globalLocationNumber = config.getEnerginetGLN(); if (globalLocationNumber.isEmpty()) { @@ -343,6 +361,7 @@ private void updatePrices() { updateCurrentTariff(CHANNEL_NET_TARIFF, cacheManager.getNetTariff()); updateCurrentTariff(CHANNEL_SYSTEM_TARIFF, cacheManager.getSystemTariff()); updateCurrentTariff(CHANNEL_ELECTRICITY_TAX, cacheManager.getElectricityTax()); + updateCurrentTariff(CHANNEL_REDUCED_ELECTRICITY_TAX, cacheManager.getReducedElectricityTax()); updateCurrentTariff(CHANNEL_TRANSMISSION_NET_TARIFF, cacheManager.getTransmissionNetTariff()); updateHourlyPrices(); @@ -379,9 +398,10 @@ private void updateHourlyPrices() { BigDecimal netTariff = cacheManager.getNetTariff(hourStart); BigDecimal systemTariff = cacheManager.getSystemTariff(hourStart); BigDecimal electricityTax = cacheManager.getElectricityTax(hourStart); + BigDecimal reducedElectricityTax = cacheManager.getReducedElectricityTax(hourStart); BigDecimal transmissionNetTariff = cacheManager.getTransmissionNetTariff(hourStart); targetPrices[i++] = new Price(hourStart.toString(), sourcePrice.getValue(), config.currencyCode, netTariff, - systemTariff, electricityTax, transmissionNetTariff); + systemTariff, electricityTax, reducedElectricityTax, transmissionNetTariff); } updateState(CHANNEL_HOURLY_PRICES, new StringType(gson.toJson(targetPrices))); } @@ -483,6 +503,28 @@ public Map getElectricityTaxes() { return cacheManager.getElectricityTaxes(); } + /** + * Get cached reduced electricity taxes or try once to download them if not cached + * (usually if no items are linked). + * + * @return Map of future reduced electricity taxes + */ + public Map getReducedElectricityTaxes() { + try { + downloadReducedElectricityTaxes(); + } catch (DataServiceException e) { + if (logger.isDebugEnabled()) { + logger.warn("Error retrieving reduced electricity taxes", e); + } else { + logger.warn("Error retrieving reduced electricity taxes: {}", e.getMessage()); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + + return cacheManager.getReducedElectricityTaxes(); + } + /** * Return cached transmission net tariffs or try once to download them if not cached * (usually if no items are linked). diff --git a/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/i18n/energidataservice.properties b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/i18n/energidataservice.properties index 70e7d27d6528a..7cd67b082225c 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/i18n/energidataservice.properties +++ b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/i18n/energidataservice.properties @@ -59,6 +59,8 @@ channel-group-type.energidataservice.electricity.channel.electricity-tax.label = channel-group-type.energidataservice.electricity.channel.electricity-tax.description = Current electricity tax in DKK per kWh. channel-group-type.energidataservice.electricity.channel.net-tariff.label = Net Tariff channel-group-type.energidataservice.electricity.channel.net-tariff.description = Current net tariff in DKK per kWh. +channel-group-type.energidataservice.electricity.channel.reduced-electricity-tax.label = Reduced Electricity Tax +channel-group-type.energidataservice.electricity.channel.reduced-electricity-tax.description = Current reduced electricity tax in DKK per kWh. For electric heating customers only. channel-group-type.energidataservice.electricity.channel.spot-price.label = Spot Price channel-group-type.energidataservice.electricity.channel.spot-price.description = Current spot price in DKK or EUR per kWh. channel-group-type.energidataservice.electricity.channel.system-tariff.label = System Tariff diff --git a/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/channel-groups.xml b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/channel-groups.xml index 2a22018260c37..c978b03667b3d 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/channel-groups.xml +++ b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/channel-groups.xml @@ -24,6 +24,10 @@ Current electricity tax in DKK per kWh. + + + Current reduced electricity tax in DKK per kWh. For electric heating customers only. + Current transmission net tariff in DKK per kWh. diff --git a/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/thing-service.xml b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/thing-service.xml index c00115a67ddd7..b69ef51aa8e13 100644 --- a/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/thing-service.xml +++ b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/thing/thing-service.xml @@ -13,6 +13,10 @@ + + 1 + + diff --git a/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/update/instructions.xml new file mode 100644 index 0000000000000..62e288807ab46 --- /dev/null +++ b/bundles/org.openhab.binding.energidataservice/src/main/resources/OH-INF/update/instructions.xml @@ -0,0 +1,18 @@ + + + + + + + + energidataservice:datahub-price + + Current reduced electricity tax in DKK per kWh. For electric heating customers only. + + + + + + diff --git a/bundles/org.openhab.binding.energidataservice/src/test/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActionsTest.java b/bundles/org.openhab.binding.energidataservice/src/test/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActionsTest.java index 3170973a0b0ec..8ffaed5d53476 100644 --- a/bundles/org.openhab.binding.energidataservice/src/test/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActionsTest.java +++ b/bundles/org.openhab.binding.energidataservice/src/test/java/org/openhab/binding/energidataservice/internal/action/EnergiDataServiceActionsTest.java @@ -388,6 +388,9 @@ private void mockCommonDatasets(EnergiDataServiceActions actions, String spotPri datahubRecords = getObjectFromJson("ElectricityTaxes.json", DatahubPricelistRecords.class); Map electricityTaxes = priceListParser .toHourly(Arrays.stream(datahubRecords.records()).toList()); + datahubRecords = getObjectFromJson("ReducedElectricityTaxes.json", DatahubPricelistRecords.class); + Map reducedElectricityTaxes = priceListParser + .toHourly(Arrays.stream(datahubRecords.records()).toList()); datahubRecords = getObjectFromJson("TransmissionNetTariffs.json", DatahubPricelistRecords.class); Map transmissionNetTariffs = priceListParser .toHourly(Arrays.stream(datahubRecords.records()).toList()); @@ -396,6 +399,7 @@ private void mockCommonDatasets(EnergiDataServiceActions actions, String spotPri when(handler.getNetTariffs()).thenReturn(netTariffs); when(handler.getSystemTariffs()).thenReturn(systemTariffs); when(handler.getElectricityTaxes()).thenReturn(electricityTaxes); + when(handler.getReducedElectricityTaxes()).thenReturn(reducedElectricityTaxes); when(handler.getTransmissionNetTariffs()).thenReturn(transmissionNetTariffs); when(handler.getCurrency()).thenReturn(EnergiDataServiceBindingConstants.CURRENCY_DKK); actions.setThingHandler(handler); diff --git a/bundles/org.openhab.binding.energidataservice/src/test/resources/org/openhab/binding/energidataservice/internal/action/ReducedElectricityTaxes.json b/bundles/org.openhab.binding.energidataservice/src/test/resources/org/openhab/binding/energidataservice/internal/action/ReducedElectricityTaxes.json new file mode 100644 index 0000000000000..a4827939fbf94 --- /dev/null +++ b/bundles/org.openhab.binding.energidataservice/src/test/resources/org/openhab/binding/energidataservice/internal/action/ReducedElectricityTaxes.json @@ -0,0 +1,46 @@ +{ + "total": 1, + "filters": "{\"ChargeType\":[\"D03\"],\"GLN_Number\":[\"5790000432752\"],\"Note\":[\"Reduceret elafgift\"]}", + "sort": "ValidFrom DESC", + "dataset": "DatahubPricelist", + "records": [ + { + "ChargeOwner": "Energinet Systemansvar A/S (SYO)", + "GLN_Number": "5790000432752", + "ChargeType": "D03", + "ChargeTypeCode": "EA-002", + "Note": "Reduceret elafgift", + "Description": "Reduceret elafgift for elvarmekunder", + "ValidFrom": "2021-02-01T00:00:00", + "ValidTo": null, + "VATClass": "D02", + "Price1": 0.008, + "Price2": null, + "Price3": null, + "Price4": null, + "Price5": null, + "Price6": null, + "Price7": null, + "Price8": null, + "Price9": null, + "Price10": null, + "Price11": null, + "Price12": null, + "Price13": null, + "Price14": null, + "Price15": null, + "Price16": null, + "Price17": null, + "Price18": null, + "Price19": null, + "Price20": null, + "Price21": null, + "Price22": null, + "Price23": null, + "Price24": null, + "TransparentInvoicing": 1, + "TaxIndicator": 1, + "ResolutionDuration": "P1D" + } + ] +}