Skip to content
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

Config UI: add missing config sections / partial yaml inputs (BC) #13319

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

Conversation

naltatis
Copy link
Member

@naltatis naltatis commented Apr 6, 2024

Replaces #11739

Goal

  • 🐭 make smaller config chunks (tariff, messages, mqtt, ...) editable via UI instead of complete evcc.yaml.
  • 🚴‍♀️ create UI and API (endpoints, persistance and initialization) for all missing config areas in a fast and pragmatic way.

Later steps (seperate PRs)

  • 🎩 Improve UX where necessary (tariff template UI Add tariffs configuration #10042, ...)
  • 📟 Allow yaml-snippets as an alternative UI config option for vehicles, meters, chargers (e.g. to allow plugins)

BC

  • all /api/state durations are now in seconds instead of nanoseconds

Todos

Out of scope:

  • move site meters to global config, identified by type (grid, pv, battery, aux)
  • show/update meter configuration when device fails during startup
  • allow saving broken devices (RCT)

@naltatis naltatis added enhancement New feature or request ux User experience/ interface labels Apr 6, 2024
server/http.go Outdated Show resolved Hide resolved
@naltatis naltatis changed the title Config UI: partial yaml inputs Config UI: add missing config sections / partial yaml inputs Apr 7, 2024
@andig
Copy link
Member

andig commented Apr 8, 2024

@naltatis ich brauche mal eine Idee. ModbusProxy ist eine Liste. Wie wollen wir hier mit Updates umgehen:

  • per Element (über Index? über Port?) (json je Element)
  • ganze Liste am Stück (json)?
  • andere Ideen?
    Wäre super einen Ansatz zu finden, der auch mit anderen Integrationen, z.B. den Push Service funktionieren kann.

Meine Tendenz wäre per Element über numerischen Index. Passt das?

@naltatis
Copy link
Member Author

naltatis commented Apr 8, 2024

@andig Im ersten Schritt (dieser PR) würde ich dir nur einen Yaml Block geben und keine Rücksicht auf die innere Struktur nehmen. Heißt, ein Update hat immer ein komplettes Neu-initialisieren zur Folge. Nichts auf Item-Ebene. Gleiches gilt für Messaging. Da ist die Struktur ja noch komplizierter, weil Messages und Services (Liste).

Das ist natürlich nicht schön und wir müssen das früher oder später sauber als Struktur/Liste ausmodellieren. Aber ich sehe das hier erstmal als einen pragmatischen Zwischenschritt.

@andig
Copy link
Member

andig commented Apr 8, 2024

Passt, das ist hässlich aber einfach.

@andig andig mentioned this pull request Apr 12, 2024
17 tasks
@andig
Copy link
Member

andig commented Apr 12, 2024

@naltatis die existierenden Site APIs, z.B: buffersoc haben alle keine Getter. Brauchen wir trotzdem GETAPIs für die unstrukturierten Werte wie interval? Das erscheint inkonsistent.
Ebenso nutzen die existierenden "einfachen" Handler POST statt PUT. Wir sollten es konsistent machen, nach Möglichkeit mit wenigen Änderungen.

Vorschlag:

  • alles POST (solange wir nicht PUT/POST für Einzelteile differenzieren)
  • GET ersetzen wir durch die Daten in /api/state (um das Coding zu vereinfachen fände ich es im UI auch sinnvoll die dafür über die Hierarchie einzusammeln statt einzeln zum durchreichen zu deklarieren, aber das ist nur ein "Schönheitsthema").
  • bei POST wird sofort die YAML Struktur überprüft, das erspart Überraschungen beim Neustart.

Wenn das passt müssen wir noch die Settings initial migrieren und dann nur noch aus der DB lesen.

@andig andig added the prio Priority label Apr 14, 2024
@andig andig changed the title Config UI: add missing config sections / partial yaml inputs Config UI: add missing config sections / partial yaml inputs (BC) Apr 14, 2024
cmd/migrate.go Outdated
// TODO remove yaml file
settings.SetInt(keys.Interval, int64(conf.Interval))

// TODO add remaining settings @naltatis (site? loadpoints? residualpower?)
Copy link
Member Author

Choose a reason for hiding this comment

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

missing values are: siteTitle, sponsorToken, residualPower, maxGridSupplyWhileBatteryCharging,

Copy link
Member

Choose a reason for hiding this comment

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

Es lassen sich nur die globalen Settings migrieren, also das Token. Der Rest ist in der global Config aktuell nicht ausmodelliert. Das müssten wir sonst noch ändern. Ich schaue nochmal...

@naltatis
Copy link
Member Author

Formatting for temperature values.

screenshot with fake data (since we dont visualize chargers yet)

Bildschirmfoto 2024-05-31 um 21 36 09

@andig
Copy link
Member

andig commented May 31, 2024

Ähhhhh- aber wieso landen wir beim Golf jetzt bei Temp statt Soc?

@naltatis
Copy link
Member Author

Ähhhhh- aber wieso landen wir beim Golf jetzt bei Temp statt Soc?

siehe Kommentar am Screenshot 😄

@naltatis
Copy link
Member Author

Added configuration status in all boxes.

Bildschirmfoto 2024-05-31 um 22 20 57

@andig
Copy link
Member

andig commented Jun 1, 2024

@naltatis statt "configured" bei Circuits the Leistungen/Ströme?

@naltatis
Copy link
Member Author

naltatis commented Jun 2, 2024

statt "configured" bei Circuits the Leistungen/Ströme?

Gerne. Configured: true ist gerade mein Save-Default der für alle YAML Entitäten geht. Da check ich einfach, ob der GET-Endpunkt Inhalt zurückliefert. Bei MQTT/Influx werden die gepublishten Details genommen. Wenn wir für die anderen Einträge auch sinnvolle Infos haben, wäre das total gut und einfach einzubauen.

Connection-Status wäre bei Influx und MQTT auch spannend. Also ob der letzte Kommunikationsversuch erfolgreich war oder nicht. Aber jetzt sind wir im Nict To Have Bereich.

ClassGo
ClassHEMS
ClassInflux
ClassMessenger
Copy link
Member Author

Choose a reason for hiding this comment

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

No ModbusProxy?

Copy link
Member

Choose a reason for hiding this comment

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

Dazu gibts ein Todo. Kann egtl. fast keinen Fehler machen ausser Port belegt. Kannnich ergänzen.

Copy link
Member Author

Choose a reason for hiding this comment

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

In der UI reagiere ich bereits auf modbusproxy. Brauchst also nur die Implementierung dafür ergänzen und dann sollte es laufen.

Copy link
Member

Choose a reason for hiding this comment

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

Done, Sponsortoken ebenfalls hinzu gefügt!

cmd/error.go Show resolved Hide resolved
@naltatis
Copy link
Member Author

naltatis commented Jun 2, 2024

Ausführlicherer Config UI Disclaimer.

Bildschirmfoto 2024-06-02 um 12 01 31

@naltatis
Copy link
Member Author

naltatis commented Jun 2, 2024

@andig Ich hab bei evcc migrate noch Logausgaben hinzugefügt damit transparenter ist, was das Script tut und vor allem was auch nicht. Die Funktion ist im Disclaimer-Block (siehe Screenshot) erklärt. Für die Säuberungsfunktion habe ich da jetzt erstmal evcc migrate --clean angegeben. Die müsstest du noch bauen. Gerne auch umbenennen, wenn du nen besseren Namen hast.

Achja: Migrate schreibt, zumindest bei mir. Momentan noch nichts in die Datenbank.

@andig
Copy link
Member

andig commented Jun 2, 2024

All done except

missing values are: siteTitle, sponsorToken, residualPower, maxGridSupplyWhileBatteryCharging,

@andig
Copy link
Member

andig commented Jun 2, 2024

evcc migrate --clean

Ich habs jetzt reset genannt- ok?

@@ -834,6 +834,7 @@ func configureTariffs(conf globalconfig.Tariffs) (*tariff.Tariffs, error) {
}

func configureDevices(conf globalconfig.All) error {
// TODO: add name/identifier to error for better highlighting in UI
Copy link
Member

Choose a reason for hiding this comment

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

@naltatis wird doch mal einen Blick in configureMeters. Das TODO kann weg...

Copy link
Member

Choose a reason for hiding this comment

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

Das war übrigens die Diskussion zum RCT vom Freitag wo wir genau das ausprobiert hatten ;)

@andig andig mentioned this pull request Jun 2, 2024
3 tasks
@naltatis
Copy link
Member Author

naltatis commented Jun 3, 2024

Ich hab ein paar Anpassungen an der Migration gemacht. Nun startet es auch und kopiert die richtigen Daten.

Allerdings funktioniert --reset nicht. Meine Vermutung ist, dass db.Instance.Save nicht löscht, nur hinzufügt oder aktualisiert. Magst du noch mal schauen?

@andig
Copy link
Member

andig commented Jun 3, 2024

Wohl so ein ORM-Ding. Ich schaus an. An der Stelle müssen wir ja leider echt löschen- leer setzen reicht nicht.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prio Priority ux User experience/ interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants