Tesla Powerwall und Gateway: Unterschied zwischen den Versionen

Aus FHEMWiki
K (syntaxhighlight korrigiert; Links auf Wiki-Vorlagen umgestellt)
(Added gplot examples)
Zeile 35: Zeile 35:
Nach einem Shutdown/Restart sollte der Tesla Speicher im Status "ready" angezeigt werden.
Nach einem Shutdown/Restart sollte der Tesla Speicher im Status "ready" angezeigt werden.


==== Alternative Variante: ====
== Gplots ==
Um die Werte in FHEM anzuzeigen, können die Werte via Cookies in dummies gespeichert werden (Extraktion JSON):
Zur Anzeige der Werte hier 2 gplots


(Achtung, Zerlegung des Strings noch zu testen. Aktuelleres ggf. den Forumeinträgen entnehmen)<syntaxhighlight lang="perl">
==== Powerwall Kapazität ====
PowerwallDummy:Update.* {if ("$EVTPART1" eq "1"){
[[Datei:PowerwallCapacity.jpg]]
my $b = qx(curl -s -k -b <path_to_cookie>/tesla_cookie.txt https://192.168.178.xx/api/system_status/soe 2>&1);;
 
fhem("set PowerwallDummy jasonInput $b");
<syntaxhighlight lang="perl">
fhem ("set PowerwallDummy Prozent2 " .(split ":", (ReadingsVal("PowerwallDummy","jasonInput","")))[1]);
# Created by FHEM/98_SVG.pm, 2023-03-31 09:05:52
fhem ("set PowerwallDummy Prozent " .round((split "}", (ReadingsVal("PowerwallDummy","Prozent2","")))[0],1));}
set terminal png transparent size <SIZE> crop
elsif("$EVTPART1" eq "2"){
set output '<OUT>.png'
my $b = qx(curl -s -k -b <path_to_cookie>/tesla_cookie.txt https://192.168.178.xx/api/meters/aggregates 2>&1);;
set xdata time
fhem("set PowerwallDummy jasonInputAggregates $b");
set timefmt "%Y-%m-%d_%H:%M:%S"
fhem ("set PowerwallDummy Gridpower1 " .(split ":", (ReadingsVal("PowerwallDummy","jasonInputAggregates","")))[6]);
set xlabel " "
fhem ("set PowerwallDummy Solarpower1 " .(split ":", (ReadingsVal("PowerwallDummy","jasonInputAggregates","")))[77]);
set title '<L1>'
fhem ("set PowerwallDummy Batterypower1 " .(split ":", (ReadingsVal("PowerwallDummy","jasonInputAggregates","")))[30]);
set ytics
fhem ("set PowerwallDummy Housepower1 " .(split ":", (ReadingsVal("PowerwallDummy","jasonInputAggregates","")))[54]);
set y2tics
fhem ("set PowerwallDummy " .ReadingsVal("PowerwallDummy","Prozent",""));
set grid ytics
}}
set ylabel "Battery (%)"
set y2label "Battery (KW)"
 
#FileLog_myPowerwall 4:myPowerWall.batteryLevel\x3a::
#FileLog_myPowerwall 4:myPowerWall.batteryPower\x3a::
 
plot "<IN>" using 1:2 axes x1y1 title 'Level' ls l2 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y2 title 'Power' ls l0 lw 1 with lines
</syntaxhighlight>
 
==== Powerwall Charge ====
[[Datei:PowerwallLoads.jpg]]<syntaxhighlight lang="perl">
# Created by FHEM/98_SVG.pm, 2023-03-31 10:01:26
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<L1>'
set ytics
set y2tics
set grid ytics
set ylabel "Haus, Netz, Solar"
set y2label "Batterie"
 
#FileLog_myPowerwall 4:myPowerWall.aggregates-battery-instant_power\x3a::
#FileLog_myPowerwall 4:myPowerWall.aggregates-load-instant_power\x3a::
#FileLog_myPowerwall 4:myPowerWall.aggregates-site-instant_power\x3a::
#FileLog_myPowerwall 4:myPowerWall.aggregates-solar-instant_power\x3a::
 
plot "<IN>" using 1:2 axes x1y2 title 'Battery' ls l1 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y1 title 'Haus' ls l2 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y1 title 'Netz' ls l7 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y1 title 'Solar' ls l8fill lw 1 with lines
</syntaxhighlight>
</syntaxhighlight>



Version vom 31. März 2023, 09:23 Uhr

Einführung

Der Tesla Powerwall 2 wird als Batterie in eine Solaranlage integriert. Hier dient er als Energiespeicher. Es gibt eine App "Tesla" um den aktuellen Status als Benutzer auszulesen. Dazu gibt es noch eine lokale Webseite, die ebenfalls Zugriff auf den Status gibt.

Zusätzlich hat die Tesla Powerwall auch ein Web Api um Informationen auszulesen. Das kann genutzt werden, um die Powerwall auch in FHEM zu nutzen.

https://<ip-address powerwall>/api/system_status/soe
https://<ip-address powerwall>/api/meters/aggregates
https://<ip-address powerwall>/api/site_info
https://<ip-address powerwall>/api/sitemaster
https://<ip-address powerwall>/api/powerwalls
https://<ip-address powerwall>/api/networks
https://<ip-address powerwall>/api/system/networks
https://<ip-address powerwall>/api/operation
https://<ip-address powerwall>/api/status
https://<ip-address powerwall>/api/customer/registration

Es gibt aktuell mehrere Forumeinträge dazu:

Installation

Benötigt wird das FHEM Modul TeslaPowerwall2AC

Zur Installation definiere in FHEM die Powerwall:

define myPowerWall TeslaPowerwall2AC 192.168.x.y
attr myPowerWall emailaddr <your mail address used with Tesla gateway>

Danach muss noch das Passwort vom tesla Gateway gesetzt werden:

set myPowerwall setPassword pass=<your password>

Nach einem Shutdown/Restart sollte der Tesla Speicher im Status "ready" angezeigt werden.

Gplots

Zur Anzeige der Werte hier 2 gplots

Powerwall Kapazität

PowerwallCapacity.jpg

# Created by FHEM/98_SVG.pm, 2023-03-31 09:05:52
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<L1>'
set ytics
set y2tics
set grid ytics
set ylabel "Battery (%)"
set y2label "Battery (KW)"

#FileLog_myPowerwall 4:myPowerWall.batteryLevel\x3a::
#FileLog_myPowerwall 4:myPowerWall.batteryPower\x3a::

plot "<IN>" using 1:2 axes x1y1 title 'Level' ls l2 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Power' ls l0 lw 1 with lines

Powerwall Charge

PowerwallLoads.jpg

# Created by FHEM/98_SVG.pm, 2023-03-31 10:01:26
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<L1>'
set ytics
set y2tics
set grid ytics
set ylabel "Haus, Netz, Solar"
set y2label "Batterie"

#FileLog_myPowerwall 4:myPowerWall.aggregates-battery-instant_power\x3a::
#FileLog_myPowerwall 4:myPowerWall.aggregates-load-instant_power\x3a::
#FileLog_myPowerwall 4:myPowerWall.aggregates-site-instant_power\x3a::
#FileLog_myPowerwall 4:myPowerWall.aggregates-solar-instant_power\x3a::

plot "<IN>" using 1:2 axes x1y2 title 'Battery' ls l1 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y1 title 'Haus' ls l2 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y1 title 'Netz' ls l7 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y1 title 'Solar' ls l8fill lw 1 with lines

Verschiedenes

  • ...

Links

Hinweise

  • ...