From 067ece97b81922d0dfe49446f3bf548d789942a7 Mon Sep 17 00:00:00 2001 From: Manuel Richarz Date: Mon, 13 Nov 2023 17:41:22 +0100 Subject: [PATCH] Add support to fints for configuring unsupported account_types (#83537) * Possibility to configure unsupported account_types Changed conditions to be able to configure unsupported account_types like: Loan, Creditcards, Call money, etcpp. Those accounts won't be added automatically. But with this fix you can add them manually via configuration if needed. * chore: add integration_type for fints fix: lint error chore: add more info to warning for debugging purpose * Possibility to configure unsupported account_types Changed conditions to be able to configure unsupported account_types like: Loan, Creditcards, Call money, etcpp. Those accounts won't be added automatically. But with this fix you can add them manually via configuration if needed. * chore: broken merge * fix: remove version from manifest.json --------- Co-authored-by: Erik Montnemery --- homeassistant/components/fints/manifest.json | 1 + homeassistant/components/fints/sensor.py | 36 +++++++++++--------- homeassistant/generated/integrations.json | 2 +- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/homeassistant/components/fints/manifest.json b/homeassistant/components/fints/manifest.json index 821298434d9..063e612d35d 100644 --- a/homeassistant/components/fints/manifest.json +++ b/homeassistant/components/fints/manifest.json @@ -3,6 +3,7 @@ "name": "FinTS", "codeowners": [], "documentation": "https://www.home-assistant.io/integrations/fints", + "integration_type": "service", "iot_class": "cloud_polling", "loggers": ["fints", "mt_940", "sepaxml"], "requirements": ["fints==3.1.0"] diff --git a/homeassistant/components/fints/sensor.py b/homeassistant/components/fints/sensor.py index 3b961054544..fafe1fcf2bf 100644 --- a/homeassistant/components/fints/sensor.py +++ b/homeassistant/components/fints/sensor.py @@ -168,14 +168,13 @@ class FinTsClient: if not account_information: return False - if not account_information["type"]: - # bank does not support account types, use value from config - if ( - account_information["iban"] in self.account_config - or account_information["account_number"] in self.account_config - ): - return True - elif 1 <= account_information["type"] <= 9: + if 1 <= account_information["type"] <= 9: + return True + + if ( + account_information["iban"] in self.account_config + or account_information["account_number"] in self.account_config + ): return True return False @@ -189,14 +188,13 @@ class FinTsClient: if not account_information: return False - if not account_information["type"]: - # bank does not support account types, use value from config - if ( - account_information["iban"] in self.holdings_config - or account_information["account_number"] in self.holdings_config - ): - return True - elif 30 <= account_information["type"] <= 39: + if 30 <= account_information["type"] <= 39: + return True + + if ( + account_information["iban"] in self.holdings_config + or account_information["account_number"] in self.holdings_config + ): return True return False @@ -215,7 +213,11 @@ class FinTsClient: holdings_accounts.append(account) else: - _LOGGER.warning("Could not determine type of account %s", account.iban) + _LOGGER.warning( + "Could not determine type of account %s from %s", + account.iban, + self.client.user_id, + ) return balance_accounts, holdings_accounts diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 7680463cbd2..f59312073a6 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -1718,7 +1718,7 @@ }, "fints": { "name": "FinTS", - "integration_type": "hub", + "integration_type": "service", "config_flow": false, "iot_class": "cloud_polling" },