Skip to content

Commit 5f22b72

Browse files
committed
clarified message when no NEW SENEC.System could be found
1 parent c15b259 commit 5f22b72

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

custom_components/senec/config_flow.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,15 @@ async def _test_connection_senec_online(self, user: str, pwd: str, totp_secret:
252252
storage_path=Path(self.hass.config.config_dir).joinpath(STORAGE_DIR))
253253

254254
if serial_number is None or str(serial_number).lower() == "none":
255-
systems = await senec_online.get_all_systems(already_configured_lc_serials)
255+
systems, already_in_use_systems = await senec_online.get_all_systems(already_configured_lc_serials)
256256
if len(systems) == 0:
257257
if senec_online._app_is_authenticated:
258-
self._errors[CONF_SYSTYPE_WEB] = "no_systems_found"
259-
_LOGGER.warning(f"We could not find ANY SENEC.System (is there one available in the SENC.App?")
258+
if len(already_in_use_systems) > 0:
259+
self._errors[CONF_SYSTYPE_WEB] = "no_new_systems_found"
260+
_LOGGER.warning(f"We could not find ANY NEW SENEC.System - already configured: {already_in_use_systems}")
261+
else:
262+
self._errors[CONF_SYSTYPE_WEB] = "no_systems_found"
263+
_LOGGER.warning(f"We could not find ANY SENEC.System (is there one available in the SENC.App?")
260264
else:
261265
self._errors[CONF_USERNAME] = "login_failed"
262266
_LOGGER.warning(f"Could not connect to mein-senec.de with '{user}', check credentials")

custom_components/senec/pysenec_ha/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3465,6 +3465,7 @@ async def get_all_systems(self, already_configured_lc_serials: list = None):
34653465
await self.app_authenticate(check_for_existing_tokens = True, is_integration_setup_phase = True)
34663466

34673467
systems = {}
3468+
already_in_use_systems = {}
34683469
if self._app_is_authenticated:
34693470
app_data = await self._app_do_get_request(self.APP_SYSTEM_LIST)
34703471
if app_data is not None and isinstance(app_data, Iterable):
@@ -3478,10 +3479,17 @@ async def get_all_systems(self, already_configured_lc_serials: list = None):
34783479
"addr": f'{a_entry.get("street", "STREET")} {a_entry.get("houseNumber", "HOUSENUMBER")}, {a_entry.get("postalCode", "POSTALCODE")} {a_entry.get("city", "CITY")}',
34793480
"serial": serial
34803481
}
3482+
else:
3483+
already_in_use_systems[serial] = {
3484+
"name": a_entry.get("product", {}).get("name", "UNKNOWN-NAME"),
3485+
"case": a_entry.get("caseNumber", "CASENUMBER"),
3486+
"serial": serial
3487+
}
3488+
_LOGGER.info(f"get_all_systems(): Skipping already configured system with serial {serial} - since it is already in the 'already_configured_lc_serials' list {already_configured_lc_serials}")
34813489
else:
34823490
_LOGGER.debug(f"get_all_systems(): self._app_is_authenticated is {self._app_is_authenticated}")
34833491

3484-
return systems
3492+
return systems, already_in_use_systems
34853493

34863494
# by default, we update as fast as possible
34873495
_UPDATE_INTERVAL = NO_LIMIT

custom_components/senec/translations/de.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@
4343
"reauth_successful": "Re-Autorisierung abgeschlossen",
4444
"no_filesystem_access": "Diese Integration benötigt Zugriff auf das lokale Dateisystem Deiner HomeAssistant Installation, um einen Schlüssel für Deinen SENEC Account speichern zu können.\n\nHierzu wird im in dem Ordner '.storage/' einen Unterordner anlegen. Dies ist jedoch derzeit nicht möglich. Ein interner Test ist fehlgeschlagen. Details hierzu findest Du im LOG Deiner Home Assistant Instanz.\n\nBitte stelle sicher, dass Du die Home Assistant Installation mit dem richtigen Benutzer ausführst, der Schreibzugriff auf das lokale Dateisystem hat.\n\nWenn Du Home Assistant in einem Docker-Container ausführst, stelle sicher, dass Du den Container mit dem richtigen Benutzer ausführst und dass der Container Zugriff auf das lokale Dateisystem hat.\n\nBitte prüfe Deine installation und starte die Einrichtung dieser Integration neu, sobald der Zugriff auf das lokale Dateisystem möglich ist.",
4545
"invalid_totp_secret": "Das OTP-auth-Secret konnte nicht interpretiert werden",
46-
"no_systems_found": "Es konnten keine SENEC.Systeme ermittelt werden - hast Du in der Senec.App ein Speicher System?"
46+
"no_systems_found": "Es konnten keine SENEC.Systeme ermittelt werden - hast Du in der Senec.App ein Speicher System?",
47+
"no_new_systems_found": "Es konnten keine weiteres SENEC.Systeme ermittelt werden - es sind bereits all Deine SENEC.Systeme eingerichtet"
4748
},
4849
"error": {
4950
"login_failed": "Login fehlgeschlagen - bitte Benutzername und/oder Passwort prüfen",
5051
"cannot_connect": "Keine Verbindung möglich",
5152
"unknown": "Unbekannter Fehler",
5253
"invalid_totp_secret": "OTP-auth-Secret ist ungültig",
53-
"no_systems_found": "Es konnten keine SENEC.Systeme ermittelt werden - hast Du in der Senec.App ein Speicher System?"
54+
"no_systems_found": "Es konnten keine SENEC.Systeme ermittelt werden - hast Du in der Senec.App ein Speicher System?",
55+
"no_new_systems_found": "Es konnten keine weiteres SENEC.Systeme ermittelt werden - es sind bereits all Deine SENEC.Systeme eingerichtet"
5456
},
5557
"step": {
5658
"user": {

custom_components/senec/translations/en.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
"reauth_successful": "Re-Authorization was completed",
3131
"no_filesystem_access": "This integration requires access to the local file system of your HomeAssistant installation to store a key for your Senec account.\n\nTo do this, a subfolder will be created in the '.storage/' folder. However, this is currently not possible. An internal test failed. You can find details in the log of your Home Assistant instance.\n\nPlease ensure that you are running the Home Assistant installation with the correct user who has write access to the local file system.\n\nIf you are running Home Assistant in a Docker container, ensure that you are running the container with the correct user and that the container has access to the local file system.\n\nPlease check your installation and restart the setup of this integration once access to the local file system is possible.",
3232
"invalid_totp_secret": "The provided OTP-auth-Secret could not be interpreted",
33-
"no_systems_found": "No SENEC.System could be detected - Do you have a system in the Senec.App?"
33+
"no_systems_found": "No SENEC.System could be detected - Do you have a system in the Senec.App?",
34+
"no_new_systems_found": "No new SENEC.System could be detected - all your SENEC.Systems are already configured!"
3435
},
3536
"error": {
3637
"login_failed": "Login failed - please check username and/or password",
3738
"cannot_connect": "Failed to connect",
3839
"unknown": "Unknown error",
3940
"invalid_totp_secret": "OTP-auth-Secret invalid",
40-
"no_systems_found": "No SENEC.System could be detected - Do you have a system in the Senec.App?"
41+
"no_systems_found": "No SENEC.System could be detected - Do you have a system in the Senec.App?",
42+
"no_new_systems_found": "No new SENEC.System could be detected - all your SENEC.Systems are already configured!"
4143
},
4244
"step": {
4345
"user": {

0 commit comments

Comments
 (0)