From 11f6810b4f87c72509238decf6ca231cfa0beca1 Mon Sep 17 00:00:00 2001 From: gemu Date: Fri, 6 Dec 2024 08:12:40 +0100 Subject: [PATCH] add TESLA Powerwall example --- docs/Scripting-Language.md | 229 +++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) diff --git a/docs/Scripting-Language.md b/docs/Scripting-Language.md index 20564c03d7..afaf72261b 100644 --- a/docs/Scripting-Language.md +++ b/docs/Scripting-Language.md @@ -2643,6 +2643,235 @@ start dim level = initial dimmer level after power-up or restart; max 100 >W ; call web subroutine %=#wsub + +### accessing TESLA Powerwall 2 API + + This example fetches various values from Tesla Powerwall API + and displays them in the WEB UI and on an ILI9341 LCD display + + you will needs these additional defines: + #define USE_TLS + #define TESLA_POWERWALL + #define USE_SENDMAIL (because thes SSL Library from email is needed) + #define SCRIPT_GET_HTTPS_JP + + remark: since the Tasmota JSON parser has various limitations some TESLA JSON values had to be reanamed to get a more compact response. + + >D + tmp=0 + res=0 + cnt=0 + + ;powerwall + pwl=8 + ;Net + sip=0 + ;Solar + sop=0 + ;Battery + bip=0 + ;House + hip=0 + ;total cap + tcap=0 + ;remainig cap + rcap=0 + ;reserve percent + rper=0 + + ;3 phases + phs1=0 + phs2=0 + phs3=0 + + p1w=0 + p2w=0 + p3w=0 + p4w=0 + p5w=0 + p6w=0 + p7w=0 + p8w=0 + + pwf=0 + + xp=0 + yp=0 + + hs1="{m}%pwl% %% (%2(pwl/100*(tcap/1000))% kWh)%hs5% + Net%hs1%yellow;'>%sip% W %hs5% + Solar%hs1%green;'>%sop% W %hs5% + Battery%hs1%yellow;'>%bip% W %hs5% + House%hs1%red;'>%hip% W %hs5% + Total Capacity%hs1%yellow;'>%3(tcap/1000)% kWh %hs5% + Remaining Capacity%hs1%yellow;'>%3(rcap/1000)% kWh %hs5% + RcapLimit%hs1%yellow;'>%rper% %% %hs5% +
+ Solar P1%hs1%yellow;'>%1p1w% W %hs5% + Solar P2%hs1%yellow;'>%1p3w% W %hs5% +
+ Net P1%hs1%yellow;'>%1p5w% W %hs5% + Net P2%hs1%yellow;'>%1p6w% W %hs5% + Net P3%hs1%yellow;'>%1p7w% W %hs5% +
+ CTS Error%hs1%yellow;'>%perr%%hs5% +
+ heap:{m}%heap% + >R + print exit script ### Image gallery of various Tasmota scripts