Skip to content

Add AsyncAPI support #746

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 37 commits into
base: main
Choose a base branch
from
Draft

Conversation

Maschga
Copy link
Contributor

@Maschga Maschga commented Feb 21, 2025

Fix #714
Fix #666

TODO:

  • write AsyncAPI specification
  • recheck types
  • add examples
  • complete enums
  • replace TODOs
  • Theming @naltatis
  • document:
    • Benachrichtigungen
    • InfluxDB
    • EEBus
    • Lastmanagement
    • Modbus-Proxy
    • HEMS
    • auxPower, auxMeter
    • ext

Preview:
preview

@naltatis naltatis self-assigned this Feb 21, 2025
@naltatis naltatis added the enhancement New feature or request label Feb 21, 2025
@Maschga
Copy link
Contributor Author

Maschga commented Mar 10, 2025

@naltatis Ich bin soweit durch. Du kannst gerne starten. Wenn du Fragen hast, immer her damit.

Es sind 304 TODOs übrig, sorry für den kleinen Schock.
Teilweise lässt sich aber die Beschreibung von der RestAPi verwenden und bestimmt lassen sich manche TODOs auch einfach löschen.

@@ -0,0 +1,327 @@
package server
Copy link
Member

Choose a reason for hiding this comment

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

Was macht diese Datei denn hier? Vmtl. zu Entwicklungszwecken rüberkopiert, oder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ja, das ist für Entwicklungszwecke, bin daran die Setter abgegangen. Die Datei sollte hier nicht sein.

@naltatis
Copy link
Member

Ich überlege immer noch ob wir die Daten nicht direkt aus der State Typescript Struktur + optionale JsDoc Annotation im Core Projekt erzeugen sollten. Vielleicht auch erst einmal ohne AsyncAPI Format sondern direkt als Markdown (oder leichtes JSON-Meta-Format) ähnlich wie die aktuelle Doku nur autogeneriert/-aktualisiert.

Also aus einer Struktur wie dieser

// types.ts
export interface State {
  battery: Battery[];
  /** @mqtt.action write */
  batteryMode: BatteryMode;
  ...
}

interface Battery {
  power: number;
  capacity: number;
  soc: number;
  /** @description battery control supported */
  controllable: boolean
}

...

Dann so etwas generieren

# MQTT Docs

- `/battery/<index>/power` number
- `/battery/<index>/capacity ` number
- `/battery/<index>/soc` number
- `/battery/<index>/controllable` battery control supported, boolean
- `/batteryMode` ["ModeA", "ModeB"], writable

Natürlich wäre es cool, wenn wir Beschreibungstexte zu allen Werte hätten, wäre aber für einen ersten Wurf nicht zwingend erforderlich.

Wir können auch noch mit Value-Types anstatt JS Primitiven Arbeiten (bspw. capacity: Energy) und dann am Value Type Dokumentieren, dass es Energy in kWh, number ist weil wir das immer konsistent verwenden. Aber alles potentielle Erweiterung. Könnte man dann iterativ immer schicker machen.

Hierfür müssten am Parser/Generator bauen, die dann das Markdown (oder ein JSON) erzeugen welches wird dann bei jedem Release vom Core Repo ins Docs Repo pushen. Bei den Templates machen wir das heute ja schon so ähnlich. Defacto bauen wir dann dort die Publish Logik von unserem Go Code nach. Aber die ändert sich weniger häufig als sich Felder verändern.

@Maschga
Copy link
Contributor Author

Maschga commented Apr 25, 2025

Soetwas habe ich mir auch schon gedacht.
DIe mqtt-API ist viel zu groß und undurchsichtig, um sie manuell zu dokumentieren und danach zu aktualiseren.

Dann machen wir ertseinmal den Typescript Rewrite und dann das MQTT-API Thema. 👍

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

Successfully merging this pull request may close these issues.

documentation of mqtt api: planEnergy vs. plan/energy Document: Mqtt: allow nil/null/none/- as empty values
2 participants