RFC: Migration zu neuer Weboberfläche

hmm, das ändert dann leider das Verhalten je nach Version auf dem ESP, nicht sehr schön/RESTful…

besser wäre imho /rfid liefert alles wie jetzt und dann noch /rfid/onlyids z.B. dann bleibt das Verhalten gleich egal welche Version auf dem ESP ist…

1 „Gefällt mir“

Du hast natürlich Recht, ein Bruch ist hier sicher nicht notwendig. Vorschlag für die Benennung des Endpunktes?

/rfid/ids
/rfid/tagnames
/rfid/names

1 „Gefällt mir“

Hi ich würde gerne die API nutzen um eine eigene App zur Verwaltung der Karten anzubinden. Wie kann ich die API ausprobieren?

Indem du Obiges einfach an die Webadresse anhängst, die du sonst als Webinterface benutzt.

wir haben beide die selbe Idee:

:wink:

Wow das ist ja cool, hatte ich irgendwie übersehen im Forum.

Klasse Projekt, das du da mit dem ESPuino-Manager unter Windows umgesetzt hast! Ich denke geradeüber ähnliches nach, allerdings basierend auf Flutter für eine platformunabhängige und sogar mobile Umsetzung. Mein Ziel ist es die verschiedenen Musikplayer dort zu verwalten, Hochladen von Liedern, Zuweisung zu RFID-Karten und Kartendesigns, alles in einem. Ich habe die selben Karten bei mir auch noch in HomeAssistant am laufen. Die Kids legen die auf den HA TagReader auf und von einem Netzlaufwerk oder per Stream kommt dann auf den Sonos Speakern im Haus die Musik. Das YAML Format dafür möchte ich auch direkt durch meine App erzeugen. Das Format der Id’s die der Tagreader in HA liefert waren schon meine erste Herausforderung, aber vor ein paar Tagen habe ich endlich verstanden wie ich die richtig formatieren muss. es kann also losgehen.

Ich würde mich über Deinen Input freuen. Gab es spezifische Herausforderungen, insbesondere im Hinblick auf die API. Was für Features wolltest oder hast Du umgesetzt?

Ich habe mal eine Liste der verfügbaren Endpunkte zusammengestellt.
Das kann man noch schöner machen, aber bisher hat sich noch niemand gefunden, der das anständig dokumentiert.
Stand 04.01.2024:

All available endpoints:

/explorer (GET, POST, DELETE, PUT, PATCH)
/savedSSIDs (GET, POST, DELETE)
/activeSSID (GET)
/wificonfig (GET, POST)
/settings (GET, POST)
/rfid (GET, POST, DELETE)
/logo (GET)
/favicon (GET)
/info (GET)
/log (GET)
/stats (GET)
/debug (GET)
/upload (POST)
/update (POST)
/restart (POST)
/shutdown (POST)
/rfidnvserase (POST)
/wifiscan (GET)
/trackprogress (GET)
/inithalleffectsensor (GET)

SD-File explorer endpoints:

/explorer (GET)
Sends a list of the content of a directory as JSON file.
Requires a GET parameter path for the directory.
„path=/“ or leave empty for listing the root directory

/explorer (POST)
Handles file upload request from the explorer.
Requires a GET parameter „path“, as directory path to the file

/explorer (DELETE)
Handles delete request of a file or directory.
Requires a GET parameter „path“ to the file or directory

/explorer (PUT)
Handles create request of a directory.
Requires a GET parameter „path“ to the new directory

/explorer (PATCH)
Handles rename request of a file or directory.
Requires a GET parameter „srcpath“ to the old file or directory name.
Requires a GET parameter „dstpath“ to the new file or directory name.

/exploreraudio (POST)

Handles audio play requests
Requires a GET parameter „path“ to the audio file or directory
Requires a GET parameter „playmode“

/explorerdownload (GET)

Handles download request of a file
Requires a GET parameter „path“ to the file

Saved networks (SSIDs) endpoints:

/savedSSIDs (GET)
Get a list of saved networks

/saveSSIDs (POST)
Save a new network.
Requires a JSON object with „SSID“ and „pwd“, optional „static“, „static_addr“, „static_gateway“, „static_subnet“, „static_dns1“, „static_dns2“ if using static ip configuration.

/saveSSIDs (DELETE)
Delete a saved network.
Requires a GET parameter „ssid“

/activeSSID (GET)
Get the current active network name

Common WiFi-settings endpoints:

/wificonfig (GET)
Get current common wifi configuration. Returns a Json object with „hostname“ and „ScanWiFiOnStart“

/wificonfig (POST)
Save current common wifi configuration.
Requires a Json object with „hostname“ and „ScanWiFiOnStart“

Common settings endpoints:

/settings (GET)
Get common settings.
Returns a Json object with all settings.
Optional GET param „section“ to retrieve a single settings section.
Valid sections: „general“, „defaults“, „wifi“, „led“, „battery“, „ftp“, „mqtt“, „bluetooth“

/settings (POST)
Save settings.
Requires a JSON object with all settings or a single section

RFID-Tag assigments endpoints:

/rfid (GET)
list all save RFID-tag assignments with its details.
Optional GET param „id“ to list only a single assignment.

/rfid (POST)
Save new or overwrite existing RFID-tag assignment.
Requires a JSON object with at „id“, „fileOrUrl“, „modId“ or „playMode“

/rfid (DELETE)
Delete a RFID-tag assignment.
Requires a GET param „id“

/rfid/ids-only (GET)
returns an array of tag-id keys

Other endpoints:

/cover
handle album cover image request.
Serves current cover art image

/logo, /favicon
Serve the ESPuino logo, favicon
Allows to serve a custom icon from SD „/.html/logo.png“, „/.html/favicon.png“

/info (GET)
Returns a Json object with common information

/log (GET)
Returns the current log as text

/stats (GET)
Returns a HTML webpage with task runtime information

/debug (GET)
return task runtime & debug information as JSON

/upload (POST)
NVS-backup-upload

/update (POST)
Upload new firmware

/restart (POST)
Perform a restart. No params required

/shutdown (POST)
Perform a shutdown (deep-sleep). No params required

/rfidnvserase (POST)
erase all RFID-assignments from NVS

/wifiscan (GET)
Get a list of available nearby WiFi-networks.
First request will return 0 results unless you start scan from somewhere else (loop/setup)
Do not request more often than 3-5 seconds!

/trackprogress (GET)
Get current track progress, time and duration

/inithalleffectsensor (GET)
Init HallEffectSensor Value
To be doumented by the contributor!

4 „Gefällt mir“

Falls sich jmd fragt, was damit gemeint ist: Schön wäre es, das Ganze in ein yaml zu packen. Weil dann ist es einheitlich dokumentiert und man kann OpenApi Swagger als Plugin in Visual Studio Code installieren. Dort kann man sich dann schön Datentypen und auch Beispiel-Requests anschauen.
Automatisiert testen (ok, es muss halt ein ESPuino laufen) könnte man die Schnittstelle mittels https://www.postman.com/. Das geht aber auch ohne yaml.

2 „Gefällt mir“

Das ist schon genau was ich gesucht habe! Wie müsste das als YAML aussehen? Vielleicht so?

swagger: '2.0'
info:
  version: 1.0.0
  title: Espuino API
paths:
  /explorer:
    get:
      description: Get the content of a directory
      parameters:
        - name: path
          in: query
          type: string
          required: true
          description: The directory path
      responses:
        200:
          description: Successful response with directory content
    post:
      description: Handle file upload request
      parameters:
        - name: path
          in: query
          type: string
          required: true
          description: The directory path
      responses:
        200:
          description: Successful file upload
    delete:
      description: Handle file or directory deletion
      parameters:
        - name: path
          in: query
          type: string
          required: true
          description: The file or directory path
      responses:
        200:
          description: Successful deletion
    put:
      description: Handle directory creation
      parameters:
        - name: path
          in: query
          type: string
          required: true
          description: The new directory path
      responses:
        200:
          description: Successful directory creation
    patch:
      description: Handle file or directory renaming
      parameters:
        - name: srcpath
          in: query
          type: string
          required: true
          description: The old file or directory name
        - name: dstpath
          in: query
          type: string
          required: true
          description: The new file or directory name
      responses:
        200:
          description: Successful renaming
  /exploreraudio:
    post:
      description: Handle audio play requests
      parameters:
        - name: path
          in: query
          type: string
          required: true
          description: The audio file or directory path
        - name: playmode
          in: query
          type: string
          required: true
          description: The play mode
      responses:
        200:
          description: Successful audio play
  /explorerdownload:
    get:
      description: Handle download request of a file
      parameters:
        - name: path
          in: query
          type: string
          required: true
          description: The file path
      responses:
        200:
          description: Successful download
  /savedSSIDs:
    get:
      description: Get a list of saved networks
      responses:
        200:
          description: Successful response with saved networks
    post:
      description: Save a new network
      parameters:
        - name: SSID
          in: body
          required: true
          schema:
            type: object
            properties:
              SSID:
                type: string
              pwd:
                type: string
              static:
                type: boolean
              static_addr:
                type: string
              static_gateway:
                type: string
              static_subnet:
                type: string
              static_dns1:
                type: string
              static_dns2:
                type: string
      responses:
        200:
          description: Successful network save
    delete:
      description: Delete a saved network
      parameters:
        - name: ssid
          in: query
          type: string
          required: true
          description: The SSID to delete
      responses:
        200:
          description: Successful network deletion
  /activeSSID:
    get:
      description: Get the current active network name
      responses:
        200:
          description: Successful response with active network name
  /wificonfig:
    get:
      description: Get current common wifi configuration
      responses:
        200:
          description: Successful response with wifi configuration
    post:
      description: Save current common wifi configuration
      parameters:
        - name: hostname
          in: body
          required: true
          schema:
            type: object
            properties:
              hostname:
                type: string
              ScanWiFiOnStart:
                type: boolean
      responses:
        200:
          description: Successful wifi configuration save
  /settings:
    get:
      description: Get common settings
      parameters:
        - name: section
          in: query
          type: string
          required: false
          description: The section of settings to retrieve
      responses:
        200:
          description: Successful response with common settings
    post:
      description: Save settings
      parameters:
        - name: settings
          in: body
          required: true
          schema:
            type: object
            properties:
              general:
                type: object
                # Include all settings properties here
              defaults:
                type: object
                # Include all defaults properties here
              wifi:
                type: object
                # Include all wifi properties here
              led:
                type: object
                # Include all led properties here
              battery:
                type: object
                # Include all battery properties here
              ftp:
                type: object
                # Include all ftp properties here
              mqtt:
                type: object
                # Include all mqtt properties here
              bluetooth:
                type: object
                # Include all bluetooth properties here
      responses:
        200:
          description: Successful settings save
  # Continue documenting other endpoints...

1 „Gefällt mir“

Das ist doch schon mal ein super Anfang!

Nur wäre statt Swagger 2.0 OpenAPI 3.0 (oder 3.1) besser.

Bei SSID könnte man auch noch ‚required‘ für die nicht-static felder nehmen.

Wer damit nicht so vertraut ist: Das obige yaml kann man in editor.swagger.io einfügen um sich eine API-Doku zu erstellen.

Ok, dann aber OpenAPI 3 dann funktioniert auch der editor.swagger.io sowie das Plugin für VSCode

Was ich bereits habe:

openapi: 3.0.0
info:
  title: ESPuino API
  version: 1.0.2
  description: API for the ESPuino, a DIY Smart Speaker project. ESPuino is a DIY Smart Speaker that uses software-based audio decoding, supports various music sources, and offers a user-friendly web interface. It simplifies audio processing and enhances user feedback with Neopixel rings.

servers:
  - url: http://espuino.local/
    description: Development ESPuino

paths:
  /explorer:
    get:
      summary: Lists the contents of a directory.
      parameters:
        - in: query
          name: path
          schema:
            type: string
            default: "/"
          description: Path to the directory to be listed.
      responses:
        '200':
          description: Directory content successfully listed.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    isDir:
                      type: boolean
                      description: True if item is a directory.

    post:
      summary: Handles file upload.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Directory path to upload the file.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '200':
          description: File successfully uploaded.

    delete:
      summary: Deletes a file or directory.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path to the file or directory to be deleted.
      responses:
        '200':
          description: File or directory successfully deleted.

    put:
      summary: Creates a new directory.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path for the new directory to be created.
      responses:
        '200':
          description: Directory successfully created.

    patch:
      summary: Renames a file.
      parameters:
        - in: query
          name: srcpath
          schema:
            type: string
          description: Current path of the file to be renamed.
        - in: query
          name: dstpath
          schema:
            type: string
          description: New path for the file.
      responses:
        '200':
          description: File successfully renamed.

  /exploreraudio:
    post:
      summary: Handle audio play requests.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path to the audio file or directory.
        - in: query
          name: playmode
          schema:
            type: string
          description: Play mode for audio.
      responses:
        '200':
          description: Successful audio play.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string

  /explorerdownload:
    get:
      summary: Handle download request of a file.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path of the file to download.
      responses:
        '200':
          description: Successful download.

  /savedSSIDs:
    get:
      summary: Get a list of saved networks.
      responses:
        '200':
          description: Successful response with saved networks.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string

    post:
      summary: Save a new network.
      requestBody:
        description: Network details to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                SSID:
                  type: string
                pwd:
                  type: string
                static:
                  type: boolean
                static_addr:
                  type: string
                static_gateway:
                  type: string
                static_subnet:
                  type: string
                static_dns1:
                  type: string
                static_dns2:
                  type: string
              required:
                - SSID
                - pwd
      responses:
        '200':
          description: Successful network save.

    delete:
      summary: Delete a saved network.
      parameters:
        - in: query
          name: ssid
          schema:
            type: string
          description: SSID of the network to delete.
      responses:
        '200':
          description: Successful network deletion.

  /activeSSID:
    get:
      summary: Get the current active network name.
      responses:
        '200':
          description: Successful response with active network name.
          content:
            application/json:
              schema:
                type: string

  /wificonfig:
    get:
      summary: Get current common wifi configuration.
      responses:
        '200':
          description: Successful response with wifi configuration.
          content:
            application/json:
              schema:
                type: object
                properties:
                  hostname:
                    type: string
                  ScanWiFiOnStart:
                    type: boolean

    post:
      summary: Save current common wifi configuration.
      requestBody:
        description: Common wifi configuration to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                hostname:
                  type: string
                ScanWiFiOnStart:
                  type: boolean
              required:
                - hostname
                - ScanWiFiOnStart
      responses:
        '200':
          description: Successful wifi configuration save.

  /settings:
    get:
      summary: Get common settings.
      parameters:
        - in: query
          name: section
          schema:
            type: string
          description: Optional section to retrieve specific settings.
      responses:
        '200':
          description: Successful response with common settings.
          content:
            application/json:
              schema:
                type: object
                properties:
                  # Include your common settings properties here.

    post:
      summary: Save settings.
      requestBody:
        description: Settings to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                general:
                  type: object
                  # Include all general settings properties here
                defaults:
                  type: object
                  # Include all defaults settings properties here
                wifi:
                  type: object
                  # Include all wifi settings properties here
                led:
                  type: object
                  # Include all led settings properties here
                battery:
                  type: object
                  # Include all battery settings properties here
                ftp:
                  type: object
                  # Include all ftp settings properties here
                mqtt:
                  type: object
                  # Include all mqtt settings properties here
                bluetooth:
                  type: object
                  # Include all bluetooth settings properties here
              required:
                - general
      responses:
        '200':
          description: Successful settings save.

  /rfid:
    get:
      summary: List all saved RFID-tag assignments with details.
      parameters:
        - in: query
          name: id
          schema:
            type: string
          description: Optional ID to list only a single assignment.
      responses:
        '200':
          description: Successful response with RFID-tag assignments.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    # Include your RFID-tag assignment properties here.

    post:
      summary: Save new or overwrite existing RFID-tag assignment.
      requestBody:
        description: RFID-tag assignment details to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                fileOrUrl:
                  type: string
                modId:
                  type: string
                playMode:
                  type: string
              required:
                - id
                - fileOrUrl
      responses:
        '200':
          description: Successful RFID-tag assignment save.

    delete:
      summary: Delete an RFID-tag assignment.
      parameters:
        - in: query
          name: id
          schema:
            type: string
          description: ID of the RFID-tag assignment to delete.
      responses:
        '200':
          description: Successful RFID-tag assignment deletion.

  # Continue documenting other endpoints...

Wie sieht es damit aus? Ich würde es gerne gegen einen emulierten ESP32 laufen lassen. vielleicht hat da einer ideen?

Cool, das probiere ich auch mal aus mit dem Plugin.
Kann man als Basis-URL nicht http://espuino.local angeben? Weil dann kann man die Befehle doch direkt am angeschlossenen Gerät testen?

ja schon aber ich habe grad keinen :wink: und dachte das wäre noch cooler

Also jetzt habe ich meinem kleinsten den ESPunio abgeluchst und siehe da es funktioniert wie erwartet:

3 „Gefällt mir“

Cool wäre das direkt über Annotation im Code aktuell zu halten aber das ist wohl eher schwierig machbar. Gibt es eigentlich einen Plan für eine Doku Seite wo das dann mit rein könnte?

Das yaml wird auf Github eingecheckt und hier könnte es ggf. noch eine Doku geben in der Dokumenations-Kategorie.

4 „Gefällt mir“

Ich hab’s ausprobiert:

Open-API Erweiterung in VSCode installieren:

Dann die ESPuino-API.yaml in VSCode geöffnet

und oben rechts auf Vorschau klicken. Über „Try it out“ kann man die API direkt ausprobieren.

@pauel Es passt Alles, könntest Du noch die restlichen Endpunkte hinzufügen?
Danke für Deine Mühe!
Ich würde es dann ins Github übernehmen.

1 „Gefällt mir“

Wenn ich nicht täusche müssten das alle sein:

openapi: 3.0.0
info:
  title: ESPuino API
  version: 1.0.5
  description: API for the ESPuino, a DIY Smart Speaker project. ESPuino is a DIY Smart Speaker that uses software-based audio decoding, supports various music sources, and offers a user-friendly web interface. It simplifies audio processing and enhances user feedback with Neopixel rings.

servers:
  - url: http://espuino.local/
    description: Development ESPuino

paths:
  /explorer:
    get:
      summary: List the contents of a directory.
      description: Get a list of files and directories in the specified path.
      parameters:
        - in: query
          name: path
          schema:
            type: string
            default: "/"
          description: Path to the directory to be listed.
      responses:
        '200':
          description: Directory content successfully listed.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    isDir:
                      type: boolean
                      description: True if item is a directory.
    post:
      summary: Upload a file to a directory.
      description: Upload a file to the specified directory.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Directory path to upload the file.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '200':
          description: File successfully uploaded.
    delete:
      summary: Delete a file or directory.
      description: Delete a file or directory in the specified path.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path to the file or directory to be deleted.
      responses:
        '200':
          description: File or directory successfully deleted.
    put:
      summary: Create a new directory.
      description: Create a new directory in the specified path.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path for the new directory to be created.
      responses:
        '200':
          description: Directory successfully created.
    patch:
      summary: Rename a file.
      description: Rename a file from the source path to the destination path.
      parameters:
        - in: query
          name: srcpath
          schema:
            type: string
          description: Current path of the file to be renamed.
        - in: query
          name: dstpath
          schema:
            type: string
          description: New path for the file.
      responses:
        '200':
          description: File successfully renamed.
  /exploreraudio:
    post:
      summary: Play an audio file.
      description: Play an audio file specified by the path.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path to the audio file or directory.
        - in: query
          name: playmode
          schema:
            type: string
          description: Play mode for audio.
      responses:
        '200':
          description: Successful audio play.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
  /explorerdownload:
    get:
      summary: Download a file.
      description: Download a file specified by the path.
      parameters:
        - in: query
          name: path
          schema:
            type: string
          description: Path of the file to download.
      responses:
        '200':
          description: Successful download.
  /savedSSIDs:
    get:
      summary: Get a list of saved networks.
      description: Get a list of saved Wi-Fi networks.
      responses:
        '200':
          description: Successful response with saved networks.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
    post:
      summary: Save a new network.
      description: Save a new Wi-Fi network.
      requestBody:
        description: Network details to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                SSID:
                  type: string
                pwd:
                  type: string
                static:
                  type: boolean
                static_addr:
                  type: string
                static_gateway:
                  type: string
                static_subnet:
                  type: string
                static_dns1:
                  type: string
                static_dns2:
                  type: string
              required:
                - SSID
                - pwd
      responses:
        '200':
          description: Successful network save.
    delete:
      summary: Delete a saved network.
      description: Delete a saved Wi-Fi network by SSID.
      parameters:
        - in: query
          name: ssid
          schema:
            type: string
          description: SSID of the network to delete.
      responses:
        '200':
          description: Successful network deletion.
  /activeSSID:
    get:
      summary: Get the current active network name.
      description: Get the SSID of the currently active network.
      responses:
        '200':
          description: Successful response with active network name.
          content:
            application/json:
              schema:
                type: string
  /wificonfig:
    get:
      summary: Get current common Wi-Fi configuration.
      description: Get the current common Wi-Fi configuration settings.
      responses:
        '200':
          description: Successful response with Wi-Fi configuration.
          content:
            application/json:
              schema:
                type: object
                properties:
                  hostname:
                    type: string
                  ScanWiFiOnStart:
                    type: boolean
    post:
      summary: Save current common Wi-Fi configuration.
      description: Save the current common Wi-Fi configuration settings.
      requestBody:
        description: Common Wi-Fi configuration to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                hostname:
                  type: string
                ScanWiFiOnStart:
                  type: boolean
              required:
                - hostname
                - ScanWiFiOnStart
      responses:
        '200':
          description: Successful Wi-Fi configuration save.
  /settings:
    get:
      summary: Get common settings.
      description: Get common settings, optionally for a specific section.
      parameters:
        - in: query
          name: section
          schema:
            type: string
          description: Optional section to retrieve specific settings.
      responses:
        '200':
          description: Successful response with common settings.
          content:
            application/json:
              schema:
                type: object
                properties:
                  # Include your common settings properties here.
    post:
      summary: Save settings.
      description: Save common settings.
      requestBody:
        description: Settings to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                general:
                  type: object
                  # Include all general settings properties here
                defaults:
                  type: object
                  # Include all defaults settings properties here
                wifi:
                  type: object
                  # Include all Wi-Fi settings properties here
                led:
                  type: object
                  # Include all LED settings properties here
                battery:
                  type: object
                  # Include all battery settings properties here
                ftp:
                  type: object
                  # Include all FTP settings properties here
                mqtt:
                  type: object
                  # Include all MQTT settings properties here
                bluetooth:
                  type: object
                  # Include all Bluetooth settings properties here
              required:
                - general
      responses:
        '200':
          description: Successful settings save.
  /rfid:
    get:
      summary: List all saved RFID-tag assignments with details.
      description: Get a list of saved RFID-tag assignments with details. Optionally, provide an ID to list only a single assignment.
      parameters:
        - in: query
          name: id
          schema:
            type: string
          description: Optional ID to list only a single assignment.
      responses:
        '200':
          description: Successful response with RFID-tag assignments.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    # Include your RFID-tag assignment properties here.
    post:
      summary: Save or overwrite RFID-tag assignment.
      description: Save a new RFID-tag assignment or overwrite an existing one.
      requestBody:
        description: RFID-tag assignment details to save.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                fileOrUrl:
                  type: string
                modId:
                  type: string
                playMode:
                  type: string
              required:
                - id
                - fileOrUrl
      responses:
        '200':
          description: Successful RFID-tag assignment save.
    delete:
      summary: Delete an RFID-tag assignment.
      description: Delete an RFID-tag assignment by providing its ID.
      parameters:
        - in: query
          name: id
          schema:
            type: string
          description: ID of the RFID-tag assignment to delete.
      responses:
        '200':
          description: Successful RFID-tag assignment deletion.
  /rfid/ids-only:
    get:
      summary: Get an array of RFID tag IDs.
      description: Returns an array of RFID tag IDs without additional details.
      responses:
        '200':
          description: Successful response with RFID tag IDs.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string

  /cover:
    get:
      summary: Get album cover image.
      description: Handle album cover image requests and serve the current cover art image.
      responses:
        '200':
          description: Successful response with album cover image.
          content:
            image/jpeg:
              schema:
                type: string
                format: binary

  /logo:
    get:
      summary: Get ESPuino logo image.
      description: Serve the ESPuino logo image.
      responses:
        '200':
          description: Successful response with ESPuino logo image.
          content:
            image/jpeg:
              schema:
                type: string
                format: binary

  /favicon:
    get:
      summary: Get favicon image.
      description: Serve the favicon image.
      responses:
        '200':
          description: Successful response with favicon image.
          content:
            image/jpeg:
              schema:
                type: string
                format: binary

  /info:
    get:
      summary: Get common information.
      description: Returns a JSON object with common information about ESPuino.
      responses:
        '200':
          description: Successful response with common information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  # Include your common information properties here.

  /log:
    get:
      summary: Get current log.
      description: Returns the current log as text.
      responses:
        '200':
          description: Successful response with log text.
          content:
            text/plain:
              schema:
                type: string

  /stats:
    get:
      summary: Get task runtime information.
      description: Returns an HTML webpage with task runtime information.
      responses:
        '200':
          description: Successful response with task runtime information.
          content:
            text/html:
              schema:
                type: string

  /debug:
    get:
      summary: Get debug information.
      description: Returns task runtime and debug information as JSON.
      responses:
        '200':
          description: Successful response with debug information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  # Include your debug information properties here.

  /upload:
    post:
      summary: Upload NVS backup.
      description: Uploads a NVS backup file.
      responses:
        '200':
          description: Successful response for NVS backup upload.

  /update:
    post:
      summary: Upload new firmware.
      description: Uploads new firmware to ESPuino.
      responses:
        '200':
          description: Successful response for firmware update.

  /restart:
    post:
      summary: Restart ESPuino.
      description: Performs a restart of ESPuino. No parameters required.
      responses:
        '200':
          description: Successful response for ESPuino restart.

  /shutdown:
    post:
      summary: Shutdown ESPuino.
      description: Performs a shutdown (deep-sleep) of ESPuino. No parameters required.
      responses:
        '200':
          description: Successful response for ESPuino shutdown.

  /rfidnvserase:
    post:
      summary: Erase RFID assignments from NVS.
      description: Erases all RFID assignments from NVS.
      responses:
        '200':
          description: Successful response for RFID assignments erasure.

  /wifiscan:
    get:
      summary: Get nearby WiFi networks.
      description: Get a list of available nearby WiFi networks. The first request will return 0 results unless you start the scan from somewhere else (loop/setup). Do not request more often than 3-5 seconds!
      responses:
        '200':
          description: Successful response with nearby WiFi networks.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string

  /trackprogress:
    get:
      summary: Get current track progress.
      description: Get current track progress, time, and duration.
      responses:
        '200':
          description: Successful response with track progress information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  # Include your track progress information properties here.

  /inithalleffectsensor:
    get:
      summary: Initialize Hall Effect Sensor Value.
      description: Initializes the Hall Effect Sensor Value.
      responses:
        '200':
          description: Successful response for initializing Hall Effect Sensor Value.

Ich habe aber nicht alles durchprobieren können. z.B. beim Favicon bekomme ich:

<!DOCTYPE html>Ooups - page "/favicon" not found (404)<script>async function tryRedirect() {try {var url = "/";const response = await fetch(url);window.location.href = url;} catch (error) {console.log(error);setTimeout(tryRedirect, 2000);}}tryRedirect();</script>

Bei der Benutzung werden wir sicher noch Dinge ergänzen und genauer beschreiben müssen. Ich leg dann parallel mal los mit meiner App. Werde dann wenn dort was vorzuweisen ist die API anbinden. Dabei fällt mir sicher noch einiges auf das es im YAML zu verbessern gibt.

1 „Gefällt mir“

Ach ich habe irgendeine als dirty markierte Version im Einsatz, daran liegt es sicher. Ich werde es mal mit dem Release ESPuino 2.1 Latest versuchen wenn ich dazu komme.