Skip to content

Conversation

@lehmanju
Copy link
Contributor

@lehmanju lehmanju commented Jan 1, 2026

Die WARP Charger von Tinkerforge implementieren inzwischen alle eine HTTP API. Dieser PR implementiert diese API analog zur MQTT API. Die MQTT API wird weiter unterstützt, ist aber als deprecated markiert. Zukünftige Nutzer können die Wallbox jetzt einfacher konfigurieren, es ist nur die Angabe einer IP/eines Hostnamens erforderlich.

Damit wird der MQTT Broker für mich dann auch endlich überflüssig und kann abgeschaltet werden.

Außerdem:
- devcontainer baute nicht, deswegen moby deaktiviert #26335

@evcc-bot evcc-bot added devices Specific device support enhancement New feature or request labels Jan 1, 2026
Copy link
Contributor

@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 - I've left some high level feedback:

  • In meterValues the length check len(res) <= 5 will still allow slices of length 5 and then currents/voltages index up to res[5], so this should be len(res) < 6 (or equivalent) to avoid a potential out-of-bounds panic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `meterValues` the length check `len(res) <= 5` will still allow slices of length 5 and then `currents`/`voltages` index up to `res[5]`, so this should be `len(res) < 6` (or equivalent) to avoid a potential out-of-bounds panic.

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
Copy link
Member

andig commented Jan 1, 2026

devcontainer baute nicht, deswegen moby deaktiviert

OT, bitte neuer PR.

@andig
Copy link
Member

andig commented Jan 1, 2026

Nice PR!

@andig
Copy link
Member

andig commented Jan 1, 2026

Die MQTT API wird weiter unterstützt, ist aber als deprecated markiert

Hast Du dazu eine Referenz?

@lehmanju
Copy link
Contributor Author

lehmanju commented Jan 1, 2026

Die MQTT API wird weiter unterstützt, ist aber als deprecated markiert

Hast Du dazu eine Referenz?

Ah, missverständlich. Die ist nicht in der WARP Firmware deprecated, sondern die evcc Templates sind als deprecated markiert ;).

@andig
Copy link
Member

andig commented Jan 1, 2026

Ah- für mich auch ok. Ohne Umwege ist egtl. immer besser!

@andig andig changed the title Tinkerforge WARP HTTP API Tinkerforge WARP HTTP API (BC) Jan 1, 2026
@andig andig requested a review from premultiply January 1, 2026 17:10
// CurrentPower implements the api.Meter interface
func (wb *WarpHTTP) currentPower() (float64, error) {
var res warp.MeterValues
uri := fmt.Sprintf("%s/meter/values", wb.uri)
Copy link
Collaborator

Choose a reason for hiding this comment

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

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, stelle ich um. Habs erstmal einfach 1:1 von MQTT übernommen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ich werds so machen, dass am Anfang geprüft wird, ob die meters API überhaupt unterstützt wird, sonst Fallback auf die alte API.

Copy link
Collaborator

@mfuchs1984 mfuchs1984 left a comment

Choose a reason for hiding this comment

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

See inline comment.

@deadrabbit87
Copy link
Contributor

Für Setups wo neben evcc auch andere Systeme auf die Wallbox zugreifen, hat MQTT den Vorteil dass alle Clients parallel per Publish/Subscribe lauschen können, ohne die Wallbox mehrfach zu pollen. Wäre es sinnvoll, die MQTT Templates nicht als deprecated zu markieren, sondern als gleichwertige Alternative zu belassen – für Nutzer die ohnehin einen Broker betreiben?


var phases func(int) error
var getPhases func() (int, error)
if cc.EnergyManagerURI != "" {
Copy link
Contributor

@deadrabbit87 deadrabbit87 Jan 3, 2026

Choose a reason for hiding this comment

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

Bei der WARP3 ist kein separater WEM notwendig, da die WARP3 die Phasenumschaltung selbst über die /power_manager/ API unterstützt. Der Code sollte prüfen ob die Wallbox-URI selbst das Feature hat.

Weiterhin sollte der Kommentar im Template angepasst werden, da dies für WARP3 Nutzer sonst irreführend ist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Guter Punkt, in dem Fall würde ich vermutlich für WARP3 einfach ein eigenes Template machen und dort die EnergyManagerURI auch auf die Wallbox URI hardcoden. Dann kann man auch die Dokumentation auseinander ziehen.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wie wäre es so?

  if cc.EnergyManagerURI == "" {
      wb.emURI = wb.uri
      wb.emHelper = wb.Helper
  }

  if res, err := wb.emState(); err == nil && res.ExternalControl != 1 {
      phases = wb.phases1p3p
      getPhases = wb.getPhases
  }

Das hier wäre die Antwort einer WARP2:

curl http://172.20.10.50/power_manager/state     
{"config_error_flags":0,"external_control":1} 

WEM:

curl http://172.20.10.60/power_manager/state        
{"config_error_flags":0,"external_control":0} 

und einer WARP3:

curl http://192.168.179.250/power_manager/state
{"config_error_flags":0,"external_control":0}

Copy link
Contributor Author

@lehmanju lehmanju Jan 3, 2026

Choose a reason for hiding this comment

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

Ich hab einfach so gedacht:

template: tinkerforge-warp3-http
products:
  - brand: TinkerForge
    description:
      generic: WARP3 Charger Smart
  - brand: TinkerForge
    description:
      generic: WARP3 Charger Pro
capabilities: ["mA", "1p3p", "rfid"]
  evcc: ["skiptest"]
params:
  - name: uri
    required: true
  - name: user
  - name: password
render: |
  type: warp-http
  uri: {{ .uri }}
  user: {{ .user }}
  password: {{ .password }}
  energyManagerUri: {{ .uri }}
  energyManagerUser: {{ .user }}
  energyManagerPassword: {{ .password }}

Da muss man als Nutzer dann auch nur noch eine URI eingeben. Und die Beschreibung mit WEM und Firmware Version ist auch gleich weg.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wieder Geschmackssache, bin ich persönlich neutral. Hat beides Vor- und Nachteile.

}

var res interface{}
return wb.DoJSON(req, &res)
Copy link
Contributor

@deadrabbit87 deadrabbit87 Jan 3, 2026

Choose a reason for hiding this comment

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

Verursacht bei mir einen EOF mit WARP2 und WEM:

[warp-http] TRACE 2026/01/03 14:54:57 GET http://172.20.10.50/info/features
[warp-http] TRACE 2026/01/03 14:54:57 ["evse","cp_disconnect","button_configuration","ethernet","firmware_update","meters","nfc","evse_gp_output","meter","meter_all_values","meter_phases"]
[warp-http] TRACE 2026/01/03 14:54:57 GET http://172.20.10.60/power_manager/state
[warp-http] TRACE 2026/01/03 14:54:57 {"config_error_flags":0,"external_control":0}
[warp-http] TRACE 2026/01/03 14:54:57 PUT http://172.20.10.50/evse/phase_auto_switch
[warp-http] TRACE 2026/01/03 14:54:57 {"enabled":false}
[warp-http] INFO 2026/01/03 14:54:57 disabling phase auto switch skipped: EOF
[warp-http] TRACE 2026/01/03 14:55:01 GET http://172.20.10.50/meter/values
[warp-http] TRACE 2026/01/03 14:55:01 {"power":2.832569361,"energy_rel":7784.958984,"energy_abs":7784.958984}
[warp-http] TRACE 2026/01/03 14:55:03 GET http://172.20.10.50/evse/external_current

Das hier ist die Antwort des WEMs auf den Endpunkt:

curl http://172.20.10.60/power_manager/state
{"config_error_flags":0,"external_control":0}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

EOF bei phase_auto_switch ist expected, weil die WARP2 das nicht unterstützt (glaube ich), deswegen auch nur ein INFO log und kein Fehler.

Copy link
Contributor

Choose a reason for hiding this comment

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

Aber nicht wenn ich einen WEM konfiguriert habe. Dann sollte kein EOF kommen, weil die WARP2 damit ja auch Phaseumschaltung kann.

Aber ja, ist korrekt, die WARP2 kann nur mit WEM Phasenumschaltung.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Auf der offiziellen Dokumentationsseite der API existiert der Auto Switch Endpunkt nur für WARP3: https://docs.warp-charger.com/docs/interfaces/mqtt_http/api_reference/evse/?hardwareType=warp3#evse_phase_auto_switch_warp3

Wenn man rechts WARP1/2 auswählt, dann fehlt dieser. Da ich selbst eine WARP2 habe, kann ich bestätigen, dass der Endpunkt nicht existiert.

Das heißt nicht, dass die WARP2 keine Phasenumschaltung kann, sondern bedeutet nur, dass sie das nicht selbst automatisch macht und man ein Verhalten wie hier #14403 hat.

@lehmanju
Copy link
Contributor Author

lehmanju commented Jan 3, 2026

Für Setups wo neben evcc auch andere Systeme auf die Wallbox zugreifen, hat MQTT den Vorteil dass alle Clients parallel per Publish/Subscribe lauschen können, ohne die Wallbox mehrfach zu pollen. Wäre es sinnvoll, die MQTT Templates nicht als deprecated zu markieren, sondern als gleichwertige Alternative zu belassen – für Nutzer die ohnehin einen Broker betreiben?

Die API wird ja nicht tausendfach pro Sekunde gepollt, insofern ist das denke ich kein Problem. HTTP mit JSON kann schon einiges ab, da kommt man mit evcc nicht so schnell an Grenzen. Andere Clients können ja weiterhin MQTT nutzen. Sollte sich Gegenteiliges herausstellen, kann man das deprecated ja wieder rückgängig machen. Aber besser ist glaube ich schon perspektivisch nur eine API zu pflegen.

}

// phases1p3p implements the api.PhaseSwitcher interface
func (wb *WarpHTTP) phases1p3p(phases int) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Gleiches Problem wie https://github.com/evcc-io/evcc/pull/26334/files#r2658941559 :

Der WEM gibt hier nichts zurück. Schalte ich auf "Schnell" wird zwar mit 3p geladen, aber nur mit 6 A weil evcc davon ausgeht, dass der Phasenwechsel fehlschlug.

Bei Bedarf kann ich die Trace Logs auch noch zur Verfügung stellen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Danke, ist tatsächlich ein anderes Problem. Auf der Startseite der API Doku schreiben sie, dass MQTT und HTTP dieselbe API haben und dann ist es doch nicht so :D. Jedenfalls heißt der Endpunkt bei HTTP wohl einfach nur external_control.

Danke fürs Testen!

@deadrabbit87
Copy link
Contributor

Ich nutze ein WARP2 mit WEM der die Phaseumschaltung macht.

Für Setups wo neben evcc auch andere Systeme auf die Wallbox zugreifen, hat MQTT den Vorteil dass alle Clients parallel per Publish/Subscribe lauschen können, ohne die Wallbox mehrfach zu pollen. Wäre es sinnvoll, die MQTT Templates nicht als deprecated zu markieren, sondern als gleichwertige Alternative zu belassen – für Nutzer die ohnehin einen Broker betreiben?

Die API wird ja nicht tausendfach pro Sekunde gepollt, insofern ist das denke ich kein Problem. HTTP mit JSON kann schon einiges ab, da kommt man mit evcc nicht so schnell an Grenzen. Andere Clients können ja weiterhin MQTT nutzen. Sollte sich Gegenteiliges herausstellen, kann man das deprecated ja wieder rückgängig machen. Aber besser ist glaube ich schon perspektivisch nur eine API zu pflegen.

Ich wollte das nur anmerken, da ich persönlich lieber weiter den Broker nutzen wollen würde.

Ist aber nicht konstruktiv begründet, sondern nur Geschmackssache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devices Specific device support enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants