go-e Charger WallBox über HTTPMOD

Begonnen von Prof. Dr. Peter Henning, 28 Januar 2024, 12:12:03

Vorheriges Thema - Nächstes Thema

Prof. Dr. Peter Henning

Die go-e Charger WallBox habe ich mir gekauft, weil sie auf vielfache Weise an FHEM angebunden werden kann. Nach etlichen Versuchen bin ich dazu gekommen, das Gerät über HTTPMOD anzubinden.

Warum?

- Die Anbindung des Gerätes via MQTT ist unterirdisch, weil die WallBox jede Sekunde etliche Daten sendet. Beispielsweise die Netzfrequenz - das braucht kein Mensch, es bremst nur den MQTT-Server aus und generiert Netzlast ohne Ende.

- Die Anbindung über das existierende Modul 46_goecharger.pm ist nicht zeitgemäß. Zwei Gründe dafür: a.) Das Modul funktioniert nur mit dem veralteten API Version 1, damit können aber nicht alle Features gesteuert werden. b.) Die Namen der Readings in diesem Modul sind absurd, beispielsweise verwendet es "current" als Zeitangabe, und die Ströme werden hingegen als "amp" bezeichnet. Statt des Begriffes Leistung (oder power) verwendet es "KW", und so weiter.

Lösung: Anbindung über die HTTP-Schnittstelle, also REST, genau wie das intern in dem Modul goecharger.pm gemacht wird. Aber flexibler und transparenter mit HTTPMOD.

Darin enthalten: Eine Anzahl Readings, die periodisch alle 60 Sekunden aktualisiert werden (oder manuell mit get .. status), ferner eine Anzahl von Readings, die nur stündlich aktualisiert werden (oder manuell mit get .. settings, oder automatisch nach dem Absetzen eines set ... <xxx>-Befehls). Außerdem können die Teilströme, Spannungen etc. noch mit get ... energy_details abgerufen werden.

Am Code nehme ich noch diverse Verbesserungen vor, es handelt sich nachfolgend um die erste Beta-Version. Aber hiermit kann man schon einmal die Funktionalitäten des goecharger-Moduls nachbilden. Also bitte gerne ausprobieren.

LG

pah

defmod Wally_c HTTPMOD http://192.168.0.xxx/api/status?filter=acu,alw,car,cus,err,modelStatus,tma,tpa,wh 60
attr Wally_c devStateIcon disabled.*:ev_car_charger@darkgrey not_allowed.*:ev_car_charger@white ready_no_car.*:ev_car_charger@blue charging.*:ev_car_charger@darkorange waiting_for_car.*:ev_car_charger@pink finished.*:ev_car_charger@lime error.*:ev_car_charger@red
attr Wally_c enableControlSet 0
attr Wally_c event-on-change-reading .*
attr Wally_c event-on-update-reading alw,car
attr Wally_c eventMap /charge_allowed on:on/charge_allowed off:off/
attr Wally_c extractAllJSON 0
attr Wally_c get01Name status
attr Wally_c get01URL http://192.168.0.xxx/api/status?filter=acu,alw,car,cus,err,modelStatus,tma,tpa,wh
attr Wally_c get02Name settings
attr Wally_c get02Poll 1
attr Wally_c get02PollDelay 3600
attr Wally_c get02URL http://192.168.0.xxx/api/status?filter=acs,ama,amp,amt,ate,cbl,cco,clp,dwo,fna,lck,lmo,pha,upo,ust,acu,alw,car,cus,err,modelStatus,tma,tpa,wh
attr Wally_c get03Name energy_details
attr Wally_c get03URL http://192.168.0.xxx/api/status?filter=fhz,nrg
attr Wally_c group energyControl
attr Wally_c reading01JSON alw
attr Wally_c reading01Name charge_allowed
attr Wally_c reading01OMap 0:no, 1:yes
attr Wally_c reading02JSON trx
attr Wally_c reading02Name transaction
attr Wally_c reading03JSON tpa
attr Wally_c reading03Name power
attr Wally_c reading04JSON wh
attr Wally_c reading04Name energy
attr Wally_c reading05JSON tma_0
attr Wally_c reading05Name temperature_box
attr Wally_c reading06JSON tma_1
attr Wally_c reading06Name temperature_cable
attr Wally_c reading07JSON acu
attr Wally_c reading07Name current_allowed
attr Wally_c reading08JSON ama
attr Wally_c reading08Name current_limit
attr Wally_c reading09JSON clp
attr Wally_c reading09Name current_limitPresets
attr Wally_c reading09RecombineExpr join ",", @matchlist
attr Wally_c reading10JSON amp
attr Wally_c reading10Name current_requested
attr Wally_c reading11JSON modelStatus
attr Wally_c reading11Name charge
attr Wally_c reading11OMap 0:NotChargingBecauseNoChargeCtrlData, 1:NotChargingBecauseOvertemperature, 2:NotChargingBecauseAccessControlWait,3:ChargingBecauseForceStateOn, 4:NotChargingBecauseForceStateOff, 5:NotChargingBecauseScheduler, 6:NotChargingBecauseEnergyLimit, 7:ChargingBecauseAwattarPriceLow, 8:ChargingBecauseAutomaticStopTestLadung, 9:ChargingBecauseAutomaticStopNotEnoughTime, 10:ChargingBecauseAutomaticStop, 11:ChargingBecauseAutomaticStopNoClock, 12:ChargingBecausePvSurplus, 13:ChargingBecauseFallbackGoEDefault, 14:ChargingBecauseFallbackGoEScheduler, 15:ChargingBecauseFallbackDefault, 16:NotChargingBecauseFallbackGoEAwattar, 17:NotChargingBecauseFallbackECO, 18:NotChargingBecauseFallbackAutomaticStop, 19:ChargingBecauseCarCompatibilityKeepAlive, 20:ChargingBecauseChargePauseNotAllowed, 21:NotChargingBecauseSimulateUnplugging, 22:NotChargingBecausePhaseSwitch, 24:NotChargingBecauseMinPauseDuration
attr Wally_c reading12JSON modelStatus
attr Wally_c reading12Name charge_num
attr Wally_c reading13JSON car
attr Wally_c reading13Name car_num
attr Wally_c reading14JSON car
attr Wally_c reading14Name car
attr Wally_c reading14OMap 0:unknown,1:idle,2:charging,3:wait,4:finished,5:error
attr Wally_c reading15JSON err
attr Wally_c reading15Name error_num
attr Wally_c reading16JSON err
attr Wally_c reading16Name error
attr Wally_c reading16OMap 0:none, 1:FiAc, 2:FiDc, 3:Phase, 4:OverVolt, 5:OverAmp, 6:Diode, 7:PpInvalid, 8:GndInvalid, 9:ContactorStuck, 10:ContactorMiss, 11:FiUnknown, 12:Unknown, 13:OverTemp, 14:NoComm, 15:LockStuckOpen, 16:LockStuckLocked
attr Wally_c reading20JSON acs
attr Wally_c reading20Name charge_auth
attr Wally_c reading20OMap 0:open,1:authentication
attr Wally_c reading21JSON xxxx
attr Wally_c reading21Name zzz4
attr Wally_c reading22JSON xxxx
attr Wally_c reading22Name zzzz5
attr Wally_c reading23JSON xxxxx
attr Wally_c reading23Name zzz7
attr Wally_c reading25JSON xxxx
attr Wally_c reading25Name zzz6
attr Wally_c reading27JSON amt
attr Wally_c reading27Name temperature_limit
attr Wally_c reading28JSON fna
attr Wally_c reading28Name name
attr Wally_c reading29JSON lmo
attr Wally_c reading29Name charge_mode
attr Wally_c reading29OMap 3:default,4:eco,5:nexttrip
attr Wally_c reading30Format %2.1f
attr Wally_c reading30JSON dwo
attr Wally_c reading30Name energy_stop
attr Wally_c reading30OExpr $val/1000
attr Wally_c reading31JSON cco
attr Wally_c reading31Name nexttrip_energy_100km
attr Wally_c reading32Format %2.1f
attr Wally_c reading32JSON ate
attr Wally_c reading32Name nexttrip_energy
attr Wally_c reading32OExpr $val/1000
attr Wally_c reading33JSON ust
attr Wally_c reading33Name lock_setting
attr Wally_c reading33OMap 0:while_car_present, 1:while_charging, 2:always
attr Wally_c reading34JSON lck
attr Wally_c reading34Name lock_mode
attr Wally_c reading34OMap 0:normal, 1:auto_unlock, 2:always, 3:force_unlock
attr Wally_c reading35JSON upo
attr Wally_c reading35Name lock_powerout
attr Wally_c reading35OMap 1:unlock, 0:no_unlock
attr Wally_c reading36JSON cus
attr Wally_c reading36Name lock
attr Wally_c reading36OMap 0:unknown, 1:unlocked, 2:unlock_failed, 3:locked, 4:lock_failed, 5:unlock_powerout
attr Wally_c reading37JSON cus
attr Wally_c reading37Name lock_num
attr Wally_c reading40JSON nrg
attr Wally_c reading40Name voltage_L1_L2_L3_N
attr Wally_c reading40RecombineExpr sprintf "%.1f - %.1f - %.1f - %.1f",$matchlist[0],$matchlist[1],$matchlist[8],$matchlist[9]
attr Wally_c reading41JSON nrg
attr Wally_c reading41Name current_L1_L2_L3
attr Wally_c reading41RecombineExpr sprintf "%.1f - %.1f - %.1f ",$matchlist[10],$matchlist[11],$matchlist[12]
attr Wally_c reading42JSON nrg
attr Wally_c reading42Name power_L1_L2_L3_N_t
attr Wally_c reading42RecombineExpr sprintf "%.1f - %.1f - %.1f - %.1f - %.1f",$matchlist[13],$matchlist[14],$matchlist[15],$matchlist[2],$matchlist[3]
attr Wally_c reading43JSON nrg
attr Wally_c reading43Name phaseF_L1_L2_L3_N
attr Wally_c reading43RecombineExpr sprintf "%.1f - %.1f - %.1f - %.1f",$matchlist[4],$matchlist[5],$matchlist[6],$matchlist[7]
attr Wally_c reading44Format %.2f
attr Wally_c reading44JSON fhz
attr Wally_c reading44Name frequency
attr Wally_c room Energie
attr Wally_c set01IMap 1:on, null:off
attr Wally_c set01Name charge_allowed
attr Wally_c set01URL http://192.168.0.211/api/set?trx=$val
attr Wally_c set02IMap 0:open,1:authentication
attr Wally_c set02Name charge_auth
attr Wally_c set02URL http://192.168.0.211/api/set?acs=$val
attr Wally_c set04Hint {ReadingsVal("Wally_c","current_limitPresets","10")}
attr Wally_c set04Max 16
attr Wally_c set04Min 6
attr Wally_c set04Name current_requested
attr Wally_c set04URL http://192.168.0.211/api/set?amp=$val
attr Wally_c set05IExpr $val*1000
attr Wally_c set05Name energy_stop
attr Wally_c set05URL http://192.168.0.211/api/set?dwo=$val
attr Wally_c set06Format %2.1f
attr Wally_c set06IExpr $val*10*ReadingsVal("Wally_c","nexttrip_energy_100km",0)
attr Wally_c set06Name nexttrip_distance
attr Wally_c set06URL http://192.168.0.211/api/set?ate=$val
attr Wally_c set07Name nexttrip_energy_100km
attr Wally_c set07URL http://192.168.0.211/api/set?cco=$val
attr Wally_c set08IMap 0:while_car_present, 1:while_charging, 2:always
attr Wally_c set08Name lock_setting
attr Wally_c set08URL http://192.168.0.211/api/set?ust=$val
attr Wally_c set09IMap true:unlock, false:no_unlock
attr Wally_c set09Name lock_powerout
attr Wally_c set09URL http://192.168.0.211/api/set?upo=$val
attr Wally_c set10IMap 3:default,4:eco,5:nexttrip
attr Wally_c set10Name charge_mode
attr Wally_c set10URL http://192.168.0.211/api/set?lmo=$val
attr Wally_c setFollowGet settings
attr Wally_c showError 1
attr Wally_c useSetExtensions 0
attr Wally_c userReadings state:car.* {my $c=ReadingsVal("$NAME","car_num",5);;\
  my $n=(ReadingsVal("$NAME","charge_allowed","no") ne "yes");;\
  ($n)?"not_allowed":(($c==1)?"ready_no_car":(($c==2)?"charging":(($c==3)?"wait_for_car":(($c==4)?"finished":"unknown"))))},\
nexttrip_distance:nexttrip_energy.* {sprintf("%.1f",ReadingsVal("Wally_c","nexttrip_energy",0)/ReadingsVal("Wally_c","nexttrip_energy_100km",1)*100)}
attr Wally_c webCmd on:off

satprofi

gruss
-----------------------------------------------------------------------
beelink miniPC - Fhem 6.x CUL 868, FS20, NetIO230 CUL 433
HMLAN, HM-CC-RT-DN,Homematic Actoren,LD382A,Telegram

Prof. Dr. Peter Henning

Gib doch mal die 192.168.0.2 nach außen frei, dann probiere ich, warum das bei Dir anders ist  8)

LG

pah

satprofi

habe voch V2, einige deiner Parameter hab ich gar nicht, bzw. haben andere bezeichnung.
gruss
-----------------------------------------------------------------------
beelink miniPC - Fhem 6.x CUL 868, FS20, NetIO230 CUL 433
HMLAN, HM-CC-RT-DN,Homematic Actoren,LD382A,Telegram

isy

#4
Hallo Peter,
ich nutze seit Beginn das GoE Modul GoECharger 0.2.5 (das wird allerdings nicht mehr wirklich unterstützt).
Damit habe ich meine PV-Überschussladung realisiert.

Ich habe heute deine Def. mal eingetragen, die läuft ohne Probleme, wie es scheint.
Der Status sieht gut aus und es kommen die Readings.

Im GoECharger Modul gibt es das numerische Reading "car_state" mit den Werten 1-4. Damit wird bei mir das DOIF zur PV-Überschussregelung abgebildet.
Ich sehe, dass ist bei dir über das Reading "car_num" realisiert.

Das ist so OK für mich!

VG Helmut
 

Nachtrag1: Aktuell brauche ich das Feature nicht, aber eine Phasenschaltung über das Modul per "set" wäre nett.
Nachtrag2: Was ist denn die Urdache für das Reading "LAST_ERROR DNS: Cant find host"
Ein Weg wird erst zu einem Weg, wenn man ihn geht

Prof. Dr. Peter Henning

#5
@satprofi: Ich nehme an, mit V2 meinst Du die Hardware, nicht das API. OK, aber das lässt sich natürlich bei einem HTTPMOD auf einfachste Weise anpassen, weil man nur die readingXXJSON ändern muss. Die Namen der Parameter für API V 1 findet man hier: https://github.com/goecharger/go-eCharger-API-v1/blob/master/go-eCharger%20API%20v1%20DE.md. Ich hänge hier unten ein Dokument an, in welchem ich beschrieben habe, welche Parameter ich für welchen Zweck in dem Codebeispiel verwendet habe (Achtung, Work in Progress)

@isy: Prima. Klar werde ich die Phasenumschaltung auch noch einbauen. Allerdings ist meine Wallbox noch nicht fest angeschlossen (sondern nur über _eine Phase_ testweise mit 230 V verbunden). Sie zieht deshalb noch keine Last (darf sie ja auch gar nicht...), und das E-Auto habe ich auch noch nicht. Ich finde eigentlich, dass ich dafür schon schön ganz weit gekommen bin...

ZitatWas ist denn die Urdache für das Reading "LAST_ERROR DNS: Cant find host"

Das meldet offenbar Deine WallBox als Fehler. Welchen Host sie meint, kann ich nicht sagen - vielleicht versucht sie auf die Cloud zuzugreifen und kommt nicht durch die Firewall?

LG

pah

isy

Was ist denn die Urdache für das Reading "LAST_ERROR DNS: Cant find host"

Danke für den Tipp!
Die Cloud habe ich nicht aktiviert.
FM stört nicht, alles läuft!
Ein Weg wird erst zu einem Weg, wenn man ihn geht

CQuadrat

Zitat von: Prof. Dr. Peter Henning am 30 Januar 2024, 17:10:30@isy: Prima. Klar werde ich die Phasenumschaltung auch noch einbauen. Allerdings ist meine Wallbox noch nicht fest angeschlossen (sondern nur über _eine Phase_ testweise mit 230 V verbunden). Sie zieht deshalb noch keine Last (darf sie ja auch gar nicht...), und das E-Auto habe ich auch noch nicht. Ich finde eigentlich, dass ich dafür schon schön ganz weit gekommen bin...

Ich habe auch den go-e Charger - allerdings bisher mit MQTT angebunden. Da stört mich allerdings auch die hohe Message-Dichte.
Deshalb will ich auch mal die Anbindung per HTTPMOD probieren. Da ich auch schon ein zugehöriges Fahrzeug habe  ;)  könnte ich gerne das eine oder andere testen.

Viele Grüße

Christoph
FHEM auf Mini-ITX-Server mit Intel Quad-Core J1900:
+ HM: HM-LAN, HM-USB, HM-MOD-UART mit div. HM-Komponenten
+ RFXtrx: Funkwetterstation Bresser mit ext. Thermometer, Regenmesser und Windmesser
+ TUL (KNX-Anbindung), KM271 (per ser2net), SONOS (div. Gimmicks), OneWire, Hue

isy

Gerade gesehen:
2024.01.31 11:02:27 3: ga_GoE: perl expression eval with expresion package main; my $timeDiff = $oRef->{'$timeDiff'};$val/1000 created warning: Argument "" isn't numeric in division (/) at (eval 502525) line 1.
"ga_GoE" ist das httpmod Device meiner GoE Box.
Ein Weg wird erst zu einem Weg, wenn man ihn geht

Prof. Dr. Peter Henning

Ich bin mir nicht so sicher, dass dies aus HTTPMOD stammt.

LG

pah

isy

Vermutlich nicht, löst aber anderswo diese Warnung aus. "package main" ?
Ein Weg wird erst zu einem Weg, wenn man ihn geht

Prof. Dr. Peter Henning

#11
@Isy: Sehr witzig, weil man nach dem doch sehr prägnanten Tippfehler "expresion" ein grep machen kann...
Dieser Tippfehler taucht in genau 2 Modulen auf: readingsGroup und readingsProxy.

Und noch ein Anliegen "Damit habe ich meine PV-Überschussladung realisiert."
Würde mich interessieren, wie genau. Das habe ich nämlich bei mir auch vor.

LG

pah

Prof. Dr. Peter Henning

@CQuadrat: Da ich die WallBox erstmal provisorisch an einer Phase hängen habe und keine Last ziehen kann, kann ich die Phasenumschaltung nicht wirklich ausprobieren.

Wie funktioniert denn die Leistungssteuerung durch den go-e Kontrollkasten? Ich nehme an, dass dieser (per Modbus TCP??) Daten an die WallBox meldet, z.B. die gegenwärtige Leistung der PV-ANlage. Dafür gibt es ja Variablen im API, die allerdings via REST-Schnittstelle nur lesbar sind.

Und welche Parameter werden dann verändert? Wir haben ja 5 Leistungstufen des Ladestroms, macht zusammen mit der Phasenumschaltung zwischen einer und drei Phasen dann 10 Leistungsstufen.

LG

pah

isy

Und noch ein Anliegen "Damit habe ich meine PV-Überschussladung realisiert."
Würde mich interessieren, wie genau. Das habe ich nämlich bei mir auch vor.


Das ist per DOIF realisiert.
Ich nutzte einen SMA Hybrid-WR inkl. Batteriespeicher mit dem entspr. Modul.
Siehe Textdatei.
Die Werte sind natürlich individuell zu wählen.
Das funktioniert bei mir ganzjährig. Bei Ankunft am Haus Ladestecker rein, fertig. Hoher WAF.
Der Einsatz unseres E-Fahrzeugs erfolgt weitgehend nur auf Kurzstrecken in der Stadt.

Dazu ein separates DOIF mit Auslesen meiner BMW-Fahrzeugdaten (per mqtt) zur Ladung auch ohne PV-Überschuss, wenn weniger als 6km elektr. Reichweite.

Dazu kommen noch manuelle Funktionen, wie
- Ladung "Ohne PV Status, mit Vorwahl für 4km, 12km und 20km". Nutze ich nur noch selten, seit ich die Reichweite meines Fahrzeugs auslesen kann.
- Ladung "Ohne PV Überschuss bis voll, nach Freigabe durch RFID-Chip.

Ein Weg wird erst zu einem Weg, wenn man ihn geht

Prof. Dr. Peter Henning

#14
Danke für die Info zum Überschussladen.

Ich habe die Phasenumschaltung jetzt mal testweise eingebaut:
attr Wally_c reading21JSON psm
attr Wally_c reading21Name phase_switchmode
attr Wally_c reading21OMap 0:auto, 1:force_1, 2:force_3
attr Wally_c reading22JSON spl3
attr Wally_c reading22Name phase_switchlevel

attr Wally_c set11Name phase_switchmode
attr Wally_c set11URL http://192.168.0.xxx/api/set?psm=$val
attr Wally_c set12Name phase_switchlevel
attr Wally_c set12URL http://192.168.0.xxx/api/set?spl3=$val

attr Wally_c get02URL http://192.168.0.xxx/api/status?filter=acs,ama,amp,amt,ate,cbl,cco,clp,dwo,fna,lck,lmo,pha,psm,spl3,upo,ust,acu,alw,car,cus,err,modelStatus,tma,tpa,wh

Was mir noch nicht klar ist (weil ich es noch nicht ausprobieren kann) ist, wann die "automatische" Phasenumschaltung greift. Geht das nur, wenn die WallBox von ihrem "Controller" eine PV-Überschussleisting von > 4,2 kW gemeldet bekommt? Diesen phase_switchlevel kann man ja in der gegenwärtigen Version auch einstellen, ich weiß aber noch nicht ob das Sinn macht. Oder wird das von der WallBox "automatisch" gemacht, wenn irgendein anderer Parameter sich ändert? Und wenn ja, welcher?

Ich habe mir außerdem einen Deckel für den Charger gedruckt. Erstens finde ich die mitgelieferte Diebstahlsicherung unmöglich, und zweitens stört mich das fette "go-e" Logo auf der ansonsten ganz gut designten Box. Es wird sich noch weisen, ob dieser Deckel sich schlecht auf die Innentemperatur auswirkt - aber das Ding hat, schön weiß lackiert, einen hohen WAF. Und kann nahtlos an einen Kabelkanal 30x15mm² angeschlossen werden. Wer Interesse hat, kann die STL-Datei gerne von mir bekommen.

LG

pah