Repository navigation
consumer ems-esp: automatisch zwischen heatpump/boiler ermitteln - #4290
Merged
LKuemmel merged 2 commits intoNov 10, 2026
Merged
Conversation
Reviewer's GuideImplementationInspect endpoint detection and caching together with the imports, device-name candidates, and read/write paths that use the selected endpoint.
TestsReview tests covering endpoint selection, fallback, caching, writes through the detected endpoint, missing entities, and propagation of non-404 HTTP errors.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/modules/consumers/ems_esp/ems_esp/consumer.py" line_range="37" />
<code_context>
+ url = f"http://{config.configuration.ip_address}/api/{device_name}"
+ try:
+ values = session.get(url, headers=headers).json()
+ except requests.exceptions.HTTPError:
+ continue
+ if "hpcurrpower" in values:
</code_context>
<issue_to_address>
**HTTP failures are misreported**
When an endpoint probe returns a non-404 HTTP error, `_detect_base_url` catches the error and probes the next endpoint, so it can raise a misleading `ValueError` or select and cache `boiler` when `heatpump` failed; later readings and control writes then use the wrong endpoint instead of surfacing the HTTP failure.
Continue probing only for the expected unknown-device 404 and re-raise other HTTP errors.
</issue_to_address>Linked issues
#4282 [BUG] ems-esp heatpump vs. boiler · 2 of 2 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Die Leistung der Wärmepumpe unter /api/boiler erfassen, wenn hpcurrpower dort vorhanden ist. |
✅ Met | Beim ersten Zugriff wird /api/heatpump und danach /api/boiler auf hpcurrpower geprüft; der gefundene Endpunkt wird für die Messung verwendet. |
| 2 | SG-Ready-Schalten ebenfalls über den passenden Gerätenamen unterstützen. | ✅ Met | Alle Schreibvorgänge, einschließlich switch_on, switch_off und set_power_limit, verwenden den ermittelten Endpunkt. |
LKuemmel
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4282. Der EMS-ESP-Gerätename war hart auf "heatpump" kodiert.
Bei manchen Wärmepumpen (hier: Bosch Compress 6800i) liegen die hp*-Entities (inkl. hpcurrpower) stattdessen unter "boiler" - "heatpump" liefert dort ein 404 mit
{"message":"unknown device heatpump"}.Betraf nicht nur die Leistungsmessung, sondern auch SG-Ready-Schalten (switch_on/switch_off/set_power_limit nutzen denselben base_url).
Ermittelt beim ersten Zugriff automatisch, unter welchem der beiden
Gerätenamen hpcurrpower tatsächlich existiert, und verwendet das Ergebnis
danach für Lesen und Schreiben. Kein neues Konfigurationsfeld nötig.
Summary by Sourcery
Automatically detect and reuse the EMS-ESP device endpoint that exposes the heat-pump entities.
Bug Fixes:
heatpumporboilerdevice name, fixing power readings and SG-Ready controls for devices such as Bosch Compress 6800i.Enhancements:
Tests: