Skip to content

UI: add unit property #21396

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

Merged
merged 8 commits into from
May 30, 2025
Merged

UI: add unit property #21396

merged 8 commits into from
May 30, 2025

Conversation

andig
Copy link
Member

@andig andig commented May 23, 2025

Refs #21352 (comment)

TODO

@andig andig added the ux User experience/ interface label May 23, 2025
Copy link

@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 @andig - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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 andig marked this pull request as draft May 23, 2025 12:52
@naltatis
Copy link
Member

Generated doc examples:

Vehicle

    type: template
    template: mercedes
    title: # Titel, Wird in der Benutzeroberfläche angezeigt (optional)
    capacity: 50 # Akkukapazität (kWh), optional
    user: # Benutzerkonto, bspw. E-Mail Adresse, User Id, etc.
    region: EMEA # [EMEA, APAC, NORAM]
    accessToken:
    refreshToken:
    vin: V... # Fahrzeugidentifikationsnummer, Wenn mehrere Fahrzeuge eines Herstellers vorhanden sind (optional)
    icon: car # Icon, Wird in der Benutzeroberfläche angezeigt [car, bike, bus, moped, motorcycle, rocket, scooter, taxi, tractor, rickshaw, shuttle, van, airpurifier, battery, bulb, climate, coffeemaker, compute, cooking, cooler, desktop, device, dishwasher, dryer, floorlamp, generic, heater, heatexchange, heatpump, kettle, laundry, laundry2, machine, meter, microwave, pump, smartconsumer, tool, waterheater] (optional)
    phases: 3 # Maximale Phasenanzahl, Die maximale Anzahl der Phasen welche genutzt werden können (optional)
    mode: # Standardlademodus, wenn ein Fahrzeug angeschlossen ist, Möglich sind Off, Now, MinPV und PV, oder leer wenn keiner definiert werden soll (optional)
    minCurrent: 6 # Minimale Stromstärke (A), Definiert die minimale Stromstärke pro angeschlossener Phase mit welcher das Fahrzeug geladen werden soll (optional)
    maxCurrent: 16 # Maximale Stromstärke (A), Definiert die maximale Stromstärke pro angeschlossener Phase mit welcher das Fahrzeug geladen werden soll (optional)
    identifiers: # Identifikation, Kann meist erst später eingetragen werden, siehe: https://docs.evcc.io/docs/features/vehicle (optional)
    priority: # Priorität, Priorität des Ladepunktes oder Fahrzeugs in Relation zu anderen Ladepunkten oder Fahrzeugen für die Zuweisung von PV-Energie (optional)
    cache: 15m # Cache, Zeitintervall nach dem Daten erneut vom Fahrzeug abgefragt werden (optional)

Meter

      type: template
      template: victron-energy
      usage: battery
      host: 192.0.2.2 # IP-Adresse oder Hostname
      port: 502 # Port, optional
      capacity: 50 # Akkukapazität (kWh), optional
      minsoc: 25 # Minimaler Ladestand (%), Untere Grenze beim Entladen der Batterie im normalen Betrieb (optional)
      maxsoc: 95 # Maximaler Ladestand (%), Oberes Limit beim Laden der Batterie aus dem Netz (optional)

Note: unit will only be show if description exists. Description should be a required field in templates anyways.

@naltatis
Copy link
Member

decide duration

I'd say we leave it as is. Currently Config UI converts duration fields to a second input field. In some special cases (e.g. enable/disable delay) it's shown as minute inputs. For now I think this is ok. We can decide to introduce (unit: s|m|h) for durations later to make it more configurable.

@naltatis naltatis assigned andig and unassigned naltatis May 26, 2025
@naltatis naltatis marked this pull request as ready for review May 26, 2025 16:18
Copy link

@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 @andig - I've reviewed your changes - here's some feedback:

  • I noticed some params (e.g. in pulsatrix.yaml) dropped their description block when converting to help-only—since the template still expects a description, please re-add it or adjust the template to avoid missing labels.
  • Please add or extend an end-to-end test that verifies the new unit prop is actually displayed in the UI for at least one field, to catch any integration gaps in PropertyField.
  • With so many YAML entries now having a unit, consider centralizing or templating the common unit definitions to reduce duplication and cut down on manual errors.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@naltatis naltatis mentioned this pull request May 29, 2025
@andig andig merged commit c136ebc into master May 30, 2025
6 checks passed
@andig andig deleted the feat/units branch May 30, 2025 09:47
@andig
Copy link
Member Author

andig commented May 30, 2025

@naltatis fehlt das evtl. noch bei den Demo Devices?

@andig andig mentioned this pull request May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux User experience/ interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants