Skip to content

Commit 3509b72

Browse files
author
zulufoxtrot
committed
v2.7.0
1 parent 49c46a7 commit 3509b72

5 files changed

Lines changed: 25 additions & 24 deletions

File tree

custom_components/ha_zyxel/__init__.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,7 @@ async def async_update_data():
4949
try:
5050
async with async_timeout.timeout(15):
5151
def get_all_data():
52-
# Login only if we don't have a valid session
53-
if not hasattr(router, '_session_valid') or not router._session_valid:
54-
login_success = router.login()
55-
if not login_success:
56-
raise UpdateFailed("Login failed during data update")
57-
router._session_valid = True
58-
5952
data = router.get_status()
60-
if not data:
61-
# Session may have expired, try login once more
62-
router._session_valid = False
63-
login_success = router.login()
64-
if not login_success:
65-
raise UpdateFailed("Login failed after session timeout")
66-
router._session_valid = True
67-
data = router.get_status()
6853

6954
if not data:
7055
raise UpdateFailed("No data received from router")

custom_components/ha_zyxel/config_flow.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,11 @@ async def validate_input(hass: core.HomeAssistant, data):
3737
data[CONF_PASSWORD]
3838
)
3939

40-
# Test login
41-
login_success = await hass.async_add_executor_job(router.login)
40+
login_success = await hass.async_add_executor_job(router.get_status)
4241
if not login_success:
4342
raise Exception("Login failed - check credentials")
4443

45-
# Quick data test
46-
test_data = await hass.async_add_executor_job(router.get_status)
47-
if not test_data:
48-
# Login worked but no data - still valid
49-
test_data = {"connection": "success"}
44+
5045

5146
except Exception as ex:
5247
_LOGGER.error("Unable to connect to Zyxel device: %s", ex)
@@ -79,7 +74,7 @@ async def async_step_user(self, user_input=None):
7974
success = True
8075
except Exception as e: # pylint: disable=broad-except
8176
_LOGGER.exception("First attempt failed", e)
82-
errors["base"] = "unknown"
77+
errors["base"] = "cannot_connect"
8378

8479
if not success and "https" not in user_input["host"]:
8580
_LOGGER.info("User specified http but it failed, trying https...")

custom_components/ha_zyxel/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"iot_class": "local_polling",
99
"issue_tracker": "https://github.com/zulufoxtrot/ha-zyxel/issues",
1010
"requirements": [
11-
"nr7101@git+https://github.com/zulufoxtrot/nr7101.git@v2.0.0"
11+
"nr7101@git+https://github.com/zulufoxtrot/nr7101.git@v2.0.2"
1212
],
1313
"version": "0.2.7"
1414
}

translations/en.json renamed to custom_components/ha_zyxel/translations/en.json

File renamed without changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"config": {
3+
"step": {
4+
"user": {
5+
"data": {
6+
"host": "Hôte",
7+
"username": "Nom d'utilisateur (habituellement 'admin')",
8+
"password": "Mot de passe"
9+
}
10+
}
11+
},
12+
"error": {
13+
"cannot_connect": "La connexion a échoué",
14+
"invalid_auth": "L'authentification a échoué",
15+
"unknown": "Une erreur inattendue s'est produite"
16+
},
17+
"abort": {
18+
"already_configured": "L'appareil est déjà configuré"
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)