mirror of
				https://github.com/Akkudoktor-EOS/EOS.git
				synced 2025-10-30 22:36:21 +00:00 
			
		
		
		
	add configurable VAT rate for electricity price calculations (#680)
* add configurable VAT rate for electricity price calculations * add VAT rate configuration for electricity price calculations in docs * added vat_rate * fix: Format VAT rate field definition according to ruff formatting standards --------- Co-authored-by: Börni <kontakt@bernhardhientz.com>
This commit is contained in:
		| @@ -424,6 +424,7 @@ Validators: | |||||||
| | ---- | -------------------- | ---- | --------- | ------- | ----------- | | | ---- | -------------------- | ---- | --------- | ------- | ----------- | | ||||||
| | provider | `EOS_ELECPRICE__PROVIDER` | `Optional[str]` | `rw` | `None` | Electricity price provider id of provider to be used. | | | provider | `EOS_ELECPRICE__PROVIDER` | `Optional[str]` | `rw` | `None` | Electricity price provider id of provider to be used. | | ||||||
| | charges_kwh | `EOS_ELECPRICE__CHARGES_KWH` | `Optional[float]` | `rw` | `None` | Electricity price charges (€/kWh). | | | charges_kwh | `EOS_ELECPRICE__CHARGES_KWH` | `Optional[float]` | `rw` | `None` | Electricity price charges (€/kWh). | | ||||||
|  | | vat_rate | `EOS_ELECPRICE__VAT_RATE` | `Optional[float]` | `rw` | `1.19` | VAT rate factor applied to electricity price when charges are used. | | ||||||
| | provider_settings | `EOS_ELECPRICE__PROVIDER_SETTINGS` | `Optional[akkudoktoreos.prediction.elecpriceimport.ElecPriceImportCommonSettings]` | `rw` | `None` | Provider settings | | | provider_settings | `EOS_ELECPRICE__PROVIDER_SETTINGS` | `Optional[akkudoktoreos.prediction.elecpriceimport.ElecPriceImportCommonSettings]` | `rw` | `None` | Provider settings | | ||||||
| ::: | ::: | ||||||
|  |  | ||||||
| @@ -436,6 +437,7 @@ Validators: | |||||||
|        "elecprice": { |        "elecprice": { | ||||||
|            "provider": "ElecPriceAkkudoktor", |            "provider": "ElecPriceAkkudoktor", | ||||||
|            "charges_kwh": 0.21, |            "charges_kwh": 0.21, | ||||||
|  |            "vat_rate": 1.19, | ||||||
|            "provider_settings": null |            "provider_settings": null | ||||||
|        } |        } | ||||||
|    } |    } | ||||||
| @@ -1050,6 +1052,7 @@ Validators: | |||||||
|        "elecprice": { |        "elecprice": { | ||||||
|            "provider": "ElecPriceAkkudoktor", |            "provider": "ElecPriceAkkudoktor", | ||||||
|            "charges_kwh": 0.21, |            "charges_kwh": 0.21, | ||||||
|  |            "vat_rate": 1.19, | ||||||
|            "provider_settings": null |            "provider_settings": null | ||||||
|        }, |        }, | ||||||
|        "load": { |        "load": { | ||||||
|   | |||||||
| @@ -123,6 +123,7 @@ Configuration options: | |||||||
|     - `ElecPriceImport`: Imports from a file or JSON string. |     - `ElecPriceImport`: Imports from a file or JSON string. | ||||||
|  |  | ||||||
|   - `charges_kwh`: Electricity price charges (€/kWh). |   - `charges_kwh`: Electricity price charges (€/kWh). | ||||||
|  |   - `vat_rate`: VAT rate factor applied to electricity price when charges are used (default: 1.19). | ||||||
|   - `provider_settings.import_file_path`: Path to the file to import electricity price forecast data from. |   - `provider_settings.import_file_path`: Path to the file to import electricity price forecast data from. | ||||||
|   - `provider_settings.import_json`: JSON string, dictionary of electricity price forecast value lists. |   - `provider_settings.import_json`: JSON string, dictionary of electricity price forecast value lists. | ||||||
|  |  | ||||||
| @@ -147,7 +148,7 @@ real-time market data with historical price trends. | |||||||
| Charges and VAT | Charges and VAT | ||||||
|  |  | ||||||
| - If `charges_kwh` configuration option is greater than 0, the electricity price is calculated as: | - If `charges_kwh` configuration option is greater than 0, the electricity price is calculated as: | ||||||
|   `(market price + charges_kwh) * 1.19 VAT` (including 19% VAT). |   `(market price + charges_kwh) * vat_rate` where `vat_rate` is configurable (default: 1.19 for 19% VAT). | ||||||
| - If `charges_kwh` is set to 0, the electricity price is simply: `market_price` (no VAT applied). | - If `charges_kwh` is set to 0, the electricity price is simply: `market_price` (no VAT applied). | ||||||
|  |  | ||||||
| **Note:** For the most accurate forecasts, it is recommended to set the `historic_hours` parameter to 840. | **Note:** For the most accurate forecasts, it is recommended to set the `historic_hours` parameter to 840. | ||||||
|   | |||||||
							
								
								
									
										9779
									
								
								openapi.json
									
									
									
									
									
								
							
							
						
						
									
										9779
									
								
								openapi.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -28,6 +28,12 @@ class ElecPriceCommonSettings(SettingsBaseModel): | |||||||
|     charges_kwh: Optional[float] = Field( |     charges_kwh: Optional[float] = Field( | ||||||
|         default=None, ge=0, description="Electricity price charges (€/kWh).", examples=[0.21] |         default=None, ge=0, description="Electricity price charges (€/kWh).", examples=[0.21] | ||||||
|     ) |     ) | ||||||
|  |     vat_rate: Optional[float] = Field( | ||||||
|  |         default=1.19, | ||||||
|  |         ge=0, | ||||||
|  |         description="VAT rate factor applied to electricity price when charges are used.", | ||||||
|  |         examples=[1.19], | ||||||
|  |     ) | ||||||
|  |  | ||||||
|     provider_settings: Optional[ElecPriceImportCommonSettings] = Field( |     provider_settings: Optional[ElecPriceImportCommonSettings] = Field( | ||||||
|         default=None, description="Provider settings", examples=[None] |         default=None, description="Provider settings", examples=[None] | ||||||
|   | |||||||
| @@ -127,7 +127,8 @@ class ElecPriceEnergyCharts(ElecPriceProvider): | |||||||
|  |  | ||||||
|             # Convert EUR/MWh to EUR/Wh, apply charges and VAT if charges > 0 |             # Convert EUR/MWh to EUR/Wh, apply charges and VAT if charges > 0 | ||||||
|             if charges_wh > 0: |             if charges_wh > 0: | ||||||
|                 price_wh = ((price_eur_per_mwh / 1_000_000) + charges_wh) * 1.19 |                 vat_rate = self.config.elecprice.vat_rate or 1.19 | ||||||
|  |                 price_wh = ((price_eur_per_mwh / 1_000_000) + charges_wh) * vat_rate | ||||||
|             else: |             else: | ||||||
|                 price_wh = price_eur_per_mwh / 1_000_000 |                 price_wh = price_eur_per_mwh / 1_000_000 | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user