Rename channels net-tariff and transmission-net-tariff (#15938)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2023-11-23 19:36:30 +01:00 committed by GitHub
parent 50801be9d5
commit 9b1553c333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 114 additions and 97 deletions

View File

@ -47,15 +47,15 @@ It will not impact channels, see [Electricity Tax](#electricity-tax) for further
### Channel Group `electricity` ### Channel Group `electricity`
| Channel | Type | Description | Advanced | | Channel | Type | Description | Advanced |
|-------------------------|--------|---------------------------------------------------------------------------------------|----------| |--------------------------|--------|----------------------------------------------------------------------------------------|----------|
| spot-price | Number | Current spot price in DKK or EUR per kWh | no | | spot-price | Number | Current spot price in DKK or EUR per kWh | no |
| net-tariff | Number | Current net tariff in DKK per kWh. Only available when `gridCompanyGLN` is configured | no | | grid-tariff | Number | Current grid tariff in DKK per kWh. Only available when `gridCompanyGLN` is configured | no |
| system-tariff | Number | Current system tariff in DKK per kWh | no | | system-tariff | Number | Current system tariff in DKK per kWh | no |
| electricity-tax | Number | Current electricity tax in DKK per kWh | no | | transmission-grid-tariff | Number | Current transmission grid tariff in DKK per kWh | no |
| reduced-electricity-tax | Number | Current reduced electricity tax in DKK per kWh. For electric heating customers only | no | | electricity-tax | Number | Current electricity tax in DKK per kWh | no |
| transmission-net-tariff | Number | Current transmission net tariff in DKK per kWh | no | | reduced-electricity-tax | Number | Current reduced electricity tax in DKK per kWh. For electric heating customers only | no |
| hourly-prices | String | JSON array with hourly prices from 24 hours ago and onward | yes | | hourly-prices | String | JSON array with hourly prices from 24 hours ago and onward | yes |
_Please note:_ There is no channel providing the total price. _Please note:_ There is no channel providing the total price.
Instead, create a group item with `SUM` as aggregate function and add the individual price items as children. Instead, create a group item with `SUM` as aggregate function and add the individual price items as children.
@ -82,13 +82,13 @@ The recommended persistence strategy is `forecast`, as it ensures a clean histor
Prices from the past 24 hours and all forthcoming prices will be stored. Prices from the past 24 hours and all forthcoming prices will be stored.
Any changes that impact published prices (e.g. selecting or deselecting VAT Profile) will result in the replacement of persisted prices within this period. Any changes that impact published prices (e.g. selecting or deselecting VAT Profile) will result in the replacement of persisted prices within this period.
#### Net Tariff #### Grid Tariff
Discounts are automatically taken into account for channel `net-tariff` so that it represents the actual price. Discounts are automatically taken into account for channel `grid-tariff` so that it represents the actual price.
The tariffs are downloaded using pre-configured filters for the different [Grid Company GLN's](#global-location-number-of-the-grid-company). The tariffs are downloaded using pre-configured filters for the different [Grid Company GLN's](#global-location-number-of-the-grid-company).
If your company is not in the list, or the filters are not working, they can be manually overridden. If your company is not in the list, or the filters are not working, they can be manually overridden.
To override filters, the channel `net-tariff` has the following configuration parameters: To override filters, the channel `grid-tariff` has the following configuration parameters:
| Name | Type | Description | Default | Required | Advanced | | Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|----------------------------------------------------------------------------------------------------------------------------------|---------|----------|----------| |-----------------|---------|----------------------------------------------------------------------------------------------------------------------------------|---------|----------|----------|
@ -145,21 +145,21 @@ The format of the `hourly-prices` JSON array is as follows:
"hourStart": "2023-09-19T18:00:00Z", "hourStart": "2023-09-19T18:00:00Z",
"spotPrice": 0.0, "spotPrice": 0.0,
"spotPriceCurrency": "DKK", "spotPriceCurrency": "DKK",
"netTariff": 0.0, "gridTariff": 0.0,
"systemTariff": 0.054, "systemTariff": 0.054,
"transmissionGridTariff": 0.058,
"electricityTax": 0.697, "electricityTax": 0.697,
"reducedElectricityTax": 0.008, "reducedElectricityTax": 0.008
"transmissionNetTariff": 0.058
}, },
{ {
"hourStart": "2023-09-19T19:00:00Z", "hourStart": "2023-09-19T19:00:00Z",
"spotPrice": -0.00052, "spotPrice": -0.00052,
"spotPriceCurrency": "DKK", "spotPriceCurrency": "DKK",
"netTariff": 0.0, "gridTariff": 0.0,
"systemTariff": 0.054, "systemTariff": 0.054,
"transmissionGridTariff": 0.058,
"electricityTax": 0.697, "electricityTax": 0.697,
"reducedElectricityTax": 0.008, "reducedElectricityTax": 0.008
"transmissionNetTariff": 0.058
} }
] ]
``` ```
@ -334,14 +334,14 @@ var price = actions.calculatePrice(now.toInstant(), now.plusHours(4).toInstant,
The parameter `priceComponents` is a case-insensitive comma-separated list of price components to include in the returned hourly prices. The parameter `priceComponents` is a case-insensitive comma-separated list of price components to include in the returned hourly prices.
These components can be requested: These components can be requested:
| Price component | Description | | Price component | Description |
|-----------------------|-------------------------| |------------------------|-------------------------|
| SpotPrice | Spot price | | SpotPrice | Spot price |
| NetTariff | Net tariff | | GridTariff | Grid tariff |
| SystemTariff | System tariff | | SystemTariff | System tariff |
| ElectricityTax | Electricity tax | | TransmissionGridTariff | Transmission grid tariff |
| ReducedElectricityTax | Reduced electricity tax | | ElectricityTax | Electricity tax |
| TransmissionNetTariff | Transmission net tariff | | ReducedElectricityTax | Reduced electricity tax |
Using `null` as parameter returns the total prices including all price components. Using `null` as parameter returns the total prices including all price components.
If **Reduced Electricity Tax** is set in Thing configuration, `ElectricityTax` will be excluded, otherwise `ReducedElectricityTax`. If **Reduced Electricity Tax** is set in Thing configuration, `ElectricityTax` will be excluded, otherwise `ReducedElectricityTax`.
@ -350,7 +350,7 @@ This logic ensures consistent and comparable results not affected by artifical c
Example: Example:
```javascript ```javascript
var priceMap = actions.getPrices("SpotPrice,NetTariff") var priceMap = actions.getPrices("SpotPrice,GridTariff")
``` ```
## Full Example ## Full Example
@ -360,7 +360,7 @@ var priceMap = actions.getPrices("SpotPrice,NetTariff")
```java ```java
Thing energidataservice:service:energidataservice "Energi Data Service" [ priceArea="DK1", currencyCode="DKK", gridCompanyGLN="5790001089030" ] { Thing energidataservice:service:energidataservice "Energi Data Service" [ priceArea="DK1", currencyCode="DKK", gridCompanyGLN="5790001089030" ] {
Channels: Channels:
Number : electricity#net-tariff [ chargeTypeCodes="CD,CD R", start="StartOfYear" ] Number : electricity#grid-tariff [ chargeTypeCodes="CD,CD R", start="StartOfYear" ]
} }
``` ```
@ -369,10 +369,10 @@ Thing energidataservice:service:energidataservice "Energi Data Service" [ priceA
```java ```java
Group:Number:SUM TotalPrice "Current Total Price" <price> Group:Number:SUM TotalPrice "Current Total Price" <price>
Number SpotPrice "Current Spot Price" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#spot-price" [profile="transform:VAT"] } Number SpotPrice "Current Spot Price" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#spot-price" [profile="transform:VAT"] }
Number NetTariff "Current Net Tariff" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#net-tariff" [profile="transform:VAT"] } Number GridTariff "Current Grid Tariff" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#grid-tariff" [profile="transform:VAT"] }
Number SystemTariff "Current System Tariff" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#system-tariff" [profile="transform:VAT"] } Number SystemTariff "Current System Tariff" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#system-tariff" [profile="transform:VAT"] }
Number TransmissionGridTariff "Current Transmission Grid Tariff" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#transmission-grid-tariff" [profile="transform:VAT"] }
Number ElectricityTax "Current Electricity Tax" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#electricity-tax" [profile="transform:VAT"] } Number ElectricityTax "Current Electricity Tax" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#electricity-tax" [profile="transform:VAT"] }
Number TransmissionNetTariff "Current Transmission Tariff" <price> (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#transmission-net-tariff" [profile="transform:VAT"] }
String HourlyPrices "Hourly Prices" <price> { channel="energidataservice:service:energidataservice:electricity#hourly-prices" } String HourlyPrices "Hourly Prices" <price> { channel="energidataservice:service:energidataservice:electricity#hourly-prices" }
``` ```
@ -394,8 +394,8 @@ var priceMap = actions.getPrices(null)
var hourStart = now.toInstant().truncatedTo(ChronoUnit.HOURS) var hourStart = now.toInstant().truncatedTo(ChronoUnit.HOURS)
logInfo("Current total price excl. VAT", priceMap.get(hourStart).toString) logInfo("Current total price excl. VAT", priceMap.get(hourStart).toString)
var priceMap = actions.getPrices("SpotPrice,NetTariff"); var priceMap = actions.getPrices("SpotPrice,GridTariff");
logInfo("Current spot price + net tariff excl. VAT", priceMap.get(hourStart).toString) logInfo("Current spot price + grid tariff excl. VAT", priceMap.get(hourStart).toString)
var price = actions.calculatePrice(Instant.now, now.plusHours(1).toInstant, 150 | W) var price = actions.calculatePrice(Instant.now, now.plusHours(1).toInstant, 150 | W)
logInfo("Total price for using 150 W for the next hour", price.toString) logInfo("Total price for using 150 W for the next hour", price.toString)
@ -457,10 +457,10 @@ utils.javaMapToJsMap(edsActions.getPrices()).forEach((value, key) => {
var hourStart = time.Instant.now().truncatedTo(time.ChronoUnit.HOURS); var hourStart = time.Instant.now().truncatedTo(time.ChronoUnit.HOURS);
console.log("Current total price excl. VAT: " + priceMap.get(hourStart.toString())); console.log("Current total price excl. VAT: " + priceMap.get(hourStart.toString()));
utils.javaMapToJsMap(edsActions.getPrices("SpotPrice,NetTariff")).forEach((value, key) => { utils.javaMapToJsMap(edsActions.getPrices("SpotPrice,GridTariff")).forEach((value, key) => {
priceMap.set(key.toString(), value); priceMap.set(key.toString(), value);
}); });
console.log("Current spot price + net tariff excl. VAT: " + priceMap.get(hourStart.toString())); console.log("Current spot price + grid tariff excl. VAT: " + priceMap.get(hourStart.toString()));
var price = edsActions.calculatePrice(time.Instant.now(), time.Instant.now().plusSeconds(3600), Quantity("150 W")); var price = edsActions.calculatePrice(time.Instant.now(), time.Instant.now().plusSeconds(3600), Quantity("150 W"));
console.log("Total price for using 150 W for the next hour: " + price.toString()); console.log("Total price for using 150 W for the next hour: " + price.toString());

View File

@ -23,11 +23,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
*/ */
@NonNullByDefault @NonNullByDefault
public enum DatahubTariff { public enum DatahubTariff {
NET_TARIFF(CHANNEL_NET_TARIFF), GRID_TARIFF(CHANNEL_GRID_TARIFF),
SYSTEM_TARIFF(CHANNEL_SYSTEM_TARIFF), SYSTEM_TARIFF(CHANNEL_SYSTEM_TARIFF),
TRANSMISSION_GRID_TARIFF(CHANNEL_TRANSMISSION_GRID_TARIFF),
ELECTRICITY_TAX(CHANNEL_ELECTRICITY_TAX), ELECTRICITY_TAX(CHANNEL_ELECTRICITY_TAX),
REDUCED_ELECTRICITY_TAX(CHANNEL_REDUCED_ELECTRICITY_TAX), REDUCED_ELECTRICITY_TAX(CHANNEL_REDUCED_ELECTRICITY_TAX);
TRANSMISSION_NET_TARIFF(CHANNEL_TRANSMISSION_NET_TARIFF);
String channelId; String channelId;

View File

@ -42,22 +42,22 @@ public class EnergiDataServiceBindingConstants {
// List of all Channel ids // List of all Channel ids
public static final String CHANNEL_SPOT_PRICE = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR public static final String CHANNEL_SPOT_PRICE = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR
+ "spot-price"; + "spot-price";
public static final String CHANNEL_NET_TARIFF = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR public static final String CHANNEL_GRID_TARIFF = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR
+ "net-tariff"; + "grid-tariff";
public static final String CHANNEL_SYSTEM_TARIFF = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR public static final String CHANNEL_SYSTEM_TARIFF = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR
+ "system-tariff"; + "system-tariff";
public static final String CHANNEL_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR public static final String CHANNEL_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR
+ "electricity-tax"; + "electricity-tax";
public static final String CHANNEL_REDUCED_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY public static final String CHANNEL_REDUCED_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY
+ ChannelUID.CHANNEL_GROUP_SEPARATOR + "reduced-electricity-tax"; + ChannelUID.CHANNEL_GROUP_SEPARATOR + "reduced-electricity-tax";
public static final String CHANNEL_TRANSMISSION_NET_TARIFF = CHANNEL_GROUP_ELECTRICITY public static final String CHANNEL_TRANSMISSION_GRID_TARIFF = CHANNEL_GROUP_ELECTRICITY
+ ChannelUID.CHANNEL_GROUP_SEPARATOR + "transmission-net-tariff"; + ChannelUID.CHANNEL_GROUP_SEPARATOR + "transmission-grid-tariff";
public static final String CHANNEL_HOURLY_PRICES = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR public static final String CHANNEL_HOURLY_PRICES = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR
+ "hourly-prices"; + "hourly-prices";
public static final Set<String> ELECTRICITY_CHANNELS = Set.of(CHANNEL_SPOT_PRICE, CHANNEL_NET_TARIFF, public static final Set<String> ELECTRICITY_CHANNELS = Set.of(CHANNEL_SPOT_PRICE, CHANNEL_GRID_TARIFF,
CHANNEL_SYSTEM_TARIFF, CHANNEL_ELECTRICITY_TAX, CHANNEL_REDUCED_ELECTRICITY_TAX, CHANNEL_SYSTEM_TARIFF, CHANNEL_TRANSMISSION_GRID_TARIFF, CHANNEL_ELECTRICITY_TAX,
CHANNEL_TRANSMISSION_NET_TARIFF, CHANNEL_HOURLY_PRICES); CHANNEL_REDUCED_ELECTRICITY_TAX, CHANNEL_HOURLY_PRICES);
// List of all properties // List of all properties
public static final String PROPERTY_REMAINING_CALLS = "remainingCalls"; public static final String PROPERTY_REMAINING_CALLS = "remainingCalls";

View File

@ -63,11 +63,11 @@ public class EnergiDataServiceActions implements ThingActions {
private enum PriceComponent { private enum PriceComponent {
SPOT_PRICE("spotprice", null), SPOT_PRICE("spotprice", null),
NET_TARIFF("nettariff", DatahubTariff.NET_TARIFF), GRID_TARIFF("gridtariff", DatahubTariff.GRID_TARIFF),
SYSTEM_TARIFF("systemtariff", DatahubTariff.SYSTEM_TARIFF), SYSTEM_TARIFF("systemtariff", DatahubTariff.SYSTEM_TARIFF),
TRANSMISSION_GRID_TARIFF("transmissiongridtariff", DatahubTariff.TRANSMISSION_GRID_TARIFF),
ELECTRICITY_TAX("electricitytax", DatahubTariff.ELECTRICITY_TAX), ELECTRICITY_TAX("electricitytax", DatahubTariff.ELECTRICITY_TAX),
REDUCED_ELECTRICITY_TAX("reducedelectricitytax", DatahubTariff.REDUCED_ELECTRICITY_TAX), REDUCED_ELECTRICITY_TAX("reducedelectricitytax", DatahubTariff.REDUCED_ELECTRICITY_TAX);
TRANSMISSION_NET_TARIFF("transmissionnettariff", DatahubTariff.TRANSMISSION_NET_TARIFF);
private static final Map<String, PriceComponent> NAME_MAP = Stream.of(values()) private static final Map<String, PriceComponent> NAME_MAP = Stream.of(values())
.collect(Collectors.toMap(PriceComponent::toString, Function.identity())); .collect(Collectors.toMap(PriceComponent::toString, Function.identity()));

View File

@ -71,7 +71,7 @@ public class DatahubTariffFilterFactory {
public static final LocalDate RADIUS_CUTOFF_DATE = LocalDate.of(2023, 1, 1); public static final LocalDate RADIUS_CUTOFF_DATE = LocalDate.of(2023, 1, 1);
public static final LocalDate KONSTANT_CUTOFF_DATE = LocalDate.of(2023, 2, 1); public static final LocalDate KONSTANT_CUTOFF_DATE = LocalDate.of(2023, 2, 1);
public static DatahubTariffFilter getNetTariffByGLN(String globalLocationNumber) { public static DatahubTariffFilter getGridTariffByGLN(String globalLocationNumber) {
switch (globalLocationNumber) { switch (globalLocationNumber) {
case GLN_AAL_ELNET: case GLN_AAL_ELNET:
return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("AAL-NT-05"), ChargeTypeCode.of("AAL-NTR05")), return new DatahubTariffFilter(Set.of(ChargeTypeCode.of("AAL-NT-05"), ChargeTypeCode.of("AAL-NTR05")),
@ -167,6 +167,11 @@ public class DatahubTariffFilterFactory {
DateQueryParameter.of(ENERGINET_CUTOFF_DATE)); DateQueryParameter.of(ENERGINET_CUTOFF_DATE));
} }
public static DatahubTariffFilter getTransmissionGridTariff() {
return new DatahubTariffFilter(Set.of(), Set.of(NOTE_TRANSMISSION_NET_TARIFF),
DateQueryParameter.of(ENERGINET_CUTOFF_DATE));
}
public static DatahubTariffFilter getElectricityTax() { public static DatahubTariffFilter getElectricityTax() {
return new DatahubTariffFilter(Set.of(), Set.of(NOTE_ELECTRICITY_TAX), return new DatahubTariffFilter(Set.of(), Set.of(NOTE_ELECTRICITY_TAX),
DateQueryParameter.of(ENERGINET_CUTOFF_DATE)); DateQueryParameter.of(ENERGINET_CUTOFF_DATE));
@ -176,9 +181,4 @@ public class DatahubTariffFilterFactory {
return new DatahubTariffFilter(Set.of(), Set.of(NOTE_REDUCED_ELECTRICITY_TAX), return new DatahubTariffFilter(Set.of(), Set.of(NOTE_REDUCED_ELECTRICITY_TAX),
DateQueryParameter.of(LocalDate.of(2021, 2, 1))); 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));
}
} }

View File

@ -95,8 +95,9 @@ public class EnergiDataServiceHandler extends BaseThingHandler {
private @Nullable ScheduledFuture<?> priceUpdateFuture; private @Nullable ScheduledFuture<?> priceUpdateFuture;
private record Price(String hourStart, BigDecimal spotPrice, String spotPriceCurrency, private record Price(String hourStart, BigDecimal spotPrice, String spotPriceCurrency,
@Nullable BigDecimal netTariff, @Nullable BigDecimal systemTariff, @Nullable BigDecimal electricityTax, @Nullable BigDecimal gridTariff, @Nullable BigDecimal systemTariff,
@Nullable BigDecimal reducedElectricityTax, @Nullable BigDecimal transmissionNetTariff) { @Nullable BigDecimal transmissionGridTariff, @Nullable BigDecimal electricityTax,
@Nullable BigDecimal reducedElectricityTax) {
} }
public EnergiDataServiceHandler(Thing thing, HttpClient httpClient, TimeZoneProvider timeZoneProvider) { public EnergiDataServiceHandler(Thing thing, HttpClient httpClient, TimeZoneProvider timeZoneProvider) {
@ -236,7 +237,7 @@ public class EnergiDataServiceHandler extends BaseThingHandler {
private void downloadTariffs(DatahubTariff datahubTariff) throws InterruptedException, DataServiceException { private void downloadTariffs(DatahubTariff datahubTariff) throws InterruptedException, DataServiceException {
GlobalLocationNumber globalLocationNumber = switch (datahubTariff) { GlobalLocationNumber globalLocationNumber = switch (datahubTariff) {
case NET_TARIFF -> config.getGridCompanyGLN(); case GRID_TARIFF -> config.getGridCompanyGLN();
default -> config.getEnerginetGLN(); default -> config.getEnerginetGLN();
}; };
if (globalLocationNumber.isEmpty()) { if (globalLocationNumber.isEmpty()) {
@ -247,11 +248,11 @@ public class EnergiDataServiceHandler extends BaseThingHandler {
cacheManager.updateTariffs(datahubTariff); cacheManager.updateTariffs(datahubTariff);
} else { } else {
DatahubTariffFilter filter = switch (datahubTariff) { DatahubTariffFilter filter = switch (datahubTariff) {
case NET_TARIFF -> getNetTariffFilter(); case GRID_TARIFF -> getGridTariffFilter();
case SYSTEM_TARIFF -> DatahubTariffFilterFactory.getSystemTariff(); case SYSTEM_TARIFF -> DatahubTariffFilterFactory.getSystemTariff();
case TRANSMISSION_GRID_TARIFF -> DatahubTariffFilterFactory.getTransmissionGridTariff();
case ELECTRICITY_TAX -> DatahubTariffFilterFactory.getElectricityTax(); case ELECTRICITY_TAX -> DatahubTariffFilterFactory.getElectricityTax();
case REDUCED_ELECTRICITY_TAX -> DatahubTariffFilterFactory.getReducedElectricityTax(); case REDUCED_ELECTRICITY_TAX -> DatahubTariffFilterFactory.getReducedElectricityTax();
case TRANSMISSION_NET_TARIFF -> DatahubTariffFilterFactory.getTransmissionNetTariff();
}; };
cacheManager.putTariffs(datahubTariff, downloadPriceLists(globalLocationNumber, filter)); cacheManager.putTariffs(datahubTariff, downloadPriceLists(globalLocationNumber, filter));
} }
@ -267,24 +268,24 @@ public class EnergiDataServiceHandler extends BaseThingHandler {
return records; return records;
} }
private DatahubTariffFilter getNetTariffFilter() { private DatahubTariffFilter getGridTariffFilter() {
Channel channel = getThing().getChannel(CHANNEL_NET_TARIFF); Channel channel = getThing().getChannel(CHANNEL_GRID_TARIFF);
if (channel == null) { if (channel == null) {
return DatahubTariffFilterFactory.getNetTariffByGLN(config.gridCompanyGLN); return DatahubTariffFilterFactory.getGridTariffByGLN(config.gridCompanyGLN);
} }
DatahubPriceConfiguration datahubPriceConfiguration = channel.getConfiguration() DatahubPriceConfiguration datahubPriceConfiguration = channel.getConfiguration()
.as(DatahubPriceConfiguration.class); .as(DatahubPriceConfiguration.class);
if (!datahubPriceConfiguration.hasAnyFilterOverrides()) { if (!datahubPriceConfiguration.hasAnyFilterOverrides()) {
return DatahubTariffFilterFactory.getNetTariffByGLN(config.gridCompanyGLN); return DatahubTariffFilterFactory.getGridTariffByGLN(config.gridCompanyGLN);
} }
DateQueryParameter start = datahubPriceConfiguration.getStart(); DateQueryParameter start = datahubPriceConfiguration.getStart();
if (start == null) { if (start == null) {
logger.warn("Invalid channel configuration parameter 'start' or 'offset': {} (offset: {})", logger.warn("Invalid channel configuration parameter 'start' or 'offset': {} (offset: {})",
datahubPriceConfiguration.start, datahubPriceConfiguration.offset); datahubPriceConfiguration.start, datahubPriceConfiguration.offset);
return DatahubTariffFilterFactory.getNetTariffByGLN(config.gridCompanyGLN); return DatahubTariffFilterFactory.getGridTariffByGLN(config.gridCompanyGLN);
} }
Set<ChargeTypeCode> chargeTypeCodes = datahubPriceConfiguration.getChargeTypeCodes(); Set<ChargeTypeCode> chargeTypeCodes = datahubPriceConfiguration.getChargeTypeCodes();
@ -295,7 +296,7 @@ public class EnergiDataServiceHandler extends BaseThingHandler {
filter = new DatahubTariffFilter(chargeTypeCodes, notes, start); filter = new DatahubTariffFilter(chargeTypeCodes, notes, start);
} else { } else {
// Only override start date in pre-configured filter. // Only override start date in pre-configured filter.
filter = new DatahubTariffFilter(DatahubTariffFilterFactory.getNetTariffByGLN(config.gridCompanyGLN), filter = new DatahubTariffFilter(DatahubTariffFilterFactory.getGridTariffByGLN(config.gridCompanyGLN),
start); start);
} }
@ -341,13 +342,14 @@ public class EnergiDataServiceHandler extends BaseThingHandler {
int i = 0; int i = 0;
for (Entry<Instant, BigDecimal> sourcePrice : sourcePrices) { for (Entry<Instant, BigDecimal> sourcePrice : sourcePrices) {
Instant hourStart = sourcePrice.getKey(); Instant hourStart = sourcePrice.getKey();
BigDecimal netTariff = cacheManager.getTariff(DatahubTariff.NET_TARIFF, hourStart); BigDecimal gridTariff = cacheManager.getTariff(DatahubTariff.GRID_TARIFF, hourStart);
BigDecimal systemTariff = cacheManager.getTariff(DatahubTariff.SYSTEM_TARIFF, hourStart); BigDecimal systemTariff = cacheManager.getTariff(DatahubTariff.SYSTEM_TARIFF, hourStart);
BigDecimal transmissionGridTariff = cacheManager.getTariff(DatahubTariff.TRANSMISSION_GRID_TARIFF,
hourStart);
BigDecimal electricityTax = cacheManager.getTariff(DatahubTariff.ELECTRICITY_TAX, hourStart); BigDecimal electricityTax = cacheManager.getTariff(DatahubTariff.ELECTRICITY_TAX, hourStart);
BigDecimal reducedElectricityTax = cacheManager.getTariff(DatahubTariff.REDUCED_ELECTRICITY_TAX, hourStart); BigDecimal reducedElectricityTax = cacheManager.getTariff(DatahubTariff.REDUCED_ELECTRICITY_TAX, hourStart);
BigDecimal transmissionNetTariff = cacheManager.getTariff(DatahubTariff.TRANSMISSION_NET_TARIFF, hourStart); targetPrices[i++] = new Price(hourStart.toString(), sourcePrice.getValue(), config.currencyCode, gridTariff,
targetPrices[i++] = new Price(hourStart.toString(), sourcePrice.getValue(), config.currencyCode, netTariff, systemTariff, electricityTax, reducedElectricityTax, transmissionGridTariff);
systemTariff, electricityTax, reducedElectricityTax, transmissionNetTariff);
} }
updateState(CHANNEL_HOURLY_PRICES, new StringType(gson.toJson(targetPrices))); updateState(CHANNEL_HOURLY_PRICES, new StringType(gson.toJson(targetPrices)));
} }

View File

@ -60,16 +60,16 @@ channel-group-type.energidataservice.electricity.label = Electricity
channel-group-type.energidataservice.electricity.description = Channels related to electricity channel-group-type.energidataservice.electricity.description = Channels related to electricity
channel-group-type.energidataservice.electricity.channel.electricity-tax.label = Electricity Tax channel-group-type.energidataservice.electricity.channel.electricity-tax.label = Electricity Tax
channel-group-type.energidataservice.electricity.channel.electricity-tax.description = Current electricity tax in DKK per kWh. 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.grid-tariff.label = Grid Tariff
channel-group-type.energidataservice.electricity.channel.net-tariff.description = Current net tariff in DKK per kWh. channel-group-type.energidataservice.electricity.channel.grid-tariff.description = Current grid 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.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.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.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.spot-price.description = Current spot price in DKK or EUR per kWh.
channel-group-type.energidataservice.electricity.channel.system-tariff.label = System Tariff channel-group-type.energidataservice.electricity.channel.system-tariff.label = System Tariff
channel-group-type.energidataservice.electricity.channel.system-tariff.description = Current system tariff in DKK per kWh. channel-group-type.energidataservice.electricity.channel.system-tariff.description = Current system tariff in DKK per kWh.
channel-group-type.energidataservice.electricity.channel.transmission-net-tariff.label = Transmission Net Tariff channel-group-type.energidataservice.electricity.channel.transmission-grid-tariff.label = Transmission Grid Tariff
channel-group-type.energidataservice.electricity.channel.transmission-net-tariff.description = Current transmission net tariff in DKK per kWh. channel-group-type.energidataservice.electricity.channel.transmission-grid-tariff.description = Current transmission grid tariff in DKK per kWh.
# channel types # channel types

View File

@ -12,14 +12,18 @@
<label>Spot Price</label> <label>Spot Price</label>
<description>Current spot price in DKK or EUR per kWh.</description> <description>Current spot price in DKK or EUR per kWh.</description>
</channel> </channel>
<channel id="net-tariff" typeId="datahub-price"> <channel id="grid-tariff" typeId="datahub-price">
<label>Net Tariff</label> <label>Grid Tariff</label>
<description>Current net tariff in DKK per kWh.</description> <description>Current grid tariff in DKK per kWh.</description>
</channel> </channel>
<channel id="system-tariff" typeId="datahub-price"> <channel id="system-tariff" typeId="datahub-price">
<label>System Tariff</label> <label>System Tariff</label>
<description>Current system tariff in DKK per kWh.</description> <description>Current system tariff in DKK per kWh.</description>
</channel> </channel>
<channel id="transmission-grid-tariff" typeId="datahub-price">
<label>Transmission Grid Tariff</label>
<description>Current transmission grid tariff in DKK per kWh.</description>
</channel>
<channel id="electricity-tax" typeId="datahub-price"> <channel id="electricity-tax" typeId="datahub-price">
<label>Electricity Tax</label> <label>Electricity Tax</label>
<description>Current electricity tax in DKK per kWh.</description> <description>Current electricity tax in DKK per kWh.</description>
@ -28,10 +32,6 @@
<label>Reduced Electricity Tax</label> <label>Reduced Electricity Tax</label>
<description>Current reduced electricity tax in DKK per kWh. For electric heating customers only.</description> <description>Current reduced electricity tax in DKK per kWh. For electric heating customers only.</description>
</channel> </channel>
<channel id="transmission-net-tariff" typeId="datahub-price">
<label>Transmission Net Tariff</label>
<description>Current transmission net tariff in DKK per kWh.</description>
</channel>
<channel id="hourly-prices" typeId="hourly-prices"/> <channel id="hourly-prices" typeId="hourly-prices"/>
</channels> </channels>
</channel-group-type> </channel-group-type>

View File

@ -14,7 +14,7 @@
</channel-groups> </channel-groups>
<properties> <properties>
<property name="thingTypeVersion">1</property> <property name="thingTypeVersion">2</property>
</properties> </properties>
<config-description-ref uri="thing-type:energidataservice:service"/> <config-description-ref uri="thing-type:energidataservice:service"/>

View File

@ -13,6 +13,21 @@
</add-channel> </add-channel>
</instruction-set> </instruction-set>
<instruction-set targetVersion="2">
<add-channel id="grid-tariff" groupIds="electricity">
<type>energidataservice:datahub-price</type>
<label>Grid Tariff</label>
<description>Current grid tariff in DKK per kWh.</description>
</add-channel>
<add-channel id="transmission-grid-tariff" groupIds="electricity">
<type>energidataservice:datahub-price</type>
<label>Transmission Grid Tariff</label>
<description>Current transmission grid tariff in DKK per kWh.</description>
</add-channel>
<remove-channel id="net-tariff" groupIds="electricity"/>
<remove-channel id="transmission-net-tariff" groupIds="electricity"/>
</instruction-set>
</thing-type> </thing-type>
</update:update-descriptions> </update:update-descriptions>

View File

@ -109,10 +109,10 @@ public class EnergiDataServiceActionsTest {
} }
@Test @Test
void getPricesNetTariff() throws IOException { void getPricesGridTariff() throws IOException {
mockCommonDatasets(actions); mockCommonDatasets(actions);
Map<Instant, BigDecimal> actual = actions.getPrices("NetTariff"); Map<Instant, BigDecimal> actual = actions.getPrices("GridTariff");
assertThat(actual.size(), is(60)); assertThat(actual.size(), is(60));
assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("0.432225")))); assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("0.432225"))));
assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("1.05619")))); assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("1.05619"))));
@ -139,30 +139,30 @@ public class EnergiDataServiceActionsTest {
} }
@Test @Test
void getPricesTransmissionNetTariff() throws IOException { void getPricesTransmissionGridTariff() throws IOException {
mockCommonDatasets(actions); mockCommonDatasets(actions);
Map<Instant, BigDecimal> actual = actions.getPrices("TransmissionNetTariff"); Map<Instant, BigDecimal> actual = actions.getPrices("TransmissionGridTariff");
assertThat(actual.size(), is(60)); assertThat(actual.size(), is(60));
assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("0.058")))); assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("0.058"))));
assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("0.058")))); assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("0.058"))));
} }
@Test @Test
void getPricesSpotPriceNetTariff() throws IOException { void getPricesSpotPriceGridTariff() throws IOException {
mockCommonDatasets(actions); mockCommonDatasets(actions);
Map<Instant, BigDecimal> actual = actions.getPrices("SpotPrice,NetTariff"); Map<Instant, BigDecimal> actual = actions.getPrices("SpotPrice,GridTariff");
assertThat(actual.size(), is(35)); assertThat(actual.size(), is(35));
assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("1.425065027")))); assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("1.425065027"))));
assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("2.323870054")))); assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("2.323870054"))));
} }
@Test @Test
void getPricesSpotPriceNetTariffElectricityTax() throws IOException { void getPricesSpotPriceGridTariffElectricityTax() throws IOException {
mockCommonDatasets(actions); mockCommonDatasets(actions);
Map<Instant, BigDecimal> actual = actions.getPrices("SpotPrice,NetTariff,ElectricityTax"); Map<Instant, BigDecimal> actual = actions.getPrices("SpotPrice,GridTariff,ElectricityTax");
assertThat(actual.size(), is(35)); assertThat(actual.size(), is(35));
assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("1.433065027")))); assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("1.433065027"))));
assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("2.331870054")))); assertThat(actual.get(Instant.parse("2023-02-04T16:00:00Z")), is(equalTo(new BigDecimal("2.331870054"))));
@ -202,7 +202,7 @@ public class EnergiDataServiceActionsTest {
mockCommonDatasets(actions); mockCommonDatasets(actions);
Map<Instant, BigDecimal> actual = actions Map<Instant, BigDecimal> actual = actions
.getPrices("spotprice,nettariff,systemtariff,electricitytax,transmissionnettariff"); .getPrices("spotprice,gridtariff,systemtariff,electricitytax,transmissiongridtariff");
assertThat(actual.size(), is(35)); assertThat(actual.size(), is(35));
assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("1.545065027")))); assertThat(actual.get(Instant.parse("2023-02-04T12:00:00Z")), is(equalTo(new BigDecimal("1.545065027"))));
assertThat(actual.get(Instant.parse("2023-02-04T15:00:00Z")), is(equalTo(new BigDecimal("1.708765039")))); assertThat(actual.get(Instant.parse("2023-02-04T15:00:00Z")), is(equalTo(new BigDecimal("1.708765039"))));
@ -213,7 +213,7 @@ public class EnergiDataServiceActionsTest {
void getPricesInvalidPriceComponent() throws IOException { void getPricesInvalidPriceComponent() throws IOException {
mockCommonDatasets(actions); mockCommonDatasets(actions);
Map<Instant, BigDecimal> actual = actions.getPrices("spotprice,nettarif"); Map<Instant, BigDecimal> actual = actions.getPrices("spotprice,gridtarif");
assertThat(actual.size(), is(0)); assertThat(actual.size(), is(0));
} }
@ -222,7 +222,7 @@ public class EnergiDataServiceActionsTest {
mockCommonDatasets(actions); mockCommonDatasets(actions);
when(handler.getCurrency()).thenReturn(EnergiDataServiceBindingConstants.CURRENCY_EUR); when(handler.getCurrency()).thenReturn(EnergiDataServiceBindingConstants.CURRENCY_EUR);
Map<Instant, BigDecimal> actual = actions.getPrices("spotprice,nettariff"); Map<Instant, BigDecimal> actual = actions.getPrices("spotprice,gridtariff");
assertThat(actual.size(), is(0)); assertThat(actual.size(), is(0));
} }
@ -404,8 +404,8 @@ public class EnergiDataServiceActionsTest {
PriceListParser priceListParser = new PriceListParser( PriceListParser priceListParser = new PriceListParser(
Clock.fixed(spotPriceRecords[0].hourStart, EnergiDataServiceBindingConstants.DATAHUB_TIMEZONE)); Clock.fixed(spotPriceRecords[0].hourStart, EnergiDataServiceBindingConstants.DATAHUB_TIMEZONE));
DatahubPricelistRecords datahubRecords = getObjectFromJson("NetTariffs.json", DatahubPricelistRecords.class); DatahubPricelistRecords datahubRecords = getObjectFromJson("GridTariffs.json", DatahubPricelistRecords.class);
Map<Instant, BigDecimal> netTariffs = priceListParser Map<Instant, BigDecimal> gridTariffs = priceListParser
.toHourly(Arrays.stream(datahubRecords.records()).toList()); .toHourly(Arrays.stream(datahubRecords.records()).toList());
datahubRecords = getObjectFromJson("SystemTariffs.json", DatahubPricelistRecords.class); datahubRecords = getObjectFromJson("SystemTariffs.json", DatahubPricelistRecords.class);
Map<Instant, BigDecimal> systemTariffs = priceListParser Map<Instant, BigDecimal> systemTariffs = priceListParser
@ -416,16 +416,16 @@ public class EnergiDataServiceActionsTest {
datahubRecords = getObjectFromJson("ReducedElectricityTaxes.json", DatahubPricelistRecords.class); datahubRecords = getObjectFromJson("ReducedElectricityTaxes.json", DatahubPricelistRecords.class);
Map<Instant, BigDecimal> reducedElectricityTaxes = priceListParser Map<Instant, BigDecimal> reducedElectricityTaxes = priceListParser
.toHourly(Arrays.stream(datahubRecords.records()).toList()); .toHourly(Arrays.stream(datahubRecords.records()).toList());
datahubRecords = getObjectFromJson("TransmissionNetTariffs.json", DatahubPricelistRecords.class); datahubRecords = getObjectFromJson("TransmissionGridTariffs.json", DatahubPricelistRecords.class);
Map<Instant, BigDecimal> transmissionNetTariffs = priceListParser Map<Instant, BigDecimal> transmissionGridTariffs = priceListParser
.toHourly(Arrays.stream(datahubRecords.records()).toList()); .toHourly(Arrays.stream(datahubRecords.records()).toList());
when(handler.getSpotPrices()).thenReturn(spotPrices); when(handler.getSpotPrices()).thenReturn(spotPrices);
when(handler.getTariffs(DatahubTariff.NET_TARIFF)).thenReturn(netTariffs); when(handler.getTariffs(DatahubTariff.GRID_TARIFF)).thenReturn(gridTariffs);
when(handler.getTariffs(DatahubTariff.SYSTEM_TARIFF)).thenReturn(systemTariffs); when(handler.getTariffs(DatahubTariff.SYSTEM_TARIFF)).thenReturn(systemTariffs);
when(handler.getTariffs(DatahubTariff.TRANSMISSION_GRID_TARIFF)).thenReturn(transmissionGridTariffs);
when(handler.getTariffs(DatahubTariff.ELECTRICITY_TAX)).thenReturn(electricityTaxes); when(handler.getTariffs(DatahubTariff.ELECTRICITY_TAX)).thenReturn(electricityTaxes);
when(handler.getTariffs(DatahubTariff.REDUCED_ELECTRICITY_TAX)).thenReturn(reducedElectricityTaxes); when(handler.getTariffs(DatahubTariff.REDUCED_ELECTRICITY_TAX)).thenReturn(reducedElectricityTaxes);
when(handler.getTariffs(DatahubTariff.TRANSMISSION_NET_TARIFF)).thenReturn(transmissionNetTariffs);
when(handler.getCurrency()).thenReturn(EnergiDataServiceBindingConstants.CURRENCY_DKK); when(handler.getCurrency()).thenReturn(EnergiDataServiceBindingConstants.CURRENCY_DKK);
when(handler.isReducedElectricityTax()).thenReturn(isReducedElectricityTax); when(handler.isReducedElectricityTax()).thenReturn(isReducedElectricityTax);
actions.setThingHandler(handler); actions.setThingHandler(handler);