mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[aWATTar] include fees in calculation
Signed-off-by: Thomas Leber <thomas@tl-photography.at>
This commit is contained in:
parent
6a05bf2b3f
commit
c81b9799f4
@ -37,6 +37,8 @@ Auto discovery is not supported.
|
||||
| timeZone | The time zone the hour definitions of the things below refer to. Default is `CET`, as it corresponds to the aWATTar API. It is strongly recommended not to change this. However, if you do so, be aware that the prices delivered by the API will not cover a whole calendar day in this timezone. **Advanced** |
|
||||
| country | The country prices should be received for. Use `DE` for Germany or `AT` for Austria. `DE` is the default. |
|
||||
|
||||
Note: The prices include already the 3% and 1.5 €cent per kWh fees for the aWATTar service.
|
||||
|
||||
### Prices Thing
|
||||
|
||||
The prices thing does not need any configuration.
|
||||
|
@ -23,8 +23,8 @@ import org.openhab.binding.awattar.internal.handler.TimeRange;
|
||||
*
|
||||
* @param netPrice the net price in €/kWh
|
||||
* @param grossPrice the gross price in €/kWh
|
||||
* @param netTotal the net total price in €
|
||||
* @param grossTotal the gross total price in €
|
||||
* @param netTotal the net total price in €/kWh
|
||||
* @param grossTotal the gross total price in €/kWh
|
||||
* @param timerange the time range of the price
|
||||
*/
|
||||
@NonNullByDefault
|
||||
|
@ -62,6 +62,8 @@ public class AwattarApi {
|
||||
|
||||
private Gson gson;
|
||||
|
||||
private String country;
|
||||
|
||||
/**
|
||||
* Generic exception for the aWATTar API.
|
||||
*/
|
||||
@ -82,6 +84,7 @@ public class AwattarApi {
|
||||
public AwattarApi(HttpClient httpClient, ZoneId zone, AwattarBridgeConfiguration config) {
|
||||
this.zone = zone;
|
||||
this.httpClient = httpClient;
|
||||
this.country = config.country;
|
||||
|
||||
this.gson = new Gson();
|
||||
|
||||
@ -141,6 +144,18 @@ public class AwattarApi {
|
||||
double netMarket = d.marketprice / 10.0;
|
||||
double grossMarket = netMarket * vatFactor;
|
||||
double netTotal = netMarket + basePrice;
|
||||
|
||||
// in Austria the fee is added as absolute value
|
||||
if ("AT".equals(country)) {
|
||||
// add 3% absolute fee for the aWATTar service (Ausgleichskomponente)
|
||||
netTotal += Math.abs(netTotal) * 0.03;
|
||||
} else if ("DE".equals(country)) {
|
||||
// add 3% fee for the aWATTar service (Ausgleichskomponente)
|
||||
netTotal = netTotal * 1.03;
|
||||
}
|
||||
|
||||
netTotal = netTotal + 1.5; // add 1.5 €/MWh for aWATTar service (Beschaffungskomponente)
|
||||
|
||||
double grossTotal = netTotal * vatFactor;
|
||||
|
||||
result.add(new AwattarPrice(netMarket, grossMarket, netTotal, grossTotal,
|
||||
|
Loading…
Reference in New Issue
Block a user