diff --git a/bundles/org.openhab.binding.energidataservice/README.md b/bundles/org.openhab.binding.energidataservice/README.md index ff6da1f4dc465..75c42747e02b2 100644 --- a/bundles/org.openhab.binding.energidataservice/README.md +++ b/bundles/org.openhab.binding.energidataservice/README.md @@ -39,14 +39,14 @@ To obtain the Global Location Number of your grid company: ### Channel Group `electricity` -| Channel | Type | Description | Advanced | -|---------------------------------|--------|------------------------------------------------------------------------------------------------|----------| -| current-spot-price | Number | Spot price in DKK or EUR per kWh for current hour | no | -| current-net-tariff | Number | Net tariff in DKK per kWh for current hour. Only available when `gridCompanyGLN` is configured | no | -| current-system-tariff | Number | System tariff in DKK per kWh for current hour | no | -| current-electricity-tax | Number | Electricity tax in DKK per kWh for current hour | no | -| current-transmission-net-tariff | Number | Transmission net tariff in DKK per kWh for current hour | no | -| hourly-prices | String | JSON array with hourly prices from 12 hours ago and onward | yes | +| Channel | Type | Description | Advanced | +|-------------------------|--------|---------------------------------------------------------------------------------------|----------| +| 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 | +| system-tariff | Number | Current system tariff in DKK per kWh | 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 | +| hourly-prices | String | JSON array with hourly prices from 12 hours ago and onward | yes | _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. @@ -63,13 +63,13 @@ To include VAT for items linked to the `Number` channels, the [VAT profile](http This must be installed separately. Once installed, simply select "Value-Added Tax" as Profile when linking an item. -#### Current Net Tariff +#### Net Tariff -Discounts are automatically taken into account for channel `current-net-tariff` so that it represents the actual price. +Discounts are automatically taken into account for channel `net-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). If your company is not in the list, or the filters are not working, they can be manually overridden. -To override filters, the channel `current-net-tariff` has the following configuration parameters: +To override filters, the channel `net-tariff` has the following configuration parameters: | Name | Type | Description | Default | Required | Advanced | |-----------------|---------|----------------------------------------------------------------------------------------------------------------------------|---------|----------|----------| @@ -320,19 +320,19 @@ var priceMap = actions.getPrices("SpotPrice,NetTariff"); ```java Thing energidataservice:service:energidataservice "Energi Data Service" [ priceArea="DK1", currencyCode="DKK", gridCompanyGLN="5790001089030" ] { Channels: - Number : electricity#current-net-tariff [ chargeTypeCodes="CD,CD R", start="StartOfYear" ] + Number : electricity#net-tariff [ chargeTypeCodes="CD,CD R", start="StartOfYear" ] } ``` ### Item Configuration ```java -Group:Number:SUM CurrentTotalPrice "Current Total Price" -Number CurrentSpotPrice "Current Spot Price" (CurrentTotalPrice) { channel="energidataservice:service:energidataservice:electricity#current-spot-price" [profile="transform:VAT"] } -Number CurrentNetTariff "Current Net Tariff" (CurrentTotalPrice) { channel="energidataservice:service:energidataservice:electricity#current-net-tariff" [profile="transform:VAT"] } -Number CurrentSystemTariff "Current System Tariff" (CurrentTotalPrice) { channel="energidataservice:service:energidataservice:electricity#current-system-tariff" [profile="transform:VAT"] } -Number CurrentElectricityTax "Current Electricity Tax" (CurrentTotalPrice) { channel="energidataservice:service:energidataservice:electricity#current-electricity-tax" [profile="transform:VAT"] } -Number CurrentTransmissionNetTariff "Current Transmission Tariff" (CurrentTotalPrice) { channel="energidataservice:service:energidataservice:electricity#current-transmission-net-tariff" [profile="transform:VAT"] } +Group:Number:SUM TotalPrice "Current Total Price" +Number SpotPrice "Current Spot Price" (TotalPrice) { channel="energidataservice:service:energidataservice:electricity#spot-price" [profile="transform:VAT"] } +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 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/EnergiDataServiceBindingConstants.java b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/EnergiDataServiceBindingConstants.java index 482c70ff6d37d..aa828627a98f0 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 @@ -40,22 +40,21 @@ public class EnergiDataServiceBindingConstants { public static final String CHANNEL_GROUP_ELECTRICITY = "electricity"; // List of all Channel ids - public static final String CHANNEL_CURRENT_SPOT_PRICE = CHANNEL_GROUP_ELECTRICITY - + ChannelUID.CHANNEL_GROUP_SEPARATOR + "current-spot-price"; - public static final String CHANNEL_CURRENT_NET_TARIFF = CHANNEL_GROUP_ELECTRICITY - + ChannelUID.CHANNEL_GROUP_SEPARATOR + "current-net-tariff"; - public static final String CHANNEL_CURRENT_SYSTEM_TARIFF = CHANNEL_GROUP_ELECTRICITY - + ChannelUID.CHANNEL_GROUP_SEPARATOR + "current-system-tariff"; - public static final String CHANNEL_CURRENT_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY - + ChannelUID.CHANNEL_GROUP_SEPARATOR + "current-electricity-tax"; - public static final String CHANNEL_CURRENT_TRANSMISSION_NET_TARIFF = CHANNEL_GROUP_ELECTRICITY - + ChannelUID.CHANNEL_GROUP_SEPARATOR + "current-transmission-net-tariff"; + public static final String CHANNEL_SPOT_PRICE = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR + + "spot-price"; + public static final String CHANNEL_NET_TARIFF = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR + + "net-tariff"; + public static final String CHANNEL_SYSTEM_TARIFF = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR + + "system-tariff"; + public static final String CHANNEL_ELECTRICITY_TAX = CHANNEL_GROUP_ELECTRICITY + ChannelUID.CHANNEL_GROUP_SEPARATOR + + "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_CURRENT_SPOT_PRICE, - CHANNEL_CURRENT_NET_TARIFF, CHANNEL_CURRENT_SYSTEM_TARIFF, CHANNEL_CURRENT_ELECTRICITY_TAX, - CHANNEL_CURRENT_TRANSMISSION_NET_TARIFF, CHANNEL_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); // 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/handler/EnergiDataServiceHandler.java b/bundles/org.openhab.binding.energidataservice/src/main/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java index 3f8845c4a0f61..8b174c66e539f 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 @@ -166,30 +166,30 @@ public Collection> getServices() { private void refreshElectricityPrices() { RetryStrategy retryPolicy; try { - if (isLinked(CHANNEL_CURRENT_SPOT_PRICE) || isLinked(CHANNEL_HOURLY_PRICES)) { + if (isLinked(CHANNEL_SPOT_PRICE) || isLinked(CHANNEL_HOURLY_PRICES)) { downloadSpotPrices(); } - if (isLinked(CHANNEL_CURRENT_NET_TARIFF) || isLinked(CHANNEL_HOURLY_PRICES)) { + if (isLinked(CHANNEL_NET_TARIFF) || isLinked(CHANNEL_HOURLY_PRICES)) { downloadNetTariffs(); } - if (isLinked(CHANNEL_CURRENT_SYSTEM_TARIFF) || isLinked(CHANNEL_HOURLY_PRICES)) { + if (isLinked(CHANNEL_SYSTEM_TARIFF) || isLinked(CHANNEL_HOURLY_PRICES)) { downloadSystemTariffs(); } - if (isLinked(CHANNEL_CURRENT_ELECTRICITY_TAX) || isLinked(CHANNEL_HOURLY_PRICES)) { + if (isLinked(CHANNEL_ELECTRICITY_TAX) || isLinked(CHANNEL_HOURLY_PRICES)) { downloadElectricityTaxes(); } - if (isLinked(CHANNEL_CURRENT_TRANSMISSION_NET_TARIFF) || isLinked(CHANNEL_HOURLY_PRICES)) { + if (isLinked(CHANNEL_TRANSMISSION_NET_TARIFF) || isLinked(CHANNEL_HOURLY_PRICES)) { downloadTransmissionNetTariffs(); } updateStatus(ThingStatus.ONLINE); updatePrices(); - if (isLinked(CHANNEL_CURRENT_SPOT_PRICE) || isLinked(CHANNEL_HOURLY_PRICES)) { + if (isLinked(CHANNEL_SPOT_PRICE) || isLinked(CHANNEL_HOURLY_PRICES)) { if (cacheManager.getNumberOfFutureSpotPrices() < 13) { retryPolicy = RetryPolicyFactory.whenExpectedSpotPriceDataMissing(DAILY_REFRESH_TIME_CET, NORD_POOL_TIMEZONE); @@ -303,7 +303,7 @@ private Collection downloadPriceLists(GlobalLocationNumb } private DatahubTariffFilter getNetTariffFilter() { - Channel channel = getThing().getChannel(CHANNEL_CURRENT_NET_TARIFF); + Channel channel = getThing().getChannel(CHANNEL_NET_TARIFF); if (channel == null) { return DatahubTariffFilterFactory.getNetTariffByGLN(config.gridCompanyGLN); } @@ -336,21 +336,21 @@ private void updatePrices() { cacheManager.cleanup(); updateCurrentSpotPrice(); - updateCurrentTariff(CHANNEL_CURRENT_NET_TARIFF, cacheManager.getNetTariff()); - updateCurrentTariff(CHANNEL_CURRENT_SYSTEM_TARIFF, cacheManager.getSystemTariff()); - updateCurrentTariff(CHANNEL_CURRENT_ELECTRICITY_TAX, cacheManager.getElectricityTax()); - updateCurrentTariff(CHANNEL_CURRENT_TRANSMISSION_NET_TARIFF, cacheManager.getTransmissionNetTariff()); + updateCurrentTariff(CHANNEL_NET_TARIFF, cacheManager.getNetTariff()); + updateCurrentTariff(CHANNEL_SYSTEM_TARIFF, cacheManager.getSystemTariff()); + updateCurrentTariff(CHANNEL_ELECTRICITY_TAX, cacheManager.getElectricityTax()); + updateCurrentTariff(CHANNEL_TRANSMISSION_NET_TARIFF, cacheManager.getTransmissionNetTariff()); updateHourlyPrices(); reschedulePriceUpdateJob(); } private void updateCurrentSpotPrice() { - if (!isLinked(CHANNEL_CURRENT_SPOT_PRICE)) { + if (!isLinked(CHANNEL_SPOT_PRICE)) { return; } BigDecimal spotPrice = cacheManager.getSpotPrice(); - updateState(CHANNEL_CURRENT_SPOT_PRICE, spotPrice != null ? new DecimalType(spotPrice) : UnDefType.UNDEF); + updateState(CHANNEL_SPOT_PRICE, spotPrice != null ? new DecimalType(spotPrice) : UnDefType.UNDEF); } private void updateCurrentTariff(String channelId, @Nullable BigDecimal tariff) { 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 5ab01b677a135..cddea56eff981 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 @@ -54,16 +54,16 @@ thing-type.config.energidataservice.service.priceArea.option.DK2 = East of the G channel-group-type.energidataservice.electricity.label = Electricity channel-group-type.energidataservice.electricity.description = Channels related to electricity -channel-group-type.energidataservice.electricity.channel.current-electricity-tax.label = Current Electricity Tax -channel-group-type.energidataservice.electricity.channel.current-electricity-tax.description = Electricity Tax in DKK per kWh for current hour. -channel-group-type.energidataservice.electricity.channel.current-net-tariff.label = Current Net Tariff -channel-group-type.energidataservice.electricity.channel.current-net-tariff.description = Net tariff in DKK per kWh for current hour. -channel-group-type.energidataservice.electricity.channel.current-spot-price.label = Current Spot Price -channel-group-type.energidataservice.electricity.channel.current-spot-price.description = Spot price in DKK or EUR per kWh for current hour. -channel-group-type.energidataservice.electricity.channel.current-system-tariff.label = Current System Tariff -channel-group-type.energidataservice.electricity.channel.current-system-tariff.description = System tariff in DKK per kWh for current hour. -channel-group-type.energidataservice.electricity.channel.current-transmission-net-tariff.label = Current Transmission Tariff -channel-group-type.energidataservice.electricity.channel.current-transmission-net-tariff.description = Transmission Net Tariff in DKK per kWh for current hour. +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.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.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 +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-net-tariff.description = Current transmission net tariff in DKK per kWh. # channel types @@ -86,6 +86,19 @@ channel-type.config.energidataservice.datahub-price.start.option.StartOfDay = St channel-type.config.energidataservice.datahub-price.start.option.StartOfMonth = Start of month channel-type.config.energidataservice.datahub-price.start.option.StartOfYear = Start of year +# channel group types + +channel-group-type.energidataservice.electricity.channel.current-electricity-tax.label = Current Electricity Tax +channel-group-type.energidataservice.electricity.channel.current-electricity-tax.description = Electricity Tax in DKK per kWh for current hour. +channel-group-type.energidataservice.electricity.channel.current-net-tariff.label = Current Net Tariff +channel-group-type.energidataservice.electricity.channel.current-net-tariff.description = Net tariff in DKK per kWh for current hour. +channel-group-type.energidataservice.electricity.channel.current-spot-price.label = Current Spot Price +channel-group-type.energidataservice.electricity.channel.current-spot-price.description = Spot price in DKK or EUR per kWh for current hour. +channel-group-type.energidataservice.electricity.channel.current-system-tariff.label = Current System Tariff +channel-group-type.energidataservice.electricity.channel.current-system-tariff.description = System tariff in DKK per kWh for current hour. +channel-group-type.energidataservice.electricity.channel.current-transmission-net-tariff.label = Current Transmission Tariff +channel-group-type.energidataservice.electricity.channel.current-transmission-net-tariff.description = Transmission Net Tariff in DKK per kWh for current hour. + # thing status descriptions offline.conf-error.no-price-area = Price area must be set 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 3ab2375a5f953..2a22018260c37 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 @@ -8,25 +8,25 @@ Channels related to electricity - - - Spot price in DKK or EUR per kWh for current hour. + + + Current spot price in DKK or EUR per kWh. - - - Net tariff in DKK per kWh for current hour. + + + Current net tariff in DKK per kWh. - - - System tariff in DKK per kWh for current hour. + + + Current system tariff in DKK per kWh. - - - Electricity Tax in DKK per kWh for current hour. + + + Current electricity tax in DKK per kWh. - - - Transmission Net Tariff in DKK per kWh for current hour. + + + Current transmission net tariff in DKK per kWh.