GoE Charger: Unterschied zwischen den Versionen

Aus FHEMWiki
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
Zeile 181: Zeile 181:
attr Wally replacement70Regex %goeIP%
attr Wally replacement70Regex %goeIP%
attr Wally replacement70Value <IP-Adresse>
attr Wally replacement70Value <IP-Adresse>
attr Wally set01IMap null:no, 0:yes, 1:card_0
attr Wally set01IMap 0:neutral, 1:no, 2:forced
attr Wally set01Name charge_allowed
attr Wally set01Name charge_allowed
attr Wally set01URL http://%goeIP%/api/set?trx=$val
attr Wally set01URL http://%goeIP%/api/set?frc=$val
attr Wally set02IMap 0:open,1:authentication
attr Wally set02IMap 0:open,1:authentication
attr Wally set02Name charge_auth
attr Wally set02Name charge_auth
Zeile 256: Zeile 256:
attr Wally set72NoArg 1
attr Wally set72NoArg 1
attr Wally set72URL http://%goeIP%/api/set?psm=1&amp=6&lmo=3&fup=false
attr Wally set72URL http://%goeIP%/api/set?psm=1&amp=6&lmo=3&fup=false
attr Wally set73Name a_setForceOffSetMin
attr Wally set73NoArg 1
attr Wally set73URL http://%goeIP%/api/set?psm=1&amp=6&lmo=3&fup=false&frc=1&alw=false
attr Wally setFollowGet settings
attr Wally setFollowGet settings
attr Wally showError 1
attr Wally showError 1

Version vom 1. September 2024, 14:20 Uhr

Der GoE-Charger ist eine WallBox des österreichischen Herstellers go-e (geründet 2015). Derzeit (2024) sind verschiedene Modelle im Angebot:

  • go-e Charger Gemini - WallBox mit 11 oder 22 kW Ladeleistung
  • go-e Charger Gemini Flex - mobile Version des obigen Gerätes zum Anschluss an eine vorhandene Kraftstromsteckdose
  • go-e Charger Gemini 2.0 - Variante des obigen Gerätes mit integrierter SIM-Karte für mobilen Datenzugriff
  • go-e Charger Gemini Flex 2.0 - mobile Version des obigen Gerätes zum Anschluss an eine vorhandene Kraftstromsteckdose

Einbindung via HTTPMOD

Die Abfrage und Steuerung erfolgen über das HTTPMOD-Modul, welches im Regelfall einmal pro Minute auf die wichtigsten Daten der Wallbox zugreift, auch manuell abrufbar als

get Wally status

Weitere Informationen lassen sich mit

get Wally energy_details
get Wally led_details
get Wally goe_details 

abrufen.

Basisdefinition

Benötigt wird dazu die IP-Adresse der Wallbox im lokalen Netzwerk, die in den nachfolgenden Code einzusetzen ist. Das Device heißt im Beispiel einfach Wally

Code:
defmod Wally HTTPMOD http://<IP-Adresse der Wallbox>/api/status?filter=acu,alw,car,cus,err,eto,modelStatus,tma,tpa,trx,wh 60
attr Wally cmdIcon on:general_an off:general_aus
attr Wally devStateIcon disabled.*:ev_car_charger@darkgrey not_allowed.*:ev_car_charger@white ready_no_car.*:ev_car_charger@blue charging_car.*:ev_car_charger@darkorange wait_for_car.*:ev_car_charger@pink finished.*:ev_car_charger@green error.*:ev_car_charger@red
attr Wally enableControlSet 1
attr Wally event-on-change-reading .*
attr Wally event-on-update-reading alw,LAST_ERROR
attr Wally eventMap /charge_allowed yes:on/charge_allowed no:off/
attr Wally extractAllJSON 0
attr Wally get01Name status
attr Wally get01URL http://%goeIP%/api/status?filter=acu,alw,car,cus,err,eto,modelStatus,tma,tpa,trx,wh
attr Wally get02Name settings
attr Wally get02Poll 1
attr Wally get02PollDelay 3600
attr Wally get02URL http://%goeIP%/api/status?filter=acs,ama,amp,amt,ate,cbl,cco,clp,dwo,fna,fup,lck,lmo,pha,psm,spl3,upo,ust,acu,alw,car,cus,err,eto,modelStatus,tma,tpa,trx,wh
attr Wally get03Name energy_details
attr Wally get03URL http://%goeIP%/api/status?filter=fhz,nrg,pvopt_averagePGrid,pvopt_averagePPv,pvopt_averagePAkku
attr Wally get04Name led_details
attr Wally get04URL http://%goeIP%/api/status?filter=lbr,lse,cid,cwc,cch,cfi
attr Wally get05Name goe_details
attr Wally get05URL http://%goeIP%/api/status?filter=sse,fwv,typ
attr Wally group energyControl
attr Wally oldreadings energy
attr Wally reading01JSON alw
attr Wally reading01Name charge_allowed
attr Wally reading01OMap 0:no, 1:yes
attr Wally reading02JSON trx
attr Wally reading02Name transaction
attr Wally reading03JSON tpa
attr Wally reading03Name power
attr Wally reading03OExpr (ReadingsVal("Wally","car",0) =~ /charging/)?sprintf("%.3f",$val/1000):0
attr Wally reading04JSON wh
attr Wally reading04Name energy
attr Wally reading04OExpr sprintf("%.3f",$val/1000)
attr Wally reading05JSON tma_0
attr Wally reading05Name temperature_box
attr Wally reading06JSON tma_1
attr Wally reading06Name temperature_cable
attr Wally reading07JSON acu
attr Wally reading07Name current_allowed
attr Wally reading08JSON ama
attr Wally reading08Name current_limit
attr Wally reading09JSON clp
attr Wally reading09Name current_limitPresets
attr Wally reading09RecombineExpr join ",", @matchlist
attr Wally reading10JSON amp
attr Wally reading10Name current_requested
attr Wally reading11JSON modelStatus
attr Wally reading11Name charge
attr Wally 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, 23:NotChargingBecausePhaseSwitch, 24:NotChargingBecauseMinPauseDuration
attr Wally reading12JSON modelStatus
attr Wally reading12Name charge_num
attr Wally reading13JSON car
attr Wally reading13Name car_num
attr Wally reading14JSON car
attr Wally reading14Name car
attr Wally reading14OMap 0:unknown,1:idle,2:charging,3:wait,4:finished,5:error
attr Wally reading15JSON err
attr Wally reading15Name error_num
attr Wally reading16JSON err
attr Wally reading16Name error
attr Wally 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 reading17JSON sse
attr Wally reading17Name goe_serial
attr Wally reading18JSON fwv
attr Wally reading18Name goe_firmware
attr Wally reading19JSON typ
attr Wally reading19Name goe_device
attr Wally reading20JSON acs
attr Wally reading20Name charge_auth
attr Wally reading20OMap 0:open,1:authentication
attr Wally reading21JSON psm
attr Wally reading21Name phase_switchmode
attr Wally reading21OMap 0:auto, 1:force_1, 2:force_3
attr Wally reading22JSON spl3
attr Wally reading22Name phase_switchlevel
attr Wally reading23JSON pvopt_averagePGrid
attr Wally reading23Name power_grid_av
attr Wally reading23OExpr (ReadingsVal("Wally","charge_mode",0) eq "eco")?sprintf("%.1f",$val/1000):"-"
attr Wally reading24JSON pvopt_averagePPv
attr Wally reading24Name power_pv_av
attr Wally reading24OExpr (ReadingsVal("Wally","charge_mode",0) eq "eco")?sprintf("%.1f",$val/1000):"-"
attr Wally reading25JSON pvopt_averagePAkku
attr Wally reading25Name power_battery_av
attr Wally reading25OExpr (ReadingsVal("Wally","charge_mode",0) eq "eco")?sprintf("%.1f",$val/1000):"-"
attr Wally reading27JSON amt
attr Wally reading27Name temperature_limit
attr Wally reading28JSON fna
attr Wally reading28Name name
attr Wally reading29JSON lmo
attr Wally reading29Name charge_mode
attr Wally reading29OMap 3:default,4:eco,5:nexttrip
attr Wally reading30JSON dwo
attr Wally reading30Name energy_stop
attr Wally reading30OExpr ($val =~ /\d+/)?sprintf("%.1f",$val/1000):"no"
attr Wally reading31JSON cco
attr Wally reading31Name nexttrip_energy_100km
attr Wally reading32Format %2.1f
attr Wally reading32JSON ate
attr Wally reading32Name nexttrip_energy
attr Wally reading32OExpr $val/1000
attr Wally reading33JSON ust
attr Wally reading33Name lock_setting
attr Wally reading33OMap 0:while_car_present, 1:while_charging, 2:always
attr Wally reading34JSON lck
attr Wally reading34Name lock_mode
attr Wally reading34OMap 0:normal, 1:auto_unlock, 2:always, 3:force_unlock
attr Wally reading35JSON upo
attr Wally reading35Name lock_powerout
attr Wally reading35OMap 1:unlock, 0:no_unlock
attr Wally reading36JSON cus
attr Wally reading36Name lock
attr Wally reading36OMap 0:unknown, 1:unlocked, 2:unlock_failed, 3:locked, 4:lock_failed, 5:unlock_powerout
attr Wally reading37JSON cus
attr Wally reading37Name lock_num
attr Wally reading40JSON nrg
attr Wally reading40Name voltage_L1_L2_L3_N
attr Wally reading40RecombineExpr sprintf "%.1f - %.1f - %.1f - %.1f",$matchlist[0],$matchlist[1],$matchlist[8],$matchlist[9]
attr Wally reading41JSON nrg
attr Wally reading41Name current_L1_L2_L3
attr Wally reading41RecombineExpr sprintf "%.1f - %.1f - %.1f ",$matchlist[10],$matchlist[11],$matchlist[12]
attr Wally reading42JSON nrg
attr Wally reading42Name power_L1_L2_L3_N_t
attr Wally reading42RecombineExpr sprintf "%.1f - %.1f - %.1f - %.1f - %.1f",$matchlist[13],$matchlist[14],$matchlist[15],$matchlist[2],$matchlist[3]
attr Wally reading43JSON nrg
attr Wally reading43Name phaseF_L1_L2_L3_N
attr Wally reading43RecombineExpr sprintf "%.1f - %.1f - %.1f - %.1f",$matchlist[4],$matchlist[5],$matchlist[6],$matchlist[7]
attr Wally reading44Format %.2f
attr Wally reading44JSON fhz
attr Wally reading44Name frequency
attr Wally reading45Format %.3f
attr Wally reading45JSON eto
attr Wally reading45Name energy_total
attr Wally reading45OExpr $val/1000
attr Wally reading46Name phases
attr Wally reading47JSON fup
attr Wally reading47Name charge_pvSurplus
attr Wally reading47OMap 0:no,1:yes
attr Wally reading48JSON frc
attr Wally reading48Name forceState
attr Wally reading48OMap 0:neutral, 1:off, 2:on
attr Wally reading51JSON lbr
attr Wally reading51Name led_brightness
attr Wally reading52JSON lse
attr Wally reading52Name led_ecomode
attr Wally reading52OMap 0:no, 1:yes
attr Wally reading53JSON cid
attr Wally reading53Name led_colorIdle
attr Wally reading53OExpr substr $val,1
attr Wally reading54JSON cwc
attr Wally reading54Name led_colorWaitcar
attr Wally reading54OExpr substr $val,1
attr Wally reading55JSON cch
attr Wally reading55Name led_colorCharge
attr Wally reading55OExpr substr $val,1
attr Wally reading56JSON cfi
attr Wally reading56Name led_colorFinished
attr Wally reading56OExpr substr $val,1
attr Wally replacement70Mode text
attr Wally replacement70Regex %goeIP%
attr Wally replacement70Value <IP-Adresse>
attr Wally set01IMap 0:neutral, 1:no, 2:forced
attr Wally set01Name charge_allowed
attr Wally set01URL http://%goeIP%/api/set?frc=$val
attr Wally set02IMap 0:open,1:authentication
attr Wally set02Name charge_auth
attr Wally set02URL http://%goeIP%/api/set?acs=$val
attr Wally set04Hint slider,6,1,16
attr Wally set04Max 16
attr Wally set04Min 6
attr Wally set04Name current_requested
attr Wally set04URL http://%goeIP%/api/set?amp=$val
attr Wally set05IExpr ($val =~ /\d+/)?$val*1000:"null"
attr Wally set05Name energy_stop
attr Wally set05URL http://%goeIP%/api/set?dwo=$val
attr Wally set06Format %2.1f
attr Wally set06IExpr $val*10*ReadingsVal("Wally","nexttrip_energy_100km",0)
attr Wally set06Name nexttrip_distance
attr Wally set06URL http://%goeIP%/api/set?ate=$val
attr Wally set07Name nexttrip_energy_100km
attr Wally set07URL http://%goeIP%/api/set?cco=$val
attr Wally set08IMap 0:while_car_present, 1:while_charging, 2:always
attr Wally set08Name lock_setting
attr Wally set08URL http://%goeIP%/api/set?ust=$val
attr Wally set09IMap true:unlock, false:no_unlock
attr Wally set09Name lock_powerout
attr Wally set09URL http://%goeIP%/api/set?upo=$val
attr Wally set10IMap 3:default,4:eco,5:nexttrip
attr Wally set10Name charge_mode
attr Wally set10URL http://%goeIP%/api/set?lmo=$val
attr Wally set11IMap 0:auto,1:force_1,2:force_3
attr Wally set11Name phase_switchmode
attr Wally set11URL http://%goeIP%/api/set?psm=$val
attr Wally set12Name phase_switchlevel
attr Wally set12URL http://%goeIP%/api/set?spl3=$val
attr Wally set13Name goe_reboot
attr Wally set13NoArg 1
attr Wally set13URL http://%goeIP%/api/set?rst="true"
attr Wally set20Max 255
attr Wally set20Min 0
attr Wally set20Name led_brightness
attr Wally set20URL http://%goeIP%/api/set?lbr=$val
attr Wally set21IMap true:yes,false:no
attr Wally set21Name led_ecomode
attr Wally set21URL http://%goeIP%/api/set?lse=$val
attr Wally set22FollowGet led_details
attr Wally set22Name led_colorIdle
attr Wally set22TextArg 1
attr Wally set22URL http://%goeIP%/api/set?cid="%23$val"
attr Wally set23FollowGet led_details
attr Wally set23Name led_colorWaitcar
attr Wally set23TextArg 1
attr Wally set23URL http://%goeIP%/api/set?cwc="%23$val"
attr Wally set24FollowGet led_details
attr Wally set24Name led_colorCharge
attr Wally set24TextArg 1
attr Wally set24URL http://%goeIP%/api/set?cch="%23$val"
attr Wally set25FollowGet led_details
attr Wally set25Name led_colorFinished
attr Wally set25TextArg 1
attr Wally set25URL http://%goeIP%/api/set?cfi="%23$val"
attr Wally set47IMap true:yes, false:no
attr Wally set47Name charge_pvSurplus
attr Wally set47URL http://%goeIP%/api/set?fup=$val
attr Wally set48IMap 0:neutral, 1:off, 2:on
attr Wally set48Name forceState
attr Wally set48URL http://%goeIP%/api/set?frc=$val
attr Wally set70Name a_setAutoPvCharging
attr Wally set70NoArg 1
attr Wally set70URL http://%goeIP%/api/set?psm=0&amp=16&lmo=4&fup=true
attr Wally set71Name a_setManualMaxCharging
attr Wally set71NoArg 1
attr Wally set71URL http://%goeIP%/api/set?psm=2&amp=16&lmo=3&fup=false
attr Wally set72Name a_setManualMinCharging
attr Wally set72NoArg 1
attr Wally set72URL http://%goeIP%/api/set?psm=1&amp=6&lmo=3&fup=false
attr Wally setFollowGet settings
attr Wally showError 1
attr Wally sortby 3
attr Wally stateFormat { my $c=ReadingsVal("Wally","car_num",5);;\
  my $ca=ReadingsVal("Wally","charge_allowed","no");;\
  my $ch=ReadingsVal("Wally","charge_num",0);;\
  my $p=ReadingsVal("Wally","power",0);;\
  my $l=ReadingsVal("Wally","energy",0);;\
  my $e=(ReadingsVal("Wally","connection","") ne "ok");;\
  my $ret;;\
  if($ca eq "no"){\
     $ret="<p align=\"left\">\nnot_allowed\n<br/>not authenticated\n</p>";;\
  }elsif($c==1){\
    $ret=sprintf("<p align=\"left\">\nwaiting_car\n<br/>waiting for car (idle)\n<p/>");;\
  }elsif($c==2){\
    $ret=sprintf("<p align=\"left\">\ncharging_car\n<br/>charging %.1f kW\n<p/>",$p);;\
  }elsif($ch==12){\
      $ret=sprintf("<p align=\"left\">\ncharging paused\n<br/>charging PvSurplus %.1f kW\n</p>",$p);;\
  }elsif($ch==17){\
      $ret=sprintf("<p align=\"left\">\ncharging pausedrn<br/>charging PvSurplus paused\n</p>");;\
  }elsif($c==3){\
    $ret=sprintf("<p align=\"left\">\nwaiting_car\n<br/>waiting for car\n<p/>");;\
  }elsif($c==4){\
    $ret=sprintf("<p align=\"left\">\nfinished_car\n<br/>finished %.2f\n<p/>",$l);;\
  }else{\
    $ret="unknown";;\
 }\
 $ret}
attr Wally useSetExtensions 0
attr Wally userReadings nexttrip_distance:nexttrip_energy.* {sprintf("%.1f",ReadingsVal("$NAME","nexttrip_energy",0)/ReadingsVal("$NAME","nexttrip_energy_100km",1)*100)},\
  energy_today:energy_total.*  {sprintf("%.3f",ReadingsVal($NAME,"energy_total",0)-ReadingsVal("$NAME","energy_yesterday",0))},\
  energy_yesterday:none {}
attr Wally webCmd on:off
attr Wally widgetOverride led_brightness:slider,0,1,255 led_colorIdle:colorpicker,RGB led_colorWaitcar:colorpicker,RGB led_colorCharge:colorpicker,RGB led_colorFinished:colorpicker,RGB

End-of-day Reporting

Etwas ungünstig ist, dass sich die Wallbox nicht merkt, wieviel Energie an einem bestimmten Tag in das Fahrzeug geladen wurde. Sie kennt stattdessen nur die ausgegebene Gesamtenergie und die Energie seit der letzten Ankopplung. Um das zu umgehen, wurde in das HTTPMOD-Device bereits ein userreading energy_today eingebaut. Das muss natürlich am Ende eines jeden Tages befüllt werden, außerdem kann man beim Fahrzeug speichern, wieviel es "heute" bekommen hat. Entweder durch eine Automatisierungslösung (wie z.B. YAAHM) oder ein at-device sollte deshalb kurz vor Mitternacht der folgende Perl-Code aufgerufen werden.

sub GoEC_EOD(){
  my $e=ReadingsVal("Wally","energy_total",0);
  my $f=ReadingsVal("Wally","energy_today",0);
  my $g=ReadingsVal(<Device des Fahrzeugs>,"odometer",0);
  fhem("setreading Wally energy_yesterday $e");
  fhem("setreading <Device des Fahrzeugs> charge_athome ".sprintf("%.3f total %.3f odo %d",$f,$e,$g));
  fhem("setreading Wally energy_today 0.0");
}

Status als Nachricht

Für den Fall, dass man zwischendurch den Status der Wallbox abfragen möchte (z.B. via Modul Babble), empfiehlt es sich, ein ständig aktuelles Reading message bereitzuhalten. Im nachfolgenden Code bitte <Fahrzeug> durch die Bezeichnung des eigenen Fahrzeugs ersetzen, und ggf. für die Restladezeit auf das Device für das Fahrzeug verweisen.

Code:
attr Wally babbleName wallbox
attr Wally userReadings <hier andere userReadings>,
  message:((car)|(charge)|(energy_total)).* {\
  my $ca=ReadingsVal("$NAME","car_num",0);;\
  my $ch=ReadingsVal("$NAME","charge_num",0);;\
  my $ret;;\
  if($ca==1){\
    $ret="An der Wallbox ist kein Fahrzeug angeschlossen";;\
  }elsif($ca=~/2|3/){\
    $ret="An der Wallbox ist der <Fahrzeug> angeschlossen";;\
    if($ch=~/^([0-6]$)|(1[6,8])|(2[1-4])/){\
       my $nc=ReadingsVal("$NAME","charge",0);;\
       $ret.=", wird aber im Moment nicht geladen, der Grund dafür hat die Bezeichnung $nc";;\
    }elsif( $ch==12 ){\
       my $po=ReadingsVal("$NAME","power",0);;\
       my $en=ReadingsVal("$NAME","energy",0);;\
       $ret.=", wird mit solarem Überschuss von $po Kilowatt geladen und hat bereits $en Kilowattstunden erhalten.";;\
 }elsif( $ch==17 ){\
       my $en=ReadingsVal("$NAME","energy",0);;\
       $ret.=", die Ladung mit solarem Überschuss pausiert gerade. Der <Fahrzeug> hat bereits $en Kilowattstunden erhalten.";;\
    }else{\
       my $po=ReadingsVal("$NAME","power",0);;\
       my $en=ReadingsVal("$NAME","energy",0);;\
       $ret.=", wird mit $po Kilowatt geladen und hat bereits $en Kilowattstunden erhalten.";;\
       my $du=ReadingsVal(<Device für das Fahrzeug>,"charge_timeremain",0);;\
       $ret.="Restladezeit etwa $du Minuten";;\
    }\
  }elsif($ca==4){\
    my $en=ReadingsVal("$NAME","energy",0);;\
    $ret="An der Wallbox ist der <Fahrzeug> angeschlossen und wurde mit $en Kilowattstunden fertig geladen.";;\
  }else{\
    $ret="Die Wallbox befindet sich im Fehlerzustand, bitte überprüfen";;\
  }\
  return $ret},\
connection:LAST_ERROR.* {my $e=ReadingsVal("$NAME","LAST_ERROR","");;\
  if($e=~/timed out/){\
    return "timed_out"\
   }else{\
    return "ok"\
  }\
 }

Solares Überschussladen

Beim solaren Überschussladen benötigt die Wallbox spätestens alle sieben Sekunden neue Daten über die solare Leistung, die aus dem Stromnetz (Grid) bezogene Leistung und die aus dem Speicher bezogene Leistung, jeweils in Watt. Die Wallbox steuert dann recht zuverlässig den Ladevorgang so, dass möglichst wenig Leistung ins Netz eingespeist wird. Das geht natürlich nicht stufenlos, weil die Ladeströme in der Regel nicht stufenlos eingestellt werden können. Die minimale Ladeleistung sind deshalb ca. 1,4 kW, erreicht mit einem Ladestrom von 6 Ampere einphasig. Für die maximale Ladeleistung beim solaren Überschussladen sollte man natürlich wissen, was PV-Anlage und Speicher zusammen liefern können.

Zur Versorgung der Wallbox mit Daten wird ein at-device eingerichtet, das alle 5 Sekunden ein Perl-Programm aufruft, welches diese Daten sammelt und per HTTP an die Wallbox übermittelt

defmod WallyFiller at +*00:00:05 {GoEC_setPvSPData()}

Das Perl-Programm kann man z.B. in einer Datei 99_EnergyUtils unterbringen. Im Beispiel holt es die Daten aus einem Device PowerFlow, welches die Leistungswerte in kW enhält. Bitte daraum achten, dass die Wallbox einen negativen Datenwert für pAkku verlangt, wenn der Speicher gerade geladen wird.

 sub GoEC_setPvSPData() {
  my $uri             = sprintf("http://<IP-Adresse>/api/set?ids={%%22pGrid%%22:%.0f,%%22pPv%%22:%.0f,%%22pAkku%%22:%.0f}",
	ReadingsVal("PowerFlow","power_grid",0.0)*1000,ReadingsVal("PowerFlow","power_PV2",0.0)*1000,ReadingsVal("PowerFlow","power_battery",0.0)*(-1000,));
	
  HttpUtils_NonblockingGet(
        {
            url         => $uri,
            timeout     => 5,
            method      => 'GET',
        }
    );
 }

Zur Entlastung des FHEM-Systems sollte man das natürlich "schaltbar" machen. Auch dafür gibt es ein Device

defmod WallyPvSurplus dummy
attr WallyPvSurplus cmdIcon on:general_an off:general_aus
attr WallyPvSurplus devStateIcon on:general_on off:general_off
attr WallyPvSurplus setList state:on,off
attr WallyPvSurplus webCmd on:off

und natürlich ein notify- oder DOIF-Device, das auf dieses reagiert und die entsprechende Perl-Routine aufruft. Mit DOIF:

defmod Wally.N DOIF\
([WallyPvSurplus] eq "on")\
{GoEC_setPvSP("on")}\
DOELSEIF\
([WallyPvSurplus] eq "off")\
{GoEC_setPvSP("off")}

Diese Perl-Routine führt die verschiedenen Umschaltvorgänge aus.

sub GoEC_setPvSP($) {
  my ($cmd) = @_;
  if( $cmd eq "on" ){
     speak("Tab1.EG","Solares Überschussladen an der WallBox eingeschaltet");
     fhem("set Wally charge_mode eco");
     fhem("set Wally current_requested 6");
     fhem("set Wally charge_pvSurplus yes");
     fhem("set Wally interval 10");
     fhem("set WallyFiller active");
  }else{
    fhem("set WallyFiller inactive");
    fhem("set Wally interval 60");
    fhem("set Wally charge_pvSurplus no");
    fhem("set Wally current_requested 16");
    fhem("set Wally charge_mode default");
    speak("Tab1.EG","Solares Überschussladen an der WallBox ausgeschaltet")
      if($cmd ne "quietoff");
  }
}