Skip to content

Fix plantmode write no-op on Elco Aerotop device classified as GALEVO instead of bsb - #184

Closed
albertorosso wants to merge 3 commits into
fustom:mainfrom
albertorosso:main
Closed

albertorosso wants to merge 3 commits into
fustom:mainfrom
albertorosso:main

Conversation

@albertorosso

@albertorosso albertorosso commented Jul 12, 2026 •

Copy link
Copy Markdown

(partially generated with claude AI)

Some devices classified by the cloud as SystemType.GALEVO (observed on an Elco Aerotop heat pump with a BSB controller) accept plant mode writes via the REST v2 endpoint (POST /api/v2/remote/dataItems/{gw}/set) and receive {"success": true}, but the command has no real effect on the physical device.

The official web client (remocon-net.remotethermo.com), for this same gateway, never uses the REST v2 write path at all — it uses a legacy ASP.NET MVC-style endpoint:

POST /R2/PlantHome/GetData/{gatewayId}?umsys={umsys}   (read)
POST /R2/PlantHome/SetData/{gatewayId}?umsys={umsys}   (write)

```confirmed via HAR capture of a successful "set to OFF" action (response changedItems shows PlantMode → 5.0).
This may be related to #299 and #424 (on the other repository) which describe similar symptoms on Elco/Ariston heat pump devices.

**Root cause**
The device's cloud-reported system_type is GALEVO, so AristonGalevoDevice (not AristonBsbDevice) is instantiated, and its async_set_plant_mode uses the modern REST v2 write path — which the cloud silently accepts but does not propagate to this device's physical unit. Reads work fine on REST v2; only writes are affected.

**Fix**

- Added legacy_r2_client.py: an isolated client for the legacy /R2/ read/write path (separate session/auth from the main AristonAPI, since auth mechanisms differ - session cookies vs bearer token).

- AristonGalevoDevice.async_set_plant_mode now verifies the write by re-reading state (async_update_state) shortly after the REST v2 write; if the value didn't actually change, it falls back automatically to the legacy client.

- Added ariston_api.py public username/password properties so the legacy client can reuse the already-configured credentials without extra user configuration.

- Bundled default_viewmodel_template.json: the site does not expose a clean read endpoint for the full viewModel object required by the legacy write (it's built client-side in JS from the initial page render). This is a pragmatic starting point captured from a real working request, with device-specific fields (gatewayId) overwritten dynamically at call time. 

- Known limitation: this template may not generalize cleanly to all GALEVO/BSB device variants - a more general future fix could parse the live viewModel from the initial /R2/Plant/Index page HTML instead of relying on a static bundled capture.

@astrinh0

Copy link
Copy Markdown
Collaborator

@albertorosso I will review this. I'm making test suite for this repo before that. :)

@astrinh0

Copy link
Copy Markdown
Collaborator

can you add tests to it?

items = data["items"]
features = data["features"]

value = PLANT_MODE_VALUES.get(plant_mode_text)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical — The fallback rejects labels returned by the default API locale. async_set_plant_mode passes the selected text from PLANT_MODE.optTexts; those labels follow the configured language_tag, which defaults to en-US. This lookup accepts only Italian labels and uppercase OFF (while the bundled template itself uses Off), so the fallback raises ValueError for ordinary English labels such as Off or Winter when the REST write has no effect. Map the mode by its numeric value to the label expected by the R2 endpoint, or translate the configured label before this lookup.

@astrinh0 astrinh0 closed this Nov 22, 2026
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.

2 participants