From 2da50eb9dd91a42dfa712b6b18a8629a3c36bcd3 Mon Sep 17 00:00:00 2001 From: Malene Trab Date: Wed, 11 Oct 2023 16:49:56 +0000 Subject: [PATCH] Add chargetype to filter, to filter out false hits --- .../tariffs/energidataservice/__init__.py | 14 ++++----- .../tariffs/energidataservice/chargeowners.py | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/custom_components/energidataservice/tariffs/energidataservice/__init__.py b/custom_components/energidataservice/tariffs/energidataservice/__init__.py index 5ebbb3c..0b574a4 100644 --- a/custom_components/energidataservice/tariffs/energidataservice/__init__.py +++ b/custom_components/energidataservice/tariffs/energidataservice/__init__.py @@ -62,8 +62,10 @@ async def async_get_tariffs(self): chargeowner = CHARGEOWNERS[self._chargeowner] limit = "limit=500" - objfilter = 'filter=%7B"chargetypecode": {},"gln_number": ["{}"]%7D'.format( # pylint: disable=consider-using-f-string - str(chargeowner["type"]).replace("'", '"'), chargeowner["gln"] + objfilter = 'filter=%7B"chargetypecode": {},"gln_number": ["{}"],"chargetype": {}%7D'.format( # pylint: disable=consider-using-f-string + str(chargeowner["type"]).replace("'", '"'), + chargeowner["gln"], + str(chargeowner["chargetype"]).replace("'", '"'), ) sort = "sort=ValidFrom desc" @@ -99,9 +101,7 @@ async def async_get_tariffs(self): if len(tariff_data) == 24: current_val += tariff_data[hour] - tariff_data.update( - {hour: current_val} - ) + tariff_data.update({hour: current_val}) if len(tariff_data) == 24: self._tariffs.update(tariff_data) @@ -135,9 +135,7 @@ def get_dated_tariff(self, date: datetime) -> dict: if len(tariff_data) == 24: current_val += tariff_data[hour] - tariff_data.update( - {hour: current_val} - ) + tariff_data.update({hour: current_val}) if len(tariff_data) == 24: return tariff_data diff --git a/custom_components/energidataservice/tariffs/energidataservice/chargeowners.py b/custom_components/energidataservice/tariffs/energidataservice/chargeowners.py index 6148edf..1090150 100644 --- a/custom_components/energidataservice/tariffs/energidataservice/chargeowners.py +++ b/custom_components/energidataservice/tariffs/energidataservice/chargeowners.py @@ -5,145 +5,174 @@ "gln": "5790000705689", "company": "Radius Elnet A/S", "type": ["DT_C_01"], + "chargetype": ["D03"], }, "RAH": { "gln": "5790000681327", "company": "RAH Net A/S", "type": ["RAH-C"], + "chargetype": ["D03"], }, "Konstant": { "gln": "5790000704842", "company": "Konstant Net A/S - 151", "type": ["151-NT01T", "151-NRA04T"], + "chargetype": ["D03"], }, "Cerius": { "gln": "5790000705184", "company": "Cerius A/S", "type": ["30TR_C_ET"], + "chargetype": ["D03"], }, "N1": { "gln": "5790001089030", "company": "N1 A/S - 131", "type": ["CD", "CD R"], + "chargetype": ["D03"], }, "Dinel": { "gln": "5790000610099", "company": "Dinel A/S", "type": ["TCL>100_02", "TCL<100_52"], + "chargetype": ["D03"], }, "TREFOR El-net": { "gln": "5790000392261", "company": "TREFOR El-net A/S", "type": ["C"], + "chargetype": ["D03"], }, "TREFOR El-net Øst": { "gln": "5790000706686", "company": "TREFOR El-net Øst A/S", "type": ["46"], + "chargetype": ["D03"], }, "Elektrus": { "gln": "5790000836239", "company": "Elektrus A/S", "type": ["6000091"], + "chargetype": ["D03"], }, "Elnet Midt": { "gln": "5790001100520", "company": "Elnet Midt A/S", "type": ["T3002"], + "chargetype": ["D03"], }, "Hurup Elværk Net": { "gln": "5790000610839", "company": "Hurup Elværk Net A/S", "type": ["HEV-NT-01"], + "chargetype": ["D03"], }, "Veksel": { "gln": "5790001088217", "company": "Veksel A/S", "type": ["NT-10"], + "chargetype": ["D03"], }, "Vores Elnet": { "gln": "5790000610976", "company": "Vores Elnet A/S", "type": ["TNT1009"], + "chargetype": ["D03"], }, "Netselskabet Elværk": { "gln": "5790000681075", "company": "Netselskabet Elværk A/S - 042", "type": ["0NCFF"], + "chargetype": ["D03"], }, "Nord Energi Net": { "gln": "5790000610877", "company": "Nord Energi Net A/S", "type": ["TAC"], + "chargetype": ["D03"], }, "Nordvestjysk Elforsyning (NOE Net)": { "gln": "5790000395620", "company": "NOE Net A/S", "type": ["Net C"], + "chargetype": ["D03"], }, "Ikast El Net": { "gln": "5790000682102", "company": "Ikast El Net A/S", "type": ["IEV-NT-11"], + "chargetype": ["D03"], }, "FLOW Elnet": { "gln": "5790000392551", "company": "FLOW Elnet A/S", "type": ["FE2 NT-01"], + "chargetype": ["D03"], }, "Elinord": { "gln": "5790001095277", "company": "Elinord A/S", "type": ["43300"], + "chargetype": ["D03"], }, "Hammel Elforsyning Net": { "gln": "5790001090166", "company": "Hammel Elforsyning Net A/S", "type": ["50001"], + "chargetype": ["D03"], }, "El-net Kongerslev": { "gln": "5790002502699", "company": "El-net Kongerslev A/S", "type": ["C-Tarif"], + "chargetype": ["D03"], }, "Ravdex": { "gln": "5790000836727", "company": "Ravdex A/S", "type": ["NT-C"], + "chargetype": ["D03"], }, "Tarm Elværk Net": { "gln": "5790000706419", "company": "Tarm Elværk Net A/S", "type": ["TEV-NT-01", "TEV-NT-01R"], + "chargetype": ["D03"], }, "Zeanet": { "gln": "5790001089375", "company": "Zeanet A/S", "type": ["43110"], + "chargetype": ["D03"], }, "NKE-Elnet": { "gln": "5790001088231", "company": "NKE-Elnet A/S", "type": ["94TR_C_ET"], + "chargetype": ["D03"], }, "L-Net": { "gln": "5790001090111", "company": "L-Net A/S", "type": ["4010"], + "chargetype": ["D03"], }, "Midtfyns Elforsyning": { "gln": "5790001089023", "company": "Midtfyns Elforsyning A.m.b.A", "type": ["TNT15000"], + "chargetype": ["D03"], }, "Sunds Net": { "gln": "5790001095444", "company": "Sunds Net A.m.b.A", "type": ["SEF-NT-05", "SEF-NT-05R"], + "chargetype": ["D03"], }, "Aal El-Net": { "gln": "5790001095451", "company": "Aal El-Net A.m.b.A", "type": ["AAL-NT-05", "AAL-NTR05"], + "chargetype": ["D03"], }, }