-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add Modbus service for dynamic parameter reading #25908
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
base: master
Are you sure you want to change the base?
Conversation
|
Das ist grausig viel Logik. Warum muss der modbus Service etwas vin templates wissen? Die sollten ihm egal sein! Spannend ist allerdings die Modbus Config. Dafür hatte ich keine gute Idee :/ |
Die gehören in den Serviceaufruf. HA zeigt wie's geht: Die /cc @naltatis |
|
Ich bin einen Entwurf weiter, klappt soweit auch mit URL Parametern, ist übersichtlicher. Ein Update heute Abend! Problematisch ist die Parallelität der Browseranfragen und Wiederverwendung des Modbus-Plugins, theoretisch läuft es. Praktisch blockierte da gerade etwas, was einen weiteren echten Gerätetest braucht. Der aktuelle Ansatz ist unnötig aufwändig, läuft aber. |
|
Checks gerne ein, ich kann auch testen. |
jetzt aber... |
due to failed integration
|
@andig I'd like to push the commits for the service dependencies as suggested above, going for: @naltatis not going to disrupt changes from your side, ok? |
|
I've prepared some UI tests as well, but skipped here initially |
I'd prefer not mixing explicit param definition with placeholder substitution like we see with service:
endpoint: modbus/read
params:
- uri: "{host}:{port}"
address: 1069
type: holding
encoding: float32s
dependencies:
- [host, port, id]
- [device, baudrate, comset, id]I like the idea of having fixed If we really need the flexibility ( Then the first server string where all placeholders can be filled would be used. Drawback with this solution is that we'd have to repeat static values. |
|
I think the flexibility is required because of URI might getting build by different fields. Specially having the extension for http-templates in mind we have to deal with host plus port, additional protocol, URL parts or host:port in one field. This approach does support any UI field combination which is relevant looking at modbus and http templates. I really like this approach but see more UI complexity as well. |
I like the idea. Maybe at a later stage we'll need to add optional parameters ( |
We have to things at play here: a) being able to remap or concat params from user input ( In the as well as interpolation But coming back to the actual topic here let's look at b). Do we really have the use-case for these alternative combinations outside of modbus? Modbus configuration is a special candidate in many places of evcc (docs, config ui, templates ,..). Maybe it would also be fine to introduce a dedicated Idea: Where We could write the above example also in |
Like it! Advantage: much less copy/paste since we'll need this pattern quite a lot!
Yagni? Can still do that later on. |
Agreed on this. Also identified modbus and http as candidates for this use case. Only modbus has this serial or tcp selection. |
did not expect it to reduce complexity that much, great suggestion! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added e2e tests, found a couple of bugs around how we handled modbus default values. This should all work fine now.

This PR enables auto-filling of device parameters in the configuration UI by reading actual values from the device.
Adds HTTP service endpoint /api/modbus/params for reading device parameters based on template definitions without creating a full device instance.
Features (fixes #25857):
Usage examples:
recently updated to reduce to:
TODO: