Skip to content

Modbus TCP: make port configurable #22196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

anbie
Copy link
Contributor

@anbie anbie commented Jul 4, 2025

This pull request makes the Modbus TCP port configurable in the lambda-zewotherm charger template.

Motivation:

  • Until now, the lambda-zewotherm template hardcoded port 502 for Modbus TCP.
  • Many Modbus devices accept only a single client connection. To enable multiple clients, modbus-proxies can be used (e.g., In my environment I'm using tiagocoutinho/modbus-proxy). This proxy serializes requests by acting as a bridge. For targeting this proxy is listening on a non-standard, configurable port.

Change:

  • Replaced the hardcoded 502 with a configurable port option in: templates/definition/charger/lambda-zewotherm.yaml
  • Default port remains 502, ensuring full backward compatibility.

The change has been unit-tested in my home environment, including with a Lambda heat pump.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @anbie - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@anbie anbie changed the title Feature/config ports4modbustcp - allow configuring Modbus TCP port (default 502) Feature/config ports4modbustcp - allow configuring Modbus TCP port (default 502) for lambda-zewotherm Jul 4, 2025
@andig
Copy link
Member

andig commented Jul 4, 2025

@anbie in Deinem PR gehts etwas durcheinander ;)

@andig andig marked this pull request as draft July 4, 2025 18:55
@anbie
Copy link
Contributor Author

anbie commented Jul 4, 2025

@andig, ich hatte diese PR auf Basis von #21972 erstellt.
Da in beiden PRs zwar dieselbe Datei geändert wird, aber in unterschiedlichen Zeilen, war das eher unnötig und sorgt sicher für das Durcheinander.
Was schlägst du vor? PR schließen und Neuen öffnen?

@andig
Copy link
Member

andig commented Jul 4, 2025

2 branches, 2 prs. PRs NIEMALS von master machen.

@anbie
Copy link
Contributor Author

anbie commented Jul 4, 2025

2 branches:

#21972: feat/lambda_neg_excess_energy (https://github.com/anbie/evcc/tree/feat/lambda_neg_excess_energy)
#22196: feature/config_ports4modbustcp (https://github.com/anbie/evcc/tree/feature/config_ports4modbustcp)

@andig
Copy link
Member

andig commented Jul 4, 2025

…dennoch sind hier dinge drin die nicht rein gehören. Git revert der falschen commits?

anbie added 3 commits July 5, 2025 08:28
Sorted out branch problems ("durcheinander"). Rebased this branch onto master.
modified:   templates/definition/charger/lambda-zewotherm.yaml
@anbie anbie marked this pull request as ready for review July 5, 2025 07:02
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @anbie - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@andig
Copy link
Member

andig commented Jul 5, 2025

@premultiply das betrifft ALLE Geräte die Modbus unterstützen, aber direkt über host/port konfiguriert sind. Wollen wir das konsequent überall ändern? Falls ja: port konfigurierbar machen oder die Modbus Mimik einsetzen?

@andig andig marked this pull request as draft July 5, 2025 17:41
@andig andig changed the title Feature/config ports4modbustcp - allow configuring Modbus TCP port (default 502) for lambda-zewotherm Modbus TCP: make port configurable Jul 5, 2025
@andig andig added the devices Specific device support label Jul 5, 2025
@LotharWoman
Copy link

@premultiply das betrifft ALLE Geräte die Modbus unterstützen, aber direkt über host/port konfiguriert sind. Wollen wir das konsequent überall ändern? Falls ja: port konfigurierbar machen oder die Modbus Mimik einsetzen?

Und nicht mal nur Modbus, sondern auch Geräte die nur den host erfordern. Ich musste in den letzten Wochen auch negative Erfahrungen mit der GUI machen. Ändern sich IP oder Port werden die Geräte nicht mehr geladen, auch in der ConfigGui nicht mehr angezeigt. Ohne Zugriff auf die db ist dadurch keine Anpassung von host/port möglich.

@premultiply
Copy link
Member

premultiply commented Jul 6, 2025

Die "Modbus-Mimik" (das Template) funktioniert immer dort und sollte auch wo immer möglich zum Einsatz kommen wo ein Endgerät (nur) eine ID hat. Ob diese am Gerät tatsächlich veränderbar ist ist egal. Im Template wird der feste Wert als Default eingetragen.

@anbie
Copy link
Contributor Author

anbie commented Jul 8, 2025

Ist der PR soweit wieder auf "ready for review" zu gehen ?

@andig
Copy link
Member

andig commented Jul 8, 2025

Nein. Wenn wir das machen dann bitte konsequent bei allen Geräten und nicht nur bei einem. Und es muss geprüft werden, ob das ein breaking change ist.

@github-actions github-actions bot added the stale Outdated and ready to close label Jul 15, 2025
@andig andig closed this Jul 16, 2025
@anbie
Copy link
Contributor Author

anbie commented Jul 16, 2025

@andig
Wie machen wir hier weiter? Ohne Port-Einstellungen kann ich die Lambda nicht nutzen. Ich versteh ja "konsequent bei allen Geräten". Das muss dann wohl in allen templates geändert werden. Aber muss es denn in einem Rutsch erfolgen? Oder gibt es eine zentrale Stelle?

(Ich bin grad in dem Bergen mit wenig Netzwerk-Verbindung. Ich helfe gerne weiter mit wenn ich zurück bin.)

@andig
Copy link
Member

andig commented Jul 16, 2025

Gerne ein PR für alle, mindestens alle Modbusgeräte. Es hilft uns leider nicht, EInzellösungen zu bauen :(

@anbie
Copy link
Contributor Author

anbie commented Jul 20, 2025

Ich selbst habe keine Möglichkeit, Modbus-Geräte in größerem Umfang zu testen. Wenn ich es richtig gesehen habe, lässt sich der Port aber bei den meisten Charger ohnehin schon konfigurieren – nur bei wenigen ist er noch hart auf 502 gesetzt. Aber ich lass hier mal gut sein und konfiguriere meinen modbus proxy anders.

@andig andig reopened this Jul 20, 2025
@github-actions github-actions bot removed the stale Outdated and ready to close label Jul 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devices Specific device support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy