Skip to content

Leave a failed login disconnected and return bool on/off values - #8

Merged
wojciech-aniol merged 4 commits into
mainfrom
pr7-followups
Oct 25, 2026
Merged

wojciech-aniol merged 4 commits into
mainfrom
pr7-followups

Conversation

@wojciech-aniol

@wojciech-aniol wojciech-aniol commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

After a refused login Ariston is "not connected" (api is None). A cloud error during a login keeps the earlier one, and a login to another account drops the old device list.
GALEVO on/off values (flame, heat pump, zone heat request, holiday, automatic thermoregulation, quiet) now give True / False / None instead of the cloud's 0.0 / 1.0; BSB flame is None when missing.
Follow-up to #7 (the three points its review left out). Stacked on #7; GitHub moves it to main when #7 merges. Patch release, no label.

Changes

  • Ariston.async_connect: sets api only after the login works; a refused login sets it to None; a ConnectionException (timeout, 429 block, 5xx) leaves the earlier login as it was. The device list is dropped only when (api_url, username) changes, so a re-login of the same account sends no extra requests.
  • async_discover / async_hello keep the api they started with. A list that comes back after another login is returned but not stored, so a login during a running hello cannot give a device with api=None or keep the old account's list.
  • GALEVO: new _get_bool_item_by_id, used by is_flame_on_value, is_heating_pump_on_value, get_zone_heat_request_value, holiday_mode_value, automatic_thermoregulation, is_quiet_value (all bool | None). The owner's Nimbus data has these as floats (0.0 / 1.0); the setters already write 1.0 / 0.0. get_measured_temp_value is typed float | None (annotation only, same as BSB).
  • BSB: is_flame_on_value is None when flame is missing (was False); get_zone_heat_request_value takes zone_number like GALEVO (new in Read BSB heat pump state and skip a missing room sensor #7, not released).

Integration impact

  • The integration builds a new Ariston per setup or flow and checks the login result, so the connect change does not change its behaviour.
  • GALEVO climate attribute heat_request shows true / false instead of 1.0 / 0.0. Binary sensor and switch states and hvac_action stay the same (truthiness of the same values).
  • BSB "is flame on" is created only when flame is not None. Real BSB data has every key (fustom#173), so the sensor stays; a first refresh with no data at all would skip it, as GALEVO already does.

Review (/code-review)

Fixed: login race with a running hello/discover, a cloud error dropping a working login, re-listing devices for the same account, other GALEVO on/off getters, BSB parameter name.
Not changed:

  • BSB flame None when missing: this is the change asked for; see "Integration impact".
  • bool() truthiness in _get_bool_item_by_id (a string "0" would be True): the cloud sends numbers, and the integration already applied bool() / truthiness to the raw value, so nothing changes.
  • BSB on/off getters do not convert: the BSB cloud sends JSON booleans (fustom#173).
  • Reusing _async_connect: it raises for both a refused login and a cloud error, and async_connect must tell them apart.

Tests

  • tests/test_package.py: refused login → not connected, no cloud call; cloud error keeps the login; same account keeps the list, another account lists again; a refused login during a running hello.
  • tests/test_galevo_device.py (new): six on/off values from 1.0 / 0.0 / bool and missing; zone heat request per zone.
  • tests/test_bsb_device.py: flame and heat pump on / off / missing; heat request by keyword zone_number.
  • Each source change has a test that fails without it; 113 pass; ruff clean.
  • Integration branch v1/15-entity-names-sensors passes 597 tests and 355 snapshots with this branch on PYTHONPATH.

🤖 Generated with Claude Code

wojciech-aniol and others added 2 commits October 25, 2026 12:09
async_connect set self.api before the login, so after a refused login
async_discover and async_hello still called the cloud with no token.
self.api is now set only on success. A new login also drops the device
list, as it may belong to another account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GALEVO and BSB share is_flame_on_value, is_heating_pump_on_value and
get_zone_heat_request_value, but gave different types: GALEVO passed on
the cloud's 0.0 / 1.0, BSB flame was False when missing. Both now give
True, False or None (no value), which the integration's "is not None"
checks expect. GALEVO get_measured_temp_value is typed float | None.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wojciech-aniol wojciech-aniol self-assigned this Oct 25, 2026
wojciech-aniol and others added 2 commits October 25, 2026 12:16
Review of the first version: it cleared api and the device list before
the login, so a cloud error dropped a working login, each re-login
listed the devices again, and a login during a running hello or
discover could give a device with api None or keep the old account's
list. Now a cloud error keeps the earlier login, the list is dropped
only for another account, and hello and discover keep the api they
started with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
holiday_mode_value, automatic_thermoregulation and is_quiet_value also
passed on the cloud's 0.0 / 1.0. BSB get_zone_heat_request_value now
takes zone_number, like GALEVO, so keyword calls work on both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from bsb-heat-pump-state to main October 25, 2026 14:57
@wojciech-aniol
wojciech-aniol marked this pull request as ready for review October 25, 2026 14:57
@wojciech-aniol
wojciech-aniol merged commit 42223c3 into main Oct 25, 2026
3 checks passed
@wojciech-aniol
wojciech-aniol deleted the pr7-followups branch October 25, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant